0 Replies Latest reply on Sep 14, 2004 7:59 AM by wapdat

    Classloader subtleties between standalone Tomcat 4.127 and 3

    wapdat Newbie

      This is something I discovered in porting our applications in a standalone tomcat 4.1.27 to the tomcat 5 embedded in JBoss 3.2.5

      Previously we loaded property files using:

      this.getClass().getResourceAsStream(fileName)


      ie getting the class loader from the current class. What I found is that this didnt work in Tomcat/JBoss I needed to instead do

      Thread.currentThread ().getContextClassLoader ().getResourceAsStream(fileName)


      which works fine. I appreciate this isn't a clusterable way to load resources but thats not an issue for us today.

      Hope this tip saves someone some time. I couldn't find it mentioned anywhere.
      Lindsay Smith