如何处理PWC6199: Generated servlet error异常
1、常见问题1:
PWC1412: WebModule[null] ServletContext.log():PWC6033: Error in Javac compilation
for JSP
PWC6199: Generated servlet error:
string:///testedu_jsp.java:16116: try 语句的代码过长
PWC6199: Generated servlet error:
string:///testedu_jsp.java:58: try 语句的代码过长
PWC6199: Generated servlet error:
string:///testedu_jsp.java:46: 代码过长
问题分析:该现象一般是jsp页面代码过多,导致jsp编译后生成的Java类文件的大小过大,Java类文件不允许超过65k ,以上报错的原因为Java类文件的大小超过了65k 有500k的大小
解决方法:在应用服务器里配置相关参数解除限制:
tommcat配置文件:conf目录下,web.xml
glassfish配置文件:config目录下,default-web.xml
添加参数:
<init-param>
<param-name>mappedfile</param-name>
<param-value>false</param-value>
</init-param>
需要注意的是在JSP页面代码过大的时候尝试拆分JSP文件,使用<jsp:include page="test.jsp"/>引用jsp而不是< %@include file="test.jsp" % >

2、常见问题2:
PWC1412: WebModule[null] ServletContext.log():PWC6033: Error in Javac compilation for JSP
PWC6197: An error occurred at line: 13 in the jsp file: /tian/test/nt/sunt.jsp
PWC6199: Generated servlet error:
string:///Ktuiyio_jsp.java:263: 找不到符号
符号: 类 Map
位置: 类 org.apache.jsp.hel.tian.mumu.ct.Ktuiyio_jsp
问题分析:分析为jsp页面没有添加引用Map类的代码导致。
解决方法:在页面引入Map类<%@ page import="java.util.Map"%>
3、常见问题3:
PWC1412: WebModule[null] ServletContext.log():PWC6033: Error in Javac compilation
for JSP
PWC6197: An error occurred at line: 30 in the jsp file: //mite/misfit/testwahaha.jsp
PWC6199: Generated servlet error:
string:///testwahaha_jsp.java:208: 未结束的字符串字面值
PWC6197: An error occurred at line: 30 in the jsp file: /mite/misfit/testwahaha.jsp
PWC6199: Generated servlet error:
string:///testwahaha_jsp.java:297: 未结束的字符串字面值
PWC6197: An error occurred at line: 30 in the jsp file: /mite/misfit/testwahaha.jsp
PWC6199: Generated servlet error:
string:///testwahaha_jsp.java:297: 需要 ')'
PWC6197: An error occurred at line: 30 in the jsp file: /mite/misfit/testwahaha.jsp
问题分析:经分析查看编译生成后的Java类文件testwahaha_jsp.java:第297行有中文乱码生成,得出为乱码导致编译异常
解决方法:修改JSP页面,导致乱码的代码片段

4、常见问题4:
PWC1406: Servlet.service() for servlet action threw exception
org.apache.jasper.JasperException: PWC6033: Error in Javac compilation for JSP
PWC6199: Generated servlet error:
string:///lantian_jsp.java:2578: 找不到符号
符号: 变量 fita
位置: 类 org.apache.jsp.ll.twmer.test.lantian_jsp
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:129)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:299)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:392)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:625)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:473)
问题分析:通过排查lantian_jsp文件发现页面里定义了两个同名的变量fita对应页面相关代码是:<bean:define id = "fita" value ="0" type="java.lang.String"/>但是作用在不同的域里,同时生成的编译后的Java文件里的fita的第二个变量的值为空了,在不同的应用服务器下编译的结果不同,和应用服务器的编译解析机制有关,weblogic正常,其他web应用服务器好像都有该现象
解决方法:jsp页面不要定义相同的变量名称fita
