How to enable debug_mode for a JSP page

tardate picture tardate · Mar 14, 2009 · Viewed 14.8k times · Source

when you hit a serious compilation error while writing JSP pages and running under Oracle OC4J or Application Server, you can end up with the following displayed on screen:

500 Internal Server Error OracleJSP: An error occurred. Consult your application/system administrator for support. Programmers should consider setting the init-param debug_mode to "true" to see the complete exception message.

I've seen varying advice on how/where to set the debug_mode init-param. What are the options?

Also, is this specific to Oracle, or is this a JSP standard feature? How would the technique be different for other application servers?

Answer

tardate picture tardate · Apr 8, 2009

Solution so far...

Option 1: add the debug_mode parameter to the OC4J global-web-application.xml

  • the setting will apply to all applications in the OC4J container
  • See the response from @Mork0075 for details (except note that the OC4J container name and application names are specific to an example of enabling debug for Oracle's Secure Enterprise Search)

Option 2: add to your application's web.xml

  • Obviously, allows for a more local change
  • There are additional settings (developer_mode,encode_to_java,emit_debuginfo) which may be of use also

For example:

<servlet>
<servlet-name>jsp</servlet-name>
<servlet-class>oracle.jsp.runtimev2.JspServlet</servlet-class>
<init-param>
    <param-name>debug_mode</param-name>
    <param-value>true</param-value>
</init-param>
<init-param>
    <param-name>developer_mode</param-name>
    <param-value>true</param-value>
</init-param>
<init-param>
    <param-name>encode_to_java</param-name>
    <param-value>true</param-value>
</init-param>
<init-param>
    <param-name>emit_debuginfo</param-name>
    <param-value>true</param-value>
</init-param>
</servlet> 

Since these options are being set for the class oracle.jsp.runtimev2.JspServlet, it is obviously specific for Oracle OC4J/Application Server installations.