I am having a puzzling problem:
In tomcat 3.2.1 on Windows NT as a service, using JDK 1.2.1 I am getting a
NullPointerException during the initialization of my servlet.
Here is the stack trace:
2001-01-11 02:39:49 - Ctx( ): Exception in: R( + /servlet/FQServletName +
null) - java.lang.NullPointerException:
at
javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
at javax.servlet.GenericServlet.log(GenericServlet.java:300)
at javax.servlet.GenericServlet.init(GenericServlet.java:257)
at
org.apache.tomcat.core.ServletWrapper.doInit(ServletWrapper.java:317)
at org.apache.tomcat.core.Handler.init(Handler.java:215)
at
org.apache.tomcat.core.ServletWrapper.init(ServletWrapper.java:296)
at org.apache.tomcat.core.Handler.service(Handler.java:254)
at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:210)
at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java,
Compiled Code)
at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java,
Compiled Code)
at java.lang.Thread.run(Thread.java:479)
Investigating the cause, it seems that the
return getServletConfig().getServletContext();
at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
is getting a null from getServletConfig(),
but this method in javax.servlet.GenericServlet simply returns the
ServletConfig object that javax.servlet.GenericServlet.init(config) had
stored in the class variable just before calling log().
Other servlets (which do not have overriden init() methods) and JSP files
work fine in the ROOT and examples contexts provided in the default
installation. I have just upgraded my development environment from the
JWSDK, and this servlet worked fine in that server, and is running fine on
the ServletExec server where it is deployed.
Considering that the exception is occuring before the init() of my code is
being called, I am suspecting a configuration problem.
Here are the classpath lines from the wrapper.properties file:
wrapper.tomcat_home=D:\java\jakarta-tomcat-3.2.1\
wrapper.java_home=D:\java\jdk1.2.2\jre
wrapper.class_path=$(wrapper.tomcat_home)\classes
wrapper.class_path=$(wrapper.tomcat_home)\lib\jaxp.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\parser.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\webserver.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\servlet.jar
wrapper.class_path=$(wrapper.tomcat_home)\lib\jasper.jar
wrapper.class_path=$(wrapper.java_home)\..\lib\tools.jar
I know this is a lot of data, but I am pulling out my hair on this one and
am getting nowhere. Has anyone seen this before? Are there other
configuration details that I should look at?
Thanks very much,
Chris
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html