You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@jakarta.apache.org by Craig Altenburg <cr...@blueridge.com> on 2000/03/14 16:40:38 UTC

Trouble useing JARs with Tomcat 3.1 beta

I cannot seem to run a servlet that uses classes from a JAR file.


Here's a brief description of what I did:

I created a new directory in webapps called OptixXML.

In OptixXML I added a directory WEB-INF.

In WEB-INF I added to directories:  classes and lib.

I placed the ".jar" file in lib.

I placed the servlet's ".class" file in classes.

All file are public readable and directories are also public searchable.

When I try to run the servlet I get an error (see below) that seems
to be telling me that a class was not found but that class is in the ".jar".
I know it's in the ".jar" as I use the same ".jar" to compile the servlet.

BTW:
    I'm running RedHat 6.1.

    It does not seem to matter whether I use the Apache web server or the
      one built into Tomcat.

    The Tomcat sample servlets work fine.

    A servlet in the same directory that does not use the ".jar" works fine.

    It does not seem to matter whether or not I add information about the
    servlet into the web.xml file.

--- Error Message ---

Error: 500

Location: /OptixXML/servlet/TestServlet

Internal Servlet Error:

java.lang.NoClassDefFoundError: org/apache/ecs/Element
    at java.lang.ClassLoader.resolveClass0(Native Method)
    at java.lang.ClassLoader.resolveClass(ClassLoader.java, Compiled Code)
    at 
org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.j
ava, Compiled Code)
    at 
org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoad
er.java, Compiled Code)
    at 
org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java,
Compiled Code)
    at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
    at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
    at 
org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
Code)
    at 
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
Compiled Code)
    at 
org.apache.tomcat.core.ContextManager.service(ContextManager.java:523)
    at 
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Ajp12ConnectionHandler.java:147)
    at 
org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334
)
    at java.lang.Thread.run(Thread.java, Compiled Code)

-- 
Craig Altenburg


Re: Trouble useing JARs with Tomcat 3.1 beta

Posted by Fergus Gallagher <Fe...@OrbisUK.com>.
I have similar problems - my only workaround was to expand the jar into the 
classes directory

Fergus


At 10:40 14/03/00 -0500, Craig Altenburg wrote:
>I cannot seem to run a servlet that uses classes from a JAR file.
>
>
>Here's a brief description of what I did:
>
>I created a new directory in webapps called OptixXML.
>
>In OptixXML I added a directory WEB-INF.
>
>In WEB-INF I added to directories:  classes and lib.
>
>I placed the ".jar" file in lib.
>
>I placed the servlet's ".class" file in classes.
>
>All file are public readable and directories are also public searchable.
>
>When I try to run the servlet I get an error (see below) that seems
>to be telling me that a class was not found but that class is in the ".jar".
>I know it's in the ".jar" as I use the same ".jar" to compile the servlet.
>
>BTW:
>     I'm running RedHat 6.1.
>
>     It does not seem to matter whether I use the Apache web server or the
>       one built into Tomcat.
>
>     The Tomcat sample servlets work fine.
>
>     A servlet in the same directory that does not use the ".jar" works fine.
>
>     It does not seem to matter whether or not I add information about the
>     servlet into the web.xml file.
>
>--- Error Message ---
>
>Error: 500
>
>Location: /OptixXML/servlet/TestServlet
>
>Internal Servlet Error:
>
>java.lang.NoClassDefFoundError: org/apache/ecs/Element
>     at java.lang.ClassLoader.resolveClass0(Native Method)
>     at java.lang.ClassLoader.resolveClass(ClassLoader.java, Compiled Code)
>     at
>org.apache.tomcat.loader.AdaptiveClassLoader.loadClass(AdaptiveClassLoader.j
>ava, Compiled Code)
>     at
>org.apache.tomcat.loader.AdaptiveServletLoader.loadClass(AdaptiveServletLoad
>er.java, Compiled Code)
>     at
>org.apache.tomcat.core.ServletWrapper.loadServlet(ServletWrapper.java,
>Compiled Code)
>     at
>org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
>Compiled Code)
>     at
>org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
>Compiled Code)
>     at
>org.apache.tomcat.servlets.InvokerServlet.service(InvokerServlet.java:257)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled
>Code)
>     at
>org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java,
>Compiled Code)
>     at
>org.apache.tomcat.core.ContextManager.service(ContextManager.java:523)
>     at
>org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
>(Ajp12ConnectionHandler.java:147)
>     at
>org.apache.tomcat.service.TcpConnectionThread.run(SimpleTcpEndpoint.java:334
>)
>     at java.lang.Thread.run(Thread.java, Compiled Code)
>
>--
>Craig Altenburg
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: general-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: general-help@jakarta.apache.org

--
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717