结束对话作用域 bean,然后在单击命令按钮时重定向

发布于 2024-10-20 12:08:52 字数 6223 浏览 7 评论 0原文

我有一个简单的命令按钮

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

,它调用以下简单的操作侦听器

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

    ...

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

,所以基本上我想要一个按钮,单击该按钮将结束对话,然后重定向到新页面...

这有效一次,然后每次在我看到以下内容后我的日志..(从用户的角度来看,一切正常..单击按钮时,重定向正常工作)

严重: java.util.ConcurrentModificationException 在 java.util.HashMap$HashIterator.nextEntry(HashMap.java:793) 在 java.util.HashMap$EntryIterator.next(HashMap.java:834) 在 java.util.HashMap$EntryIterator.next(HashMap.java:832) 在 org.jboss.weld.context.AbstractConversationContext.deactivate(AbstractConversationContext.java:250) 在 org.jboss.weld.jsf.WeldPhaseListener.deactivateConversations(WeldPhaseListener.java:131) 在 org.jboss.weld.jsf.WeldPhaseListener.afterPhase(WeldPhaseListener.java:96) 在 com.sun.faces.lifecycle.Phase.handleAfterPhase(Phase.java:189) 在 com.sun.faces.lifecycle.Phase.doPhase(Phase.java:107) 在 com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 在 javax.faces.webapp.FacesServlet.service(FacesServlet.java:312) 在 org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:343) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) 在net.balusc.http.multipart.MultipartFilter.doFilter(MultipartFilter.java:78) 在 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:256) 在 org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:279) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 在 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 在org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 在 com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) 在 com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) 在 org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227) 在 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170) 在 com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) 在 com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) 在 com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) 在 com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 在 com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 在 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 在 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 在 com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 在com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 在 com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 在com.sun.grizzly.ContextTask.run(ContextTask.java:71) 在 com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 在 com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 在 java.lang.Thread.run(Thread.java:662)

严重:WebModule[]PWC1322:错误 调用 requestDestroyed 方法 Servlet请求监听器 org.jboss.weld.servlet.WeldListener java.lang.IllegalStateException: 上下文不活跃 在 org.jboss.weld.context.AbstractConversationContext.deactivate(AbstractConversationContext.java:263) 在 org.jboss.weld.servlet.WeldListener.requestDestroyed(WeldListener.java:125) 在 org.apache.catalina.core.StandardContext.fireRequestDestroyedEvent(StandardContext.java:4588) 在 org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:243) 在 org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:328) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227) 在 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:170) 在 com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) 在 com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) 在 com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) 在 com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 在 com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 在 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 在 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 在 com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 在com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 在 com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 在com.sun.grizzly.ContextTask.run(ContextTask.java:71) 在 com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 在 com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 在 java.lang.Thread.run(Thread.java:662)

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.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)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

左岸枫 2024-10-27 12:08:52

此问题已在最新版本的焊接中得到解决,请参阅相关错误报告

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

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文