我已经完成了从 Tomcat 到 Glassfish 的迁移,现在我的 ajax 请求不起作用。我读了这篇文章,我更改了诸如那里的设置 glassfish-web.xml 文件,但没有帮助。我将 JSF 2 与 OpenFaces 一起使用。
<o:selectBooleanCheckbox id="addTitleC" value="#{ajaxBean.editTitle}">
<o:ajax event="click" render=":form:titleText" />
</o:selectBooleanCheckbox>
AjaxBean 源码:
public void setEditTitle(boolean editTitle) {
this.editTitle = editTitle;
}
public boolean isEditTitle() {
return editTitle;
}
除了更改文件设置 glassfish-web.xml 我什么都没改变,一切都在 Tomcat 中工作。
编辑:这是我从 Glassfish 得到的:
<partial-response>
<error>
<error-name>class java.lang.IllegalStateException</error-name>
<error-message>org.openfaces.component.ajax.AjaxHelper</error-message>
</error>
<changes>
<extension ln="openfaces" ajaxResult="null" type="ajaxResult"></extension>
</changes>
</partial-response>
Glassfish 堆栈跟踪:
java.lang.InstantiationException: org.openfaces.component.ajax.AjaxHelper
at java.lang.Class.newInstance0(Class.java:357)
at java.lang.Class.newInstance(Class.java:325)
at javax.faces.component.StateHolderSaver.restore(StateHolderSaver.java:150)
at javax.faces.component.UIComponentBase.restoreAttachedState(UIComponentBase.java:1785)
at javax.faces.component.UIComponentBase.restoreBehaviorsState(UIComponentBase.java:2136)
at javax.faces.component.UIComponentBase.restoreState(UIComponentBase.java:1571)
at javax.faces.component.UIOutput.restoreState(UIOutput.java:256)
at javax.faces.component.UIInput.restoreState(UIInput.java:1404)
at org.openfaces.component.OUIInputBase.restoreState(OUIInputBase.java:274)
at org.openfaces.component.select.SelectBooleanCheckbox.restoreState(SelectBooleanCheckbox.java:348)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1336)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1351)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1351)
at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1351)
at javax.faces.component.UIViewRoot.processRestoreState(UIViewRoot.java:879)
at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:208)
at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:453)
at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:148)
at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1550)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:860)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:757)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1056)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:229)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:722)