JSPs troubleshooting tips
Use this tips to troubleshoot problems with JSPs.
JSPs source code shown by the Web server
If we share the document root of the WAS with the Web server document root, a security exposure can result as the Web server might display the JSPs source file as plain text.
Problem
You can use the WebSphere Web server plug-in set of rules to determine whether a given request will be handled by the WAS. When an incoming request fails to match those rules, the Web server plug-in returns control to the Web server so that the Web server can fulfill the request. In this case, the unknown host header causes the Web server plug-in to return control to the Web server because the rules do not indicate that the WAS should handle it. Therefore, the Web server looks for the request in the Web server document root. Since the JSP source file is stored in the document root of the Web server, the Web server finds the file and displays it as plain text.
Suggested solution
Move the WAS JSP source file outside of the Web server document root. Then, when this request comes in with the unknown host header, the plug-in returns control to the Web server and the JSP source file is not found in the document root. Therefore, the Web server returns a 404 File Not Found error rather than the JSP source file.
Problems displaying double-byte character set (DBCS) characters when using the @include directive
JSPs that use the @include directive might experience problems when displaying double-byte character set (DBCS) characters. Some applications that are migrated to WAS V6.0 and above might need to be modified to comply with the JSP 2.0 spec as a result of backwards compatibility issues. The JSP 2.0 spec requires that each statically included resource must set a page encoding or content type because the character encoding for each file is determined separately, even if one file includes another using the include directive.
Problems using the JSPs engine
If we are having difficulty using the JSPs engine, try these steps:
- Determine whether other resources such as .html files or servlets are being requested and displayed correctly. If they are not, the problem probably lies at a deeper level, such as with the HTTP server.
- If other resources are being displayed correctly, determine whether the JSP processor has started normally:
- Browse the JVM logs of the server hosting the JSPs we are trying to access.
The following messages indicate that the JSP processor has started normally:
Extension Processor [class com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor] was initialized successfully. Extension Processor [class com.ibm.ws.jsp.webcontainerext.JSPExtensionProcessor] has been associated with patterns [*.jsp *.jspx *.jsw *.jsv ].If the JSP processor fails to load, you will see a message such as
No Extension Processor found for handling JSPs. JSP Processor not defined. Skipping : jspfilename.in the root_dir/logs/myserver/SystemOut.log file
- If the JSP engine has started normally, the problem may be with the JSP file itself.
- The JSP may have invalid JSP syntax and could not be processed by the JSP Processor. Examine the root_dir/logs/myserver/SystemOut.log file of the target application for invalid JSP directive syntax messages. Errors similar to the following in a browser indicate this kind of problem:
Message: /filename.jsp(2,1)JSPG0076E: Missing required attribute page for jsp element jsp:includeThis example indicates that line 2, column 1 of the named JSPs file is missing a mandatory attribute for the jsp:include action. Similar messages are displayed for other syntax errors.
- Examine the target appserver's SystemErr.log files for problems with invalid Java syntax. Errors similar to Message: Unable to compile class for JSP in a browser indicate this kind of problem. The error message output from the Java c compiler will be found in the SystemErr.log. It might look like:
JSPG0091E: An error occurred at line: 2 in the file: /myJsp.jsp JSPG0093E: Generated servlet error: c:\WASROOT\temp\ ... test.war\_myJsp.java:16: myInt is already defined in com.ibm.ws.jsp20._myJsp int myInt = 122; String myString = "number is 122"; static int myStaticInt=22; int myInt=121; ^ 1 errorCorrect the error in the JSP file and retry the file.
- Examine the target appserver's server log files files for problems with invalid Java syntax. Errors similar to Message: Unable to compile class for JSP in a browser indicate this kind of problem. The error message output from the Java c compiler will be found in the SystemErr.log. It might look like:
JSPG0091E: An error occurred at line: 2 in the file: /myJsp.jsp JSPG0093E: Generated servlet error: c:\WASROOT\temp\ ... test.war\_myJsp.java:16: myInt is already defined in com.ibm.ws.jsp20._myJsp int myInt = 122; String myString = "number is 122"; static int myStaticInt=22; int myInt=121; ^ 1 errorCorrect the error in the JSP file and retry the file.
Java Server Pages fail to compile when using precompile
Symptom JSPs fail to compile during deployment through the admin console when precompile is selected. SystemErr R com.ibm.websphere.management.exception.AdminException: ADMA0021E: Error in compiling jsps - abc.war (rc=1)Problem JSPs fail to compile during deployment through the admin console when precompile is selected when there is a dependency on another JAR file not available on any class path. Suggested solution You may use wsadmin scripting to precompile JSPs during enterprise application deployment. However to use the admin console, then compile all JSPs before packaging the application.
- Add the dependent JAR to the deployment manager in a cell environment.
- Click System Administration > Deployment manager > Java and Process Management > Process Definition > Java Virtual Machine in the console navigation.
- Add fully qualified dependent JAR in class path field.
- Click OK.
- Restart dmgr.
JSPG0089E: Mismatch found between page directive encoding Shift_JIS and xml prolog encoding UTF-8
Symptom The following error appears:
JSP Processing ErrorHTTP Error Code: 500
Error Message: /test.jsp(2,1) /test.jsp(2,1) JSPG0089E: Mismatch found between page directive encoding Shift_JIS and xml prolog encoding UTF-8
Problem The pageEncoding attribute in the jsp:directive.page element is not UTF-8. Suggested solution JSPs must specify a prolog that matches the encoding specified in the page directive. For example, <?xml version="1.0" encoding="Shift_JIS"?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"> <jsp:directive.page language="java" contentType="text/html"; charset=Shift_JIS" pageEncoding="Shift_JIS"/> <jsp:text>XXXXXjsp:text>XXXXX> </jsp:root>For additional information, see section JSP.4.1, Page Character Encoding, in the JSPs spec and section 4.3.3 and appendix F.1 of the XML spec
If none of these steps solves the problem, check to see if the problem is identified and documented using the links in Diagnose and fix problems: Links. If we do not see a problem that resembles thes, or if the information provided does not solve the problem, contact IBM support for further assistance.
For current information available from IBM Support on known problems and their resolution, see the IBM Support page. The IBM Support page contains documents that can save you time gathering information needed to resolve this problem.
 
Related concepts
Web apps
Related tasks
Set JSP engine parameters 
Related information
IBM Support page