My Oracle Support Banner

WLS All - Servlet is receiving a NullPointerException (Doc ID 766960.1)

Last updated on SEPTEMBER 09, 2021

Applies to:

Oracle WebLogic Server - Version 6.1 and later
Information in this document applies to any platform.
Information in this document applies to any platform


Goal

The problem is encountered when running a servlet.  The servlet will run fine until a null pointer exception is thrown.
 The servlet is taking parameters from the weblogic.properties file via the ServletConfig object.

When the servlet fails the following error is given:

<ServletContext-General> Servlet failed with Exception
java.lang.NullPointerException:
 at javax.servlet.GenericServlet.getServletContext(GenericServlet.java:205)
 at javax.servlet.GenericServlet.log(GenericServlet.java:300)
 at javax.servlet.GenericServlet.destroy(GenericServlet.java:122)
 at weblogic.servlet.internal.ServletStubImpl.destroyServlet(ServletStubImpl.java:305)
 at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:411)
 at weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:332)
 at weblogic.servlet.internal.ServletStubImpl.getServlet(ServletStubImpl.java:185)
 at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:118)
 at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:761)
 at weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:708)
 at weblogic.servlet.internal.ServletContextManager.invokeServlet(ServletContextManager.java:252)
 at weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:346)
 at weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:246)
 at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:135)

Solution

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Goal
Solution

My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.