我的Java EE Web应用程序工作正常与Glassfish的2.1。 现在我想迁移到GlassFish 3.1.1,但战争文件的成功部署后,它提供了以下错误:
WARNING: ApplicationDispatcher[/Myapp] PWC1231: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalStateException: Illegal attempt to set ViewHandler after a response has been rendered.
我的应用程序使用以下框架。
- Spring框架3.0.2
- JSF 2.0
- RichFaces的3.3.3决赛
它就是被编译成JDK 1.6。
这个问题是怎么造成的,我该如何解决呢?
编辑
我已经按照提供的修改在这里
我对RichFaces的依赖关系如下: -
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-api</artifactId>
<version>3.3.3.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.framework</groupId>
<artifactId>richfaces-impl-jsf2</artifactId>
<version>3.3.3.Final</version>
</dependency>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-ui</artifactId>
<version>3.3.3.Final</version>
</dependency>
我的JSF依赖关系
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.0.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.0.2</version>
</dependency>
添加上下文PARAM在web.xml如下: -
<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>
<context-param>
<param-name>javax.faces.DISABLE_FACELET_JSF_VIEWHANDLER</param-name>
<param-value>true</param-value>
</context-param>
修改了应用程序描述符的2.5版本,如:
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
我的 在faces-配置情况如下: -
<application>
<navigation-handler >
org.navigation.CustomNavigationHandler
</navigation-handler>
<view-handler>
org.ajax4jsf.application.AjaxViewHandler
</view-handler>
<!-- <view-handler>
com.sun.facelets.FaceletViewHandler
</view-handler>-->
<variable-resolver>org.springframework.web.jsf.DelegatingVariableResolver</variable-resolver>
<message-bundle>MyMessages</message-bundle>
</application>
申请得到成功部署但在那之后我在当时获得类转换异常的错误开始在浏览器的应用程序:
服务器日志如下:
INFO: myApp was successfully deployed in 21,635 milliseconds.
SEVERE: Error Rendering View[/login.xhtml]
javax.faces.FacesException: java.lang.ClassCastException: java.lang.String cannot be cast to javax.faces.component.UIComponent
at com.sun.faces.application.ApplicationImpl.createComponentApplyAnnotations(ApplicationImpl.java:1923)
我怎样才能解决这个?