开发者

ending conversation scoped bean and then redirect when command button clicked

开发者 https://www.devze.com 2023-02-14 18:20 出处:网络
I have a simple command button <h:commandButton value=\"Create Form Event\" action=\"#{formEventController.createFormEvent}\"/>

I have a simple command button

<h:commandButton value="Create Form Event" action="#{formEventController.createFormEvent}"/>

which calls the following simple action listener

@Named
@ConversationScoped
public class FormEventController implements Serializable
{
    @Inject
    private Conversation conversation;

    ...

    public String createFormEvent()
    {
        conversation.end();
        return "events?id=" + form.getId() + "&faces-redirect=true";
    }
}

so basically I want a button that when clicked will end a conversation, and then redirect to a new page...

this works ONCE, then every time after I see the following in my logs.. (from the users point of view, everything worked properly.. when the button is clicked, the redirect works properly)

SEVERE: java.util.ConcurrentModificationException at java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) at java.util.HashMap$EntryIterator.next(HashMap.java:834) at java.util.HashMap$EntryIterator.next(HashMap.java:832) at org.jboss.weld.context.AbstractConversationContext.deactivate(AbstractConversationContext.java:250) at org.jboss.weld.jsf.WeldPhaseListener.deactivateConversations(WeldPhaseListener.java:131) at org.jboss.weld.jsf.WeldPhaseListener.afterPhase(WeldPhaseListener.java:96) at com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189) at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107) at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) at javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) at net.balusc.http.multipart.MultipartFilter.doFilter(MultipartFilter.java:78) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) 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 com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 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.开发者_JAVA百科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:662)

SEVERE: WebModule[]PWC1322: Error invoking requestDestroyed method on ServletRequestListener org.jboss.weld.servlet.WeldListener java.lang.IllegalStateException: Context is not active at org.jboss.weld.context.AbstractConversationContext.deactivate(AbstractConversationContext.java:263) at org.jboss.weld.servlet.WeldListener.requestDestroyed(WeldListener.java:125) at org.apache.catalina.core.StandardContext.fireRequestDestroyedEvent(StandardContext.java:4588) at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:243) at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170) at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 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:662)


this issue has been resolved in latest version of weld, see related bug report

https://issues.jboss.org/browse/WELD-833

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号