glassfish里抛出如下错误:
org.apache.jasper.JasperException: PWC6033: Unable to compile class for JSP
PWC6199: Generated servlet error:
string:///XXXX_jsp.java:169: constant string too long
PWC6199: Generated servlet error:
Note: string:///XXXX_jsp.java from uses unchecked or unsafe operations.
折腾了好久,始终找不到原因。
最后,经老大指点,并实际测试。终于发现原因
是由于glassfish里 把genStrAsCharArray 项设为 true 导致的。
解决办法:
具体为:
把 $GLASSFISH_HOME/domains/domain1/config/default-web.xml 里的
<param-name>genStrAsCharArray</param-name><param-value>true</param-value>
修改为:
<param-name>genStrAsCharArray</param-name><param-value>false</param-value>
genStrAsCharArray
|
false
|
If
set to true, generates text strings as char arrays, which
improves performance in some cases.
|
The default-web.xml file defines features such as filters and security constraints that apply to all web applications. The parameter, development=true, (the default value for developer profile) enables changes made to JSPTM – code to be instantly visible to the clients. However, there is a cost associated with this. To avoid the cost of checking whether the JSP code has been modified and hence its recompilation, the first parameter, development=false, can be used to set development to false since this scenario is unlikely in a production system. This check affects application scalability when multiple users request the same JSP class. The second parameter, genStrAsCharArray=true, changes the way the JSPs are generated by generating char arrays for every static strings in the JSP class like for example, the HTML tags. By default, the JSPcode writer must call the toCharArray() on every String on every invocation of the JSPclass.
Settings in default-web.xml. ($GLASSFISH_HOME/domains/domain1/config/default-web.xml)<init-param><param-name>development</param-name><param-value>false</param-value></init-param><init-param><param-name>genStrAsCharArray</param-name><param-value>true</param-value>
#-> 此处上面应该修改为false
</init-param>
The more configuration optimization can be done using the document from SUN you can download it
参考网址:
http://docs.oracle.com/cd/E19879-01/820-4343/abedw/index.html
http://www.binbert.com/blog/2010/04/glassfish-performance-tunning/
作者: 乐意黎,原创。禁止转载
原文地址: http://blog.csdn.net/aerchi/article/details/45394231
时间: 2024-09-29 16:08:56