gpt4 book ai didi

servlets - Jboss 接缝自定义 servlet "No active event context"

转载 作者:行者123 更新时间:2023-12-01 01:54:02 24 4
gpt4 key购买 nike

我有 jboss seam 网络服务。我在 web.xml 中映射我的服务类,如下所示

<servlet>
<servlet-name>pluginhandler</servlet-name>
<servlet-class>service.PlugInHandler</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>pluginhandler</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>

我在一些博客上读到,如果您在 jboss seam 中使用自定义 servlet,那么您必须添加过滤器 org.jboss.seam.servlet.SeamServletFilter 以生成我可能需要与 seam 组件对话的所有必需上下文

<filter>
<filter-name>Seam Servlet Filter</filter-name>
<filter-class>org.jboss.seam.servlet.SeamServletFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>Seam Servlet Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

我有一个 seam 组件 Action,我试图在 web 方法中实例化它,但我不断收到空指针异常(当我尝试调用它的方法时),根本原因是“没有事件事件上下文”。我已经附加了异常堆栈如下

    Servlet.service() for servlet pluginhandler threw exception
java.lang.IllegalStateException: No active event context
at org.jboss.seam.core.Manager.instance(Manager.java:250)
at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:55)
at org.jboss.seam.web.ContextFilter.doFilter(ContextFilter.java:37)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Unknown Source)

我不知道哪里出了问题。使用自定义 servlet 是否缺少某些特定配置?非常感谢您的帮助和时间。我正在使用 seam 2.0.1.GA,jboss 版本是 4.2.2.GA

谢谢

最佳答案

如果您以非标准方式访问 Seam 组件,您需要使用 Lifecycle.beginCall()Lifecycle.endCall() 包装方法调用

Lifecycle.beginCall() 
Component.getInstance('...').call();
Lifecycle.endCall()

关于servlets - Jboss 接缝自定义 servlet "No active event context",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10342175/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com