  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Struts - A MVC web framework | | Tomcat - JSP/Servlet container | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | | JSP - A mailing list about Java Server Pages specification and reference | |
Struts & Hibernate
|
|
|
  | | | java.io.FileNotFoundException: mapping.xml (The system cannot find the path | java.io.FileNotFoundException: mapping.xml (The system cannot find the path 2004-08-17 - By Guy Katz
Back looks like a classloading issue. try Thread.currentThread().getContextClassLoader().getResource/AsStream("mapping .xml") in order to load the file.
also, did you put correct manifest entries?
-- --Original Message-- -- From: A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)]On Behalf Of Govind Kotwani Sent: Tuesday, August 17, 2004 3:22 PM To: J2EE-INTEREST@(protected) Subject: java.io.FileNotFoundException : mapping.xml (The system cannot find the path specified)
Hi,
This problem is more related to ear/packaging structure of files,still if someone has a solution.
I have an ear say "test.ear" which contain following jars and wars
a.jar-EJB b.jar-EJB c.jar-Not an EJB just some class files packaged in a jar d.war castor.jar xercesImpl.jar xmlParserAPIs.jar
In c.jar package strucure is like mapping.xml SomeClass.class in the package com.tcs.abc.xyz
This mapping. xml I am using with castor..to load mappings between business objects and xml .currently as described earlier this xml is lying at the root of c.jar.
In SomeClass.class I am trying to load this mapping.xml file by calling a castor API, code is as below
Mapping map = new Mapping(getClass().getClassLoader());
map.loadMapping("mapping.xml"); marshaller.setMapping(map);
When I try to run this it says xml file is not found and following exception is appearing
"java.io.FileNotFoundException : mapping.xml (The system cannot find the path specified)"
Does somebody know the solution.
Thanks and Regards, Govind
=========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help".
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859 (See http://iso-8859.ora-code.com)-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR></HEAD> <BODY> <DIV><SPAN class=991332614-17082004><FONT face=Arial color=#0000ff size=2>looks like a classloading issue.</FONT></SPAN></DIV> <DIV><SPAN class=991332614-17082004><FONT face=Arial color=#0000ff size=2>try Thread.currentThread().getContextClassLoader().getResource/AsStream("mapping .xml") in order to load the file.</FONT></SPAN></DIV> <DIV><SPAN class=991332614-17082004><FONT face=Arial color=#0000ff size=2></FONT></SPAN> </DIV> <DIV><SPAN class=991332614-17082004><FONT face=Arial color=#0000ff size=2>also, did you put correct manifest entries?</FONT></SPAN></DIV> <BLOCKQUOTE> <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma size=2>-- --Original Message-- --<BR><B>From:</B> A mailing list for Java(tm) 2 Platform, Enterprise Edition [mailto:J2EE-INTEREST@(protected)]<B>On Behalf Of </B>Govind Kotwani<BR><B>Sent:</B> Tuesday, August 17, 2004 3:22 PM<BR><B>To:</B> J2EE-INTEREST@(protected)<BR><B>Subject:</B> java.io.FileNotFoundException : mapping.xml (The system cannot find the path specified)<BR><BR></FONT></DIV><BR><FONT face=sans-serif size=2><BR>Hi,</FONT> <BR><BR><FONT face=sans-serif size=2>This problem is more related to ear/packaging structure of files,still if someone has a solution.<BR></FONT><BR><FONT face=sans-serif size=2>I have an ear say "test.ear" which contain following jars and wars</FONT><FONT size=3> </FONT><FONT face=sans-serif size=2><BR></FONT><BR><FONT face=sans-serif size=2><I>a.jar-EJB</I></FONT><FONT size=3><I> </I></FONT><FONT face=sans-serif size=2><I><BR>b.jar-EJB</I></FONT><FONT size=3><I> </I></FONT><FONT face=sans-serif size=2><I><BR>c.jar-Not an EJB just some class files packaged in a jar</I></FONT><FONT size=3><I> </I></FONT><FONT face=sans-serif size=2><I><BR>d.war</I></FONT><FONT size=3><I> </I></FONT><FONT face=sans-serif size=2><I><BR>castor.jar</I></FONT><FONT size=3><I> </I></FONT><BR><FONT size=3><I>xercesImpl.jar</I></FONT> <BR><FONT size=3><I>xmlParserAPIs.jar<BR></I></FONT><FONT face=sans-serif size=2><BR>In c.jar package strucure is like <BR>mapping.xml</FONT><FONT size=3> </FONT><BR><FONT face=sans-serif size=2>SomeClass.class in the package com.tcs.abc.xyz<BR></FONT><BR><BR><FONT face=sans-serif size=2>This mapping. xml I am using with castor..to load mappings between business objects and xml .currently as described earlier this xml is lying at the root of c.jar.<BR> <BR>In SomeClass.class I am trying to load this mapping.xml file by calling a castor API, code is as below</FONT><FONT size=3> <BR></FONT><FONT face="Courier New" size=2><BR>Mapping map = </FONT><FONT face="Courier New" color=#820040 size=2><B>new</B></FONT><FONT face="Courier New" size=2> Mapping(getClass().getClassLoader()); </FONT> <BR><FONT face="Courier New" size=2>map.loadMapping(</FONT><FONT face="Courier New" color=#4200ff size=2>"mapping.xml"</FONT><FONT face="Courier New" size=2>);</FONT> <BR><FONT face="Courier New" size=2>marshaller.setMapping(map);</FONT><FONT size=3><BR></FONT><FONT face="Courier New" size=2><BR>When I try to run this it says xml file is not found and following exception is appearing</FONT> <BR><BR><FONT face="Courier New" size=2>"java.io.FileNotFoundException : mapping.xml (The system cannot find the path specified)"</FONT> <BR><BR><BR><FONT face="Courier New" size=2>Does somebody know the solution.</FONT> <BR><BR><FONT face="Courier New" size=2>Thanks and Regards,</FONT> <BR><FONT face="Courier New" size=2>Govind</FONT></BLOCKQUOTE></BODY></HTML> =========================================================================== To unsubscribe, send email to listserv@(protected) and include in the body of the message "signoff J2EE-INTEREST". For general help, send email to listserv@(protected) and include in the body of the message "help". <p>
|
|
 |