1 Reply Latest reply on Mar 11, 2003 9:05 AM by Jim Andrade

    Problem loading xml resources

    Jim Andrade Newbie

      Hi all,

      I am converting a WL60-based app to jboss-3.0.6_tomcat-4.1.18. I have successfully deployed a .ear file (containing a .war, ejbs) along with several other jar to the server\default\lib dir.

      However, I am having a problem loading an xml file as a resource in a servlet. The xml file is located in a jar file in server\default\lib. The servlet has no problem accessing classes in the same jar file. Here's the code I am using, which returns null:

      Thread.currentThread().getContextClassLoader().getSystemResourceAsStream("com/hns/jobframework/persistence/impl/db-mapping.xml");

      I know the xml file exists in the jar, and that the path is right.

      BTW, the only way I can get this to work is if I put the xml file in my .war file and access it using config.getServletContext().getResourceAsStream("WEB-INF/classes/com/hns/jobframework/persistence/impl/db-mapping.xml"). But this is not acceptable, since I might not have access to the servlet context in other part of my code where I need to load resources.

      Thanks in advance for any and all help!

      Jim