3 Replies Latest reply on Oct 15, 2004 1:45 PM by Mark LaPolla

    JBoss4 ContextClassLoader

    bhalli Newbie

      Seeminlgy Thread.currentThread().getContextClassLoader().getResource(".") in jboss4 yields "${JBOSS_HOME}/server/default/conf/".
      Any thoughts on how to access resource files located inside .ear or .jar .war or .sar deploys.

        • 1. Re: JBoss4 ContextClassLoader
          Mark LaPolla Newbie

          I would like to know the answer to this. I ported some Java ClassLoader code from a web application into my ejb module and though I could look up the resource in my jar, I could not manipulate the path or load the resource.

          I am interested in this answer. What I am going to try next is to

          Thread.currentThread().getContextClassLoader().getResource("resources")

          After packaging my resources directory into my ejb.jar.

          Any help on this will be greatly appreciated.

          Thank you.


          • 2. Re: JBoss4 ContextClassLoader
            Mark LaPolla Newbie

            I have some observations and I'd like to know what's going on here. If I call the following:

            Thread.currentThread().getContextClassLoader().getResource(".");
            

            I get this path:
            "file:/C:/Java_Env/jboss-4.0.0/server/default/tmp/deploy/tmp33748app.ear-contents/web-exp.war/"
            

            If I call an actual resource name:
            Thread.currentThread().getContextClassLoader().getResource(ApplicationResources.mDATABASE_CONNECTION_POOL_PROPERTIES_RESOURCE);
            

            I get the path to my ejb jar.
            "file:/C:/Java_Env/jboss-4.0.0/server/default/tmp/deploy/tmp33748app.ear-contents/ejb.jar!/resources/DatabaseConnectionPool.properties"
            

            Thanks.

            • 3. Re: JBoss4 ContextClassLoader
              Mark LaPolla Newbie

              Pardon me, I'm using JBoss 4.0 with IntelliJ 4.5 and I am calling the getResource from my SessionBean. I am deploying in an .ear wtih a ejb module and a web module.

              Sorry about the lack of context.

              Thanks.