Bruce:

This is strange.  When I tried it with the getResource() method from
the ClassLoader, it worked.

Why would it not work iwth getSystemResource()?

Thanks,
        Neil.

--
Neil Aggarwal
JAMM Consulting, Inc.    (972) 612-6056, http://www.JAMMConsulting.com
Custom Internet Development    Websites, Ecommerce, Java, databases


> -----Original Message-----
> From: Bruce Snyder [mailto:ferret@;frii.com]
> Sent: Thursday, October 31, 2002 1:34 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [castor-dev] ClassLoader not finding my database.xml
>
>
> This one time, at band camp, Neil Aggarwal said:
>
> NA>Hello:
> NA>
> NA>I am having a problem with trying to load my database.xml file
> NA>into JDO.  I am using castor 0.9.4 with mysql, tomcat, and apache
> NA>running on a RedHat Linux server.  I am trying to set up the
> NA>JNDI loading of the database using the commons dbcp connection
> NA>pool.
> NA>
> NA>I created a database.xml file and put it in the WEB-INF/classes
> NA>directory of my web application.  But, when I try to get
> NA>the URL to it from the ClassLoader, I get null.
> NA>
> NA>Here is my code:
> NA>
> NA>public class Utils {
> NA>  /**
> NA>   * Get the database
> NA>   */
> NA>  public static synchronized JDO getJDO() throws Exception {
> NA>
> NA>      ClassLoader loader = Utils.class.getClassLoader();
> NA>      System.err.println( "Loader is: "+loader );
> NA>      URL url = loader.getSystemResource("WEB-INF/database.xml");
> NA>      System.err.println( "Url is "+url );
> ...
> NA>You can see that /WEB-INF/classes directory is listed as one of
> NA>the classloader's repositories.  Why would it not find the database.xml
> NA>file?
>
> Neil,
>
> Is it because you've placed database.xml in WEB-INF/classes, but in your
> code you're looking for it in WEB-INF/?
>
> Bruce
> --
> perl -e 'print
> unpack("u30","<0G)U8V4\@4VYY9&5R\"F9E<G)E=\$\!F<FEI+F-O;0\`\`");'
>
> -----------------------------------------------------------
> If you wish to unsubscribe from this mailing, send mail to
> [EMAIL PROTECTED] with a subject of:
>       unsubscribe castor-dev

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to