You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Randall Parker <ra...@nls.net> on 2000/02/23 00:09:17 UTC
ClassCastException on Tomcat initialization
I am running Tomcat v3 on VAJ EE v3. Initially I was able to get Tomcat up and running. But I had ClassCastExceptions in ServletWrapper.loadServlet() when I tried to load one of my own servlets. This
made no sense since the cast that it was failing on was for
servlet = (Servlet)servletClass.newInstance();
but the class it was loading was declared as:
public class UserLoginMgr extends javax.servlet.http.HttpServlet
So the cast back to Servlet ought to be possible.
So I tried adding more projects to the classpath for StartTomcat. Then I started getting ClassCastExceptions when Tomcat was first initializing. The first class that it tried to load in
ServletWrapper.loadServlet() generated a ClassCastException. This was org.apache.tomcat.core.DefaultServlet.
So then I tried to eliminate from StartTomcat's path all the projects that I'd previously added. After doing so I still keep getting ClassCastException in org.apache.tomcat.core.DefaultServlet on Tomcat
initialization. So I can't run Tomcat at all.
Oh, and it is loading the servletClass without an exception by using the previous executable line of:
servletClass = container.getLoader().loadServlet(this,servletClassName);
Anyone have any clues as to why this is happening? Would it help to move up to a later Tomcat build?
Re: ClassCastException on Tomcat initialization
Posted by co...@eng.sun.com.
> I am running Tomcat v3 on VAJ EE v3. Initially I was able to get Tomcat up and running. But I had ClassCastExceptions in ServletWrapper.loadServlet() when I tried to load one of my own servlets. This
> made no sense since the cast that it was failing on was for
> servlet = (Servlet)servletClass.newInstance();
> but the class it was loading was declared as:
> public class UserLoginMgr extends javax.servlet.http.HttpServlet
Seems like a VAJ problem, try to delete the project and start again.
( if I remember VAJ does "import" the projects, you may have something
in the repository )
Make sure VAJ doesn't have any servlet.jar or servlet API - it may be an
older version of the servlet API.
Costin