cancel
Showing results for 
Search instead for 
Did you mean: 

NullPointerException in Servlet

Former Member
0 Kudos

Hello,

I'm migrating another web-application from tomcat 5 to SAP WAS 6.40. This time the application uses the JSF Framework with the Oracle ADF Components. These Components uses an own servlet to dynamically create resources like images, css or javascript files.

While requesting a javascript file from this servlet, I get an NullPointerException. Heres the stack:

[code]

java.lang.NullPointerException

at com.sap.engine.services.servlets_jsp.server.runtime.client.HttpServletResponseFacade.setContentType(HttpServletResponseFacade.java:1130)

at oracle.adf.view.faces.webapp.ResourceServlet._setHeaders(ResourceServlet.java:393)

at oracle.adf.view.faces.webapp.ResourceServlet.doGet(ResourceServlet.java:178)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:748)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at oracle.adf.view.faces.webapp.ResourceServlet.service(ResourceServlet.java:135)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:391)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:265)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:345)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:323)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:865)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:240)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)

at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)

[/code]

Requesting images or css files works fine. Only the javascript file produces the exception.

I'm not sure if the WAS or the framework triggers the exception.

Has anybody an idea why the method setContentType throws the exception?

thanks a lot, Daniel

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi

Can you please check with the Oracle ADF Component,seems some problem there .. Also tomcat 5 is j2ee1.4 (servlet 2.4) while sap web as is j2ee 1.3 complaint(servlet 2.3).

Hope this helps , please mark helpful answer s.

regards

rajeshkr

Former Member
0 Kudos

Hi Rajeshkr,

the application was designed for J2EE 1.3 and servlet 2.3.

For testing, I deployed the application to a Tomcat 4.1, which is like the WAS only J2EE 1.3 and servlet 2.3 compatible. On this system the application works fine. No exception is thrown while requesting the .js file.

Any other idea?

Former Member
0 Kudos

Hello,

I found the reason!

The Exception was thrown because the WAS don't know the mimetype 'text/javascript' and the method getMimeType of the ServletContext returns a null.

After defining the mimetype in the web.xml of the application everything works fine.

Daniel

Former Member
0 Kudos

Congrats Daniel,

I was just wondering, did u add the ADF Runtime libraries as a 'Server Component' using the Deploy Tool. What is this Server Component library? Is this a tag for a set of libraries added to the server classpath? Do you have to restart the server after adding the Server Component?

Greetz,

nD

Answers (0)