Wednesday, September 21, 2011

Get the generated source code for JSPs in WebLogic

generated JSP java class source Oracle WebLogic line numbers

Given a stack trace such as the following:
 at jsp_servlet._web_45_inf._jsp._demo.__example._jspService(
 at weblogic.servlet.jsp.JspBase.service(
 at weblogic.servlet.internal.StubSecurityHelper$
 at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(
 at weblogic.servlet.internal.ServletStubImpl.execute(
 at weblogic.servlet.internal.ServletStubImpl.onAddToMapException(
 at weblogic.servlet.internal.ServletStubImpl.execute(
 at weblogic.servlet.internal.ServletStubImpl.execute(
 at weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet(
 at weblogic.servlet.internal.RequestDispatcherImpl.forward(

It won't always be obvious what the issue in example.jsp corresponds to in the generated How do you get at the generated source code for the JSPs?

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"?>