solaris系统下用的glassfish服务器启动后 异常如下:[#|2009-01-20T12:38:13.246+0800|WARNING|sun-appserver9.1|org.apache.coyote.tomcat5.CoyoteRequest|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=5ed4cd41-cab5-462d-ad34-6a27d72b5841;|PWC4011: Unable to set request character encoding to GBK from context /KFCK, because request parameters have already been read, or ServletRequest.getReader() has already been called|#][#|2009-01-20T12:38:16.270+0800|WARNING|sun-appserver9.1|org.apache.coyote.tomcat5.CoyoteRequest|_ThreadID=20;_ThreadName=httpSSLWorkerThread-8080-3;_RequestID=3c9b9fcf-f3f6-48be-ba9f-68009126ff06;|PWC4011: Unable to set request character encoding to UTF-8 from context /KFCK, because request parameters have already been read, or ServletRequest.getReader() has already been called|#]
==========================我的JSP页面头部都是采用UTF-8编码 <%@ page contentType="text/html; charset=UTF-8"%>
哪位高人帮忙看一下 多谢多谢
==========================我的JSP页面头部都是采用UTF-8编码 <%@ page contentType="text/html; charset=UTF-8"%>
哪位高人帮忙看一下 多谢多谢
This warning message means that the web container is complaining about the fact that the web application deployed at /your_webapp is trying to set the request encoding too late in the request's lifecycle, when it is impossible for the container to honor it.See the javadocs of javax.servlet.ServletRequest.setCharacterEncoding():
This method must be called prior to reading request parameters or reading input using getReader(). Otherwise, it has no effect.The container issues a warning to let you know that a call to ServletRequest.setCharacterEncoding() by your_webapp has no effect and is being ignored, because one of the above conditions is met. To avoid this warning, your_webapp should move its invocation of ServletRequest.setCharacterEncoding() to an earlier stage, before it acquires any input reader from the request, or before it reads any request parameters. In case your_webapp is not responsible for this warning, one if its dependencies might be, in which case that library needs to be fixed.
"是说没有任何影响,我的工程里面的JSP都是先设置的charset=UTF-8,应该没有问题,可能是引用JAR包里面的问题?"
日志有点受不了,server.log里面 花花的刷涨记录.
这个方法必须在读取request parameter或使用getReader()前调用。否则,不会有任何作用。 容器发出警告,让您知道,Web应用程序调用setCharacterEncoding()没有任何作用,并正在被忽视,因为上面的条件满足。 为了避免这种警告, Web应用程序应该较早较早调用的阶段setCharacterEncoding()。如果setCharacterEncoding()不是你自己的程序调用的,那有可能是classpath里的jar包调用的。
以上是在google翻译的基础撒谎能够改的,总之是没有影响的,但是要去除这个warning的话,就要修改setCharacterEncoding()的调用位置。