JSF 1.2 app not working with GlassFish v3

与世无争的帅哥 提交于 2019-12-08 11:50:29

问题


Migrating to GlassFish v3 / JDK6u18 / NB6.8 makes me a lot of headscratching, and I'm quite confused now. My project (JSF, RichFaces, Spring) works fine with GlassFish v2 + JDK6u17. I'm using the same JAR's, and the same JSF version.

One of my JSP's contains a <rich:tree>, this renders just fine, but if I post the values on this page I get:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.IllegalArgumentException: In AbstractTreeDataModel rowIndex must be -1.
        at org.richfaces.model.AbstractTreeDataModel.setRowIndex(AbstractTreeDataModel.java:52)
        at org.ajax4jsf.component.UIDataAdaptor.setRowIndex(UIDataAdaptor.java:289)
        at javax.faces.component.UIData.visitColumnsAndRows(UIData.java:1544)
        at javax.faces.component.UIData.visitTree(UIData.java:1212)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
        at javax.faces.component.UIForm.visitTree(UIForm.java:333)
        at javax.faces.component.UIComponent.visitTree(UIComponent.java:1457)
        at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:869)
        at org.ajax4jsf.application.AjaxStateManager.restoreView(AjaxStateManager.java:439)
        ....

On my other page, something similar is happening. It contains a <h:selectManyCheckbox>, which rerenders some other stuff in case of a value-change. So in case of a submit I get something like this:

WARNING: StandardWrapperValve[Faces Servlet]: PWC1406: Servlet.service() for servlet Faces Servlet threw exception
java.lang.NullPointerException
        at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:564)
        at org.ajax4jsf.component.EventValueExpression.getComponent(EventValueExpression.java:77)
        at org.ajax4jsf.component.EventValueExpression.getValue(EventValueExpression.java:130)
        at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2166)
        at com.sun.faces.renderkit.RenderKitUtils.renderPassThruAttributesOptimized(RenderKitUtils.java:608)
        at com.sun.faces.renderkit.RenderKitUtils.renderPassThruAttributes(RenderKitUtils.java:321)
        at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.renderOption(SelectManyCheckboxListRenderer.java:328)
        at com.sun.faces.renderkit.html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:177)
        at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
        ....

I've tried to combine versions of JSF/RichFaces, but it just resulted all the same.

Any help would be appreciated!


回答1:


Glassfish v3 has JSF 2.0 bundled, so that might be causing troubles. If you want to use JSF 1.2 with Glassfish v3 you have to add a sun-web.xml in the WEB-INF folder:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish
Application Server 3.0 Servlet 3.0//EN"
"http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app>
    <class-loader delegate="false"/>
    <property name="useBundledJsf" value="true"/>
</sun-web-app>



回答2:


Exceptiion Trace :-
On thread: 'WebContainer : 0'
com.ibm.websphere.servlet.error.ServletErrorReport: java.lang.NoSuchMethodError: javax/faces/component/UIViewRoot.getComponentResources&#40;Ljavax/faces/context/FacesContext&#59;Ljava/lang/String&#59;&#41;Ljava/util/List&#59;
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1764)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1597)
    at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:131)

I have use the following dependency

commons-codec-1.3.jar
commons-httpclient-3.1.jar
cssparser-0.9.5.jar
guava-r07.jar
jsf-api-2.0.6-FCS.jar
jsf-impl-2.0.6-FCS.jar
jsr250-api-1.0.jar
richfaces-components-api-4.2.0.Final.jar
richfaces-components-ui-4.2.0.Final.jar
richfaces-core-api-4.2.0.Final.jar
richfaces-core-impl-4.2.0.Final.jar
sac-1.3.jar

Solution : if you using WebSphere 7.0 application server you have change the follwing setting

1)start the WebSphere 7.0 2)run as adminstartor 3)server-->websphere application servers-->server1--(open our application EAR file)

4) classloader policy drop down change to "mutiple"

5)class loading mode drop down chnage to "class loaded with local class loader first (parent last)

it will start the application



来源:https://stackoverflow.com/questions/2333330/jsf-1-2-app-not-working-with-glassfish-v3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!