#23 WEB-INF/lib libraries not found

v2.2 (stable)


I have the following problem using the JBoss Final
2.2.0, combined JBoss+Tomcat setup.
When deploying a .ear file, with a ejb.jar and
web.war, none of the libraries in WEB-INF/lib are
found in the servlet that uses one of those libraries.
A ClassDefNotFound exception occurs on one of those
libraries. As a fix for now I've just extracted the
libraries in WEB-INF/classes in the ejb.jar; these
classes are found.
Note that in version jboss-2.0-FINAL this problem does
NOT occur; all my libraries in WEB-INF/lib are found.
Note also that the classpath according to the Servlet
Engine does contain the required library, WEB-
INF/lib/MSBChart.jar. But, when I print the related
System properties, none of the mentioned libraries are
in the java.class.path property...
Note also that I didn't get 2.2.1(!) yet. Though
looking at the changelog/release notes, nothing is
mentioned about WEB-INF/log.

To be honest, I don't know whether I maybe should have
reported this problem to the Tomcat group. Also wasn't
sure about the category... Hope this is the right

Steps to reproduce:
- Deploy a complete .ear file (.war, .jar,
application.xml etc)
- In a servlet, make sure a library from WEB-INF/lib
is used
- Access the above servlet via a browser
- A ClassDefNotFound exception occurs when anything of
a WEB-INF/lib libary is used.

Server trace: see attached file.
OS info: see attached file.



  • Scott M Stark
    Scott M Stark

    Logged In: YES

    This works for me using the JBoss2.2.0/Tomcat3.2.1 bundle.
    See the jbosstest/web testsuite which contains a war with a
    lib directory that is access by EJBServlet. See what diffs
    exist between your ear and the jbosstest-web.ear which
    can be built using:
    build.bat web-subproject

    from within the jbosstest/src/build directory.

  • Scott M Stark
    Scott M Stark

    • status: open --> open-works-for-me
  • Logged In: YES

    This seems to be fixed in 2.2.1.
    2001-05-07 06:32:52 - Classpath according to the Servlet
    Engine is: /opt/JBoss-2.2.1_Tomcat-

  • Logged In: YES

    This problem is NOT fixed (as of 2.2.2 released on May 30,2001)
    The Util.jar is too simple to expose the problem.
    The problem (at least as it appears) is that WEB-INF/lib jars cannot seem to access other
    WEB-INF/lib jars. The current test does not check this.

    Here is what I know to recreate the problem.

    ==Step 1======================================================================
    Add this to snoop.jsp:

    <H>Hit Util.jar which is in the WEB-INF/lib/util.jar</h1>
    <font size="4">
    Util.getTime(): <%= org.jboss.test.web.util.Util.getTime() %>
    <H>Hit Util.jar checkClassLoading() which is in the WEB-INF/lib/util.jar</h1>
    <font size="4">
    Util.checkClassLoading(): <% org.jboss.test.web.util.Util.checkClassLoading(); %>

    =Step 2 =======================================================================
    Here is Util.java with my checkClassLoading() method added

    package org.jboss.test.web.util;

    import java.util.Date;

    /** A trivial utility class that is placed into the lib/util.jar directory
    of the war archive and used by servlets in the war to test access to the
    lib jars.

    @author Scott_Stark@displayscape.com
    @version $Revision: 1.1 $
    public class Util
    public static String getTime()
    return new Date().toString();

    // My test for class loading.
    public static void checkClassLoading() {
    try {
    // this one comes out of the crimson.jar (I believe)
    Class c1 = Class.forName("org.xml.sax.helpers.XMLReaderFactory");

    // this is definitely in xerces and throws an exception
    Class c2 = Class.forName("org.apache.xerces.parsers.SAXParser");
    } catch (ClassNotFoundException ex) {

    =Step 3=======================================================================
    Add this to build-web.xml (in jbosstest) in the ear target:
    <copy file="wherever/your/libs/are/xerces.jar"

    =Step 4 ======================================================================
    Build the ear and deploy it. Then load snoop.jsp. KABOOM!
    Check you log and you should see something like this:

    [EmbeddedTomcatSX] java.lang.ClassNotFoundException: org.apache.xerces.parsers.SAXParser
    [EmbeddedTomcatSX] at
    [EmbeddedTomcatSX] at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
    [EmbeddedTomcatSX] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
    [EmbeddedTomcatSX] at java.lang.Class.forName0(Native Method)
    [EmbeddedTomcatSX] at java.lang.Class.forName(Class.java:120)
    [EmbeddedTomcatSX] at org.jboss.test.web.util.Util.checkClassLoading(Util.java:22)
    [EmbeddedTomcatSX] at
    [EmbeddedTomcatSX] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
    [EmbeddedTomcatSX] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [EmbeddedTomcatSX] at
    [EmbeddedTomcatSX] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [EmbeddedTomcatSX] at
    [EmbeddedTomcatSX] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
    [EmbeddedTomcatSX] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
    [EmbeddedTomcatSX] at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    [EmbeddedTomcatSX] at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
    [EmbeddedTomcatSX] at org.apache.tomcat.core.Handler.service(Handler.java:287)
    [EmbeddedTomcatSX] at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
    [EmbeddedTomcatSX] at
    [EmbeddedTomcatSX] at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
    [EmbeddedTomcatSX] at
    [EmbeddedTomcatSX] at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
    [EmbeddedTomcatSX] at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
    [EmbeddedTomcatSX] at java.lang.Thread.run(Thread.java:484)

    This is a major problem which is preventing me from successfully upgrading to 2.2.
    This was broken after 2.0.

    Hope this helps. I really need this fixed and I don't have the time to track it down any further.
    If I totally missed the boat, let me know. I just need it working yesterday.

    Michael G. Mullis

  • Logged In: YES

    Please ignore my previous analysis. It is totally wrong. The problem in my case was due to the
    use of crimson.jar inserted into the run.sh file which conflicts with the xerces.jar that
    is in my war file. This sucks but at least I understand it now.
    Sorry for the confusion.

    I am not having a problem in jboss2.2.2 with the war file picking up other (non-xml parser) jars.

    Michael G. Mullis

  • Juha Lindfors
    Juha Lindfors

    • status: open-works-for-me --> closed-works-for-me