1 Reply Latest reply on Oct 6, 2010 2:44 PM by Dick Adams

    Startup Classpath Not What I Expected

    Dick Adams Newbie

      I'm unable to see the files in my WEB-INF/lib directory during startup. This  ISpreventing me from doing time initialization with a context listener class that I had defined in my web.xml like this:








      The resulting error message looks like this:


      SEVERE: Exception sending context initialized event to listener instance of class com.uprr.tns.TnsContextListener

      java.lang.RuntimeException: Can't find log4j configuration file tns-log4j.xml on class path:

      C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;C:\software\jboss\EWS\1.0\bin\bootstrap.jar;C:\software\jboss\EWS\1.0/lib/spring-agent.jar


      Obviously the classapth at this point doesn't look like I thought it would. Is there a way to tell Jboss to add folders to the classpath so they're available to listener classes? (Note: The log4j config file is just one of several that I need to read on a one time basis at starttup).

        • 1. Re: Startup Classpath Not What I Expected
          Dick Adams Newbie

          I mis-spoke slightly. I re-checked the WAR, and the log4j config file is in WEB-INF classes, which means the classpath seaches should find it. Yet this code fails to do so:


          if (logger == null) {
             final URL url = ClassLoader.getSystemResource(CONFIG_FILE_NAME);
                if (url == null) {
                   final String classPath = System.getProperty("java.class.path");
          final String message = format(NO_CONFIG_FILE, CONFIG_FILE_NAME, classPath);  
          throw new RuntimeException(message);