glassfish
  1. glassfish
  2. GLASSFISH-18946

EAR with two CDI Jersey web archives will not deploy

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: 4.0
    • Component/s: jax-rs
    • Labels:
      None
    • Environment:

      Windows 7

      Description

      I already filed this issue in the Jersey JIRA (http://java.net/jira/browse/JERSEY-1232), however, after some research by Michal Gajdos, the issue is closed as "invalid", since the problem would by caused by Weld/GlassFish Weld. I also filed an issue at the Weld JIRA (http://issues.jboss.org/browse/WELD-1175), but they think it should be investigated first by the GlassFish team... (from pillar to post).
      Hopefully, the GlassFish team can help solving this problem.

      So here are the details:
      We are experiencing the following issue with Jersey 1.12 in combination with Weld 1.1.4 and 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. When deploying both WAR's without the EAR, they deploy just fine.
      I will attach a test case.

      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.naming.impl.SerialInitContextFactory,
       java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, 
      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(CDIExtension.java:177)
      	at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactory.<init>(CDIComponentProviderFactory.java:92)
      	at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:75)
      	at com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:574)
      	at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:311)
      	at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:606)
      	at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:208)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.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>(CDIComponentProviderFactory.java:94)
      	at com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer.initialize(CDIComponentProviderFactoryInitializer.java:75)
      	at com.sun.jersey.spi.container.servlet.WebComponent.configure(WebComponent.java:574)
      	at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.configure(ServletContainer.java:311)
      	at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:606)
      	at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:208)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
      	at javax.servlet.GenericServlet.init(GenericServlet.java:244)
      	...
      

        Activity

        Hide
        sebastian2 added a comment -

        Is there a plan to fix that issue? I am also struggeling with this bug....

        Show
        sebastian2 added a comment - Is there a plan to fix that issue? I am also struggeling with this bug....
        Hide
        Jakub Podlesak added a comment -

        Updated test case from Ramon.

        Show
        Jakub Podlesak added a comment - Updated test case from Ramon.
        Hide
        Jakub Podlesak added a comment -

        Ramon, could you please send the test case to my e-mail address (jakub.podlesak at oracle.com)? I will attach it here as well once i get it. Thanks!

        Show
        Jakub Podlesak added a comment - Ramon, could you please send the test case to my e-mail address (jakub.podlesak at oracle.com)? I will attach it here as well once i get it. Thanks!
        Hide
        Ramon Rockx added a comment -

        It seems I cannot add an attachment anymore...

        Show
        Ramon Rockx added a comment - It seems I cannot add an attachment anymore...
        Hide
        Ramon Rockx added a comment -

        Like jwells mentioned, the current test case results in ClassNotFoundExceptions.
        I downloaded GlassFish 4.0 b88. Tweaked the test case:

        • no Jersey servlet configuration anymore (web.xml is empty)
        • no explicit dependency to Jersey 1.12 anymore (it now depends on Jersey 2.x)
        • used the javax.ws.rs.ApplicationPath annotation to configure the REST path prefix.

        Now each REST service does work in both web modules.

        However, GlassFish does log warnings like
        "[WARNING|glassfish 4.0|javax.enterprise.web.util|_ThreadID=60;_ThreadName=AutoDeployer;_TimeMillis=1369210288543;_LevelValue=900; _MessageID=AS-WEB-UTIL-00035;| Unable to load class nl.asknow.sandbox.RestService1, reason: java.lang.ClassNotFoundException: nl.asknow.sandbox.RestService1|#]".
        I'm not sure if this warning can be ignored.

        I will attach my new test case.

        Show
        Ramon Rockx added a comment - Like jwells mentioned, the current test case results in ClassNotFoundExceptions. I downloaded GlassFish 4.0 b88. Tweaked the test case: no Jersey servlet configuration anymore (web.xml is empty) no explicit dependency to Jersey 1.12 anymore (it now depends on Jersey 2.x) used the javax.ws.rs.ApplicationPath annotation to configure the REST path prefix. Now each REST service does work in both web modules. However, GlassFish does log warnings like " [WARNING|glassfish 4.0|javax.enterprise.web.util|_ThreadID=60;_ThreadName=AutoDeployer;_TimeMillis=1369210288543;_LevelValue=900; _MessageID=AS-WEB-UTIL-00035;| Unable to load class nl.asknow.sandbox.RestService1, reason: java.lang.ClassNotFoundException: nl.asknow.sandbox.RestService1|#] ". I'm not sure if this warning can be ignored. I will attach my new test case.

          People

          • Assignee:
            Jakub Podlesak
            Reporter:
            Ramon Rockx
          • Votes:
            16 Vote for this issue
            Watchers:
            14 Start watching this issue

            Dates

            • Created:
              Updated: