users@jersey.java.net

[Jersey] EAR with two CDI web archives will not deploy

From: <r.rockx_at_asknow.nl>
Date: Tue, 19 Jun 2012 12:29:50 +0000 (GMT)

Hello,

We are experiencing the following issue with Jersey 1.12 in combination
with Glassfish 3.1.2:
When using an EAR with two WAR's in it, the last WAR doesn't get
deployed. Both WAR's are CDI enabled and contains a REST service.

This issue seems to be closely related to:

http://java.net/jira/browse/JERSEY-582
http://java.net/jira/browse/JERSEY-1115

Depending on the VM property
com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager we will get
another Exception:

com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=false:
java.lang.RuntimeException: javax.naming.NamingException: Lookup failed
for 'com/sun/jersey/config/CDIExtension' in
SerialContext[myEnv={java.naming.factory.initial=com.sun.enterprise.nam
ing.impl.SerialInitContextFactory,
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDISt
ateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming}
[Root exception is javax.naming.NameNotFoundException: CDIExtension not
found]
        at
com.sun.jersey.server.impl.cdi.CDIExtension.getInitializedExtension(CDI
Extension.java:177)
        at
com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.<init>(CDICo
mponentProviderFactory.java:92)
        at
com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.i
nitialize(CDIComponentProviderFactoryInitializer.java:75)
        at
com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponen
t.java:574)
        at
com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebCompon
ent.configure(ServletContainer.java:311)
        at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.jav
a:606)
        at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.jav
a:208)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletConta
iner.java:373)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletConta
iner.java:556)
        at javax.servlet.GenericServlet.init(GenericServlet.java:244)
        ...


com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager=true
java.lang.NullPointerException
        at
com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.<init>(CDICo
mponentProviderFactory.java:94)
        at
com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.i
nitialize(CDIComponentProviderFactoryInitializer.java:75)
        at
com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponen
t.java:574)
        at
com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebCompon
ent.configure(ServletContainer.java:311)
        at
com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.jav
a:606)
        at
com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.jav
a:208)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletConta
iner.java:373)
        at
com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletConta
iner.java:556)
        at javax.servlet.GenericServlet.init(GenericServlet.java:244)
        ...

http://java.net/jira/browse/JERSEY-582
http://java.net/jira/browse/JERSEY-1115

Anyone knows what I'm doing wrong?

Regards,
Ramon