tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eddie tsai <t...@medusa.nn.com>
Subject Re: problem upgrading to tomcat4.0 from tomcat3.2
Date Fri, 23 Feb 2001 18:03:45 GMT
hi craig,

thanks for the suggestion. here is the result of my finding. i have
checked that i do not have a servlet.jar or jsdk.jar file in my
%JAVA_HOME/jre/lib/ext directory.

1. to be sure, i have reinstalled tomcat4.0 02/22/2001 nightly build on a
new directory. created a RS directory (and its subdirectories) under
webapps directory. compiled the following test servlet and put the
bytecode file into the classes directory. no script was
modified. everything is working for this case. here is the servlet code
and web.xml for my RS context.

TestServlet.java:

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class TestServlet extends GenericServlet {

    public void service(
		ServletRequest request,
		ServletResponse response) throws IOException,
ServletException
    {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("<html>");
        out.println("<body>");
        out.println("<head>");
        out.println("<title>Hello World!</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<h1>Hello World!</h1>");
        out.println("</body>");
        out.println("</html>");
    }
}

web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/j2ee/dtds/web-app_2_3.dtd">

<web-app>

    <servlet>
        <servlet-name>
            Test
        </servlet-name>
        <servlet-class>
            TestServlet
        </servlet-class>
    </servlet>

</web-app>

2. since i want my servlets to be in a package, i put following the
package
statement in the code. 

package com.nn.rn.rs;

compiled it and put the bytecode in com/nn/rn/rs directory under
the classes directory. changed the servlet-class to
com.nn.rn.rs.TestServlet in the web.xml file. restarted tomcat and
everything is still fine.


3. since i want my servlets to reside in c:\projects\com\..., i put the
bytecode file there. i modified catalina.bat to include c:\projects in
the class path to look for my servlet. restarted tomcat and i got the
following error. when i tried to fix this error by including the
servlet.jar in my class path, i got the "not a servlet" error described
in the original note. 

where did i go wrong? thanks for your help!


Exception Report:
javax.servlet.ServletException: Error allocating a servlet instance
	at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:557)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:513)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:325)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:262)
	at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:386)
	at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:254)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2087)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:162)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
	at java.lang.Thread.run(Thread.java:484)

Root Cause:
java.lang.NoClassDefFoundError: javax/servlet/GenericServlet
	at java.lang.ClassLoader.defineClass0(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:486)
	at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:248)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:297)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:253)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1024)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:903)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1024)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:903)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:1024)
	at
org.apache.catalina.loader.StandardClassLoader.loadClass(StandardClassLoader.java:903)
	at
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:746)
	at
org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:553)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:513)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:325)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:262)
	at
org.apache.catalina.servlets.InvokerServlet.serveRequest(InvokerServlet.java:386)
	at
org.apache.catalina.servlets.InvokerServlet.doGet(InvokerServlet.java:144)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:191)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:254)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:201)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2087)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:446)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:162)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:879)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:818)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:897)
	at java.lang.Thread.run(Thread.java:484)


On Thu, 22 Feb 2001, Craig R. McClanahan wrote:

> eddie tsai wrote:
> 
> > i just got the nightly build from 02/22/2001 and tried it. i am still
> > getting the "not a servlet" error. my servlet is in a package and in a
> > directory other than the 'classes' directory. i have included the
> > path to that directory in the classpath in the .bat file so it knows
> > where to look for my servlet. would this setup cause a problem like this?
> >
> 
> Please double check that you do not have a servlet.jar or jsdk.jar file in your
> $JAVA_HOME/jre/lib/ext directory.
> 
> Please try it with the standard startup scripts (i.e. temporarily moving your servlets
to a JAR
> file in the $CATALINA_HOME/lib directory, or under WEB-INF/classes) to see if that works.
 If it
> works here but not with your modifications, then we need to isolate why not.
> 
> >
> > thanks,
> >
> > eddie
> >
> 
> Craig McClanahan
> 
> > On Wed, 21 Feb 2001, Craig R. McClanahan wrote:
> > > eddie tsai wrote:
> > >
> > > > i am using tomcat 4.0 milestone 5. suggestion on which version i should
> > > > get?
> > > >
> > >
> > > Tomcat 4.0-beta-1 is more recent than milestone 5, and should have this problem
fixed.  You
> > > can also try one of the recent nightly distributions, or wait for the upcoming
beta-2 release
> > > (which will be substantially similar to the current nightly builds) as well.
> > >
> > > Craig
> > >
> > > > On Wed, 21 Feb 2001, Craig R. McClanahan wrote:
> > > > > eddie tsai wrote:
> > > > >
> > > > > > hi,
> > > > > >
> > > > > > i am upgrading from tomcat3.2 to tomcat4.0. the same servlets
that
> > > > > > worked with tomcat3.2 don't work with tomcat4.0 anymore. specifically,
> > > > > > it tells me that my servlets aren't servlets. the root cause
was that it
> > > > > > had problem while casting. my servlet extends GenericServlet.
my
> > > > > > servlets are located in a different directory (not in the classes
> > > > > > directory), would that cause the problem? it looks like it could
find
> > > > > > the servlet but could not accept it as a servlet.
> > > > > >
> > > > > > did anyone encounter that problem when upgrading? how did you
solve it?
> > > > > >
> > > > >
> > > > > Which build of Tomcat 4.0 are you trying this with.  There were problems
similar to this
> > > > > prior to 4.0-beta-1 but they have been fixed in recent nightly builds.
> > > > >
> > > > > Craig McClanahan
> > > > >


Mime
View raw message