I think Werner is right... Please try using InputSource or try appending
a / in front of your name for ex /castor_mapping.xml

 -Harjit 

-----Original Message-----
From: Werner Guttmann [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 13, 2007 5:08 PM
To: [email protected]
Subject: Re: [castor-user] Problem loading xml mapping file

That's odd, as I'd expect that to work. If I were you, I'd switch to
using an InputSource, and initialize that InputSource with a manually
resolved resource path (just to see whether this resolves your issue).

Something along the lines ....

InputSurce is =
   new
InputSource(getClass().getClassLoader().getResource("...").toAbsolutePat
h());

That *always* works for me, incl. app servers such as Websphere,
Weblogic, Tomcat, JBoss, et alias.

Werner

Barron, Ken (KCTP) wrote:
> I'm running this on Tomcat 5.5 on Windows.  I'm coding in Eclipse but 
> I've tested it without Eclipse to rule out any additional classloader 
> issues.
> The mapping file is sitting under /WEB-INF/classes
>  
> Its going through a Spring controller and the relvant method is in my 
> DAO, its part of a fully fledged working Spring-Hibernate app which 
> has no other classloader issues.
>  
> I've stripped the relevant method down to:
>  
> * *
> 
> *import* org.exolab.castor.mapping.Mapping;
> 
> ...
> 
> * *
> 
> *public* *void* testCastor() *throws* DataAccessException
> 
> {
> 
> * *
> 
> *    try* {
> 
>         Mapping mapping = *new*
> Mapping(Thread./currentThread/().getContextClassLoader());
> 
>         mapping.loadMapping("castor_mapping.xml");
> 
>         //Never gets past the previous line.
> 
>     } *catch*(Exception e)
> 
>     {
> 
>         e.printStackTrace();
> 
> *        throw* *new* HibernateException(e);
> 
>     }
> 
> }
> 
>  
> 
>     -----Original Message-----
>     *From:* Singh, Harjit [mailto:[EMAIL PROTECTED]
>     *Sent:* 13 July 2007 14:54
>     *To:* [email protected]
>     *Subject:* RE: [castor-user] Problem loading xml mapping file
> 
>     I was able to load it.. I don't see any issues, what Appserver are
>     you running on ? trying using the classloader to see if it can
find
>     this mapping file.. Also send me the java code where you are
loading
>     this mapping file , please send the entire java file.
>      
>     Thanks
>      
>     - Harjit
> 
>
------------------------------------------------------------------------
>         *From:* Barron, Ken (KCTP) [mailto:[EMAIL PROTECTED]
>         *Sent:* Friday, July 13, 2007 3:52 AM
>         *To:* [email protected]
>         *Subject:* RE: [castor-user] Problem loading xml mapping file
> 
>         I have attached the mapping file - simplified as much as
possible.
>         I tried taking out the DOCTYPE completely in case it was a DTD
>         lookup problem but the error stack remains the same.
>          
>         Ken
> 
>             -----Original Message-----
>             *From:* Singh, Harjit [mailto:[EMAIL PROTECTED]
>             *Sent:* 12 July 2007 22:47
>             *To:* [email protected]
>             *Subject:* RE: [castor-user] Problem loading xml mapping 
> file
> 
>             Please attach the mapping File... I will try to load it on

> mine
>              
>             - H
> 
>
------------------------------------------------------------------------
>                 *From:* Barron, Ken (KCTP) [mailto:[EMAIL PROTECTED]
>                 *Sent:* Wednesday, July 11, 2007 4:05 AM
>                 *To:* [email protected]
>                 *Subject:* RE: [castor-user] Problem loading xml
mapping
>                 file
> 
>                 No, it gives the same error.  Any other ideas - this
is
>                 a showstopper for me.
>                  
>                 I'm running this on Tomcat, using the Spring
framework. 
>                 Here's the relevant part of the stacktrace:
>                  
>                 java.io.FileNotFoundException:
>                 castor_mapping.xml\castor_mapping.xml (The system
cannot
>                 find the path specified)
>                 at java.io.FileInputStream.open(Native Method)
>                 at java.io.FileInputStream.<init>(Unknown Source)
>                 at java.io.FileInputStream.<init>(Unknown Source)
>                 at
>
sun.net.www.protocol.file.FileURLConnection.connect(Unknown
>                 Source)
>                 at
>
sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown
>                 Source)
>                 at java.net.URL.openStream(Unknown Source)
>                 at
>
org.exolab.castor.util.DTDResolver.resolveEntity(DTDResolver.java:306)
>                 at
>
org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:243)
>                 at
>
org.exolab.castor.mapping.Mapping.loadMapping(Mapping.java:221)
>                 .... etc.
>                  
>                  
>                 -----Original Message-----
>                 *From:* Singh, Harjit [mailto:[EMAIL PROTECTED]
>                 *Sent:* 10 July 2007 20:44
>                 *To:* [email protected]
>                 *Subject:* RE: [castor-user] Problem loading xml
mapping
>                 file
> 
>                     Try this
>                      
> 
>                     Mapping mapping = *new*
>                     
> Mapping(Thread./currentThread/().getContextClassLoader());
> 
>                     mapping.loadMapping("castor_mapping.xml");
> 
>                      
> 
>                     - Harjit
> 
> 
>
------------------------------------------------------------------------
>                         *From:* Barron, Ken (KCTP)
>                         [mailto:[EMAIL PROTECTED]
>                         *Sent:* Tuesday, July 10, 2007 11:55 AM
>                         *To:* [email protected]
>                         *Subject:* [castor-user] Problem loading xml
>                         mapping file
> 
>                         Hi
>                         I'm new to castor and I must be doing
something
>                         very silly, but I can't get my xml mapping
file
>                         to load.  I am using the latest version of
>                         castor, castor-1.1.2.1.jar
> 
>                         I have placed the file castor_mapping.xml on
the
>                         classpath of my webapp (directly under
>                         WEB-INF/classes where all my other .properties
>                         files and config files are being picked up
>                         successfully).
> 
>                         I am using the instructions:
>                         Mapping mapping = XMLContext.createMapping();
>                         mapping.loadMapping("castor_mapping.xml");
> 
>                         and I get the following FileNotfound
exception:
>                         java.io.FileNotFoundException:
>                         castor_mapping.xml\castor_mapping.xml (The
>                         system cannot find the path specified)
> 
>                         Notice how the filename is repeated twice?
> 
>                         I tried variations on the load statement such
as
>                         Mapping mapping = new Mapping();
>                         mapping.loadMapping("castor_mapping.xml");
> 
>                         but they all give the same result.
> 
>                         What am i doing wrong?
> 
>                         Regards
>                         Ken
> 
>                     This email, including attachments, may include
confidential and/or
>                     proprietary information, and may be used only by
the person or entity
>                     to which it is addressed.  If the reader of this
email is not the 
>                     intended recipient or his or her authorized agent,
the reader is 
>                     hereby notified that any dissemination,
distribution or copying of this 
>                     email is prohibited. If you have received this
email in error, 
>                     please notify the sender by replying to this
message and delete this 
>                     email immediately.
> 
> 
> 
>             This email, including attachments, may include
confidential and/or
>             proprietary information, and may be used only by the
person or entity
>             to which it is addressed.  If the reader of this email is
not the 
>             intended recipient or his or her authorized agent, the
reader is 
>             hereby notified that any dissemination, distribution or
copying of this 
>             email is prohibited. If you have received this email in
error, 
>             please notify the sender by replying to this message and
delete this 
>             email immediately.
> 
> 
> 
>     This email, including attachments, may include confidential and/or
>     proprietary information, and may be used only by the person or
entity
>     to which it is addressed.  If the reader of this email is not the 
>     intended recipient or his or her authorized agent, the reader is 
>     hereby notified that any dissemination, distribution or copying of
this 
>     email is prohibited. If you have received this email in error, 
>     please notify the sender by replying to this message and delete
this 
>     email immediately.
> 
> 

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email



This email, including attachments, may include confidential and/or
proprietary information, and may be used only by the person or entity
to which it is addressed.  If the reader of this email is not the 
intended recipient or his or her authorized agent, the reader is 
hereby notified that any dissemination, distribution or copying of this 
email is prohibited. If you have received this email in error, 
please notify the sender by replying to this message and delete this 
email immediately.


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to