generated JSP java class source Oracle WebLogic line numbers
Problem:
Given a stack trace such as the following:
java.lang.NullPointerException at jsp_servlet._web_45_inf._jsp._demo.__example._jspService(__example.java:117) at weblogic.servlet.jsp.JspBase.service(JspBase.java:34) at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227) at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300) at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(ServletStubImpl.java:416) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:326) at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:183) at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(RequestDispatcherImpl.java:526) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:253)
It won't always be obvious what the issue in
example.jsp
corresponds to in the generated __example.java
. How do you get at the generated source code for the JSPs?Solution:
The solution involves configuring a
[app_name]/WEB-INF/weblogic.xml
file in your web-app. The documentation is in the WebLogic 10.3 docs - see weblogic.xml Deployment Descriptor Elements but keep in mind the file will be validated against the schema so the elements must be in the correct spot.Below is an example - defining the
jsp-descriptor
with keepgenerated
and working-dir
elements:<?xml version="1.0" encoding="UTF-8"?> <weblogic-web-app xmlns="http://www.bea.com/ns/weblogic/90" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/ns/weblogic/90 http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd"> <jsp-descriptor> <keepgenerated>true</keepgenerated> <working-dir>c:/my_folder/temp</working-dir> </jsp-descriptor> <container-descriptor> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> </weblogic-web-app>