Problem: Using REST service and SIP Servlets in one project is leading to an exception, if injection via EJB is also used.
What steps will reproduce the problem?
Adding a Sip Servlet and REST service in the project (REST service is activated via a class extending Application and annotated with @
ApplicationPath
, which is the Java EE 6 "no XML" approach, activating JAX-RS)Using the REST service and/or SIP servlet will not produce any errors.
Add an injected service via @EJB to the project.
Using the REST service results in following exception:
Error:
Exception sending request destroyed lifecycle event to listener instance of class org.jboss.weld.servlet.WeldListener: java.lang.NullPointerException
at org.jboss.weld.context.AbstractBoundContext.deactivate(AbstractBoundContext.java:71) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]
at org.jboss.weld.context.http.HttpRequestContextImpl.deactivate(HttpRequestContextImpl.java:86) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]
at org.jboss.weld.servlet.WeldListener.requestDestroyed(WeldListener.java:103) [weld-core-1.1.8.Final.jar:2012-04-29 10:45]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.16.Final.jar:]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.16.Final.jar:]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.16.Final.jar:]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:679) [jbossweb-7.0.16.Final.jar:]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:931) [jbossweb-7.0.16.Final.jar:]
at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_37]
I am using:
- Mobicents: mss-2.0.0.FINAL-jboss-as-7.1.2.Final
- OS: Mac OS X 10.6.8, Ubuntu 12.04, Windows 8
I've also posted the problem to Google Code, where a test project has been uploaded and can be used to run the actual test case. There is a test file in src/test/java which is calling the deployed REST service. In the original project this should result in the error above.
If the SIP Servlet is not activated (e.g. by renaming sip.xml) no error occurs on calling the REST service.
If the SIP Servlet is activated and the injected service HelloWorldService
is removed there is also no error calling the REST service.