我有 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>
我有一个接缝组件 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
谢谢