6 Replies Latest reply on Oct 22, 2014 9:43 AM by nicolae marasoiu

    Jersey2 application is not getting deployed to WildFly 8

    Rishikesh Darandale Newbie

      I am upgrading existing Jersey1 application to Jersey2. While deployment of this application in WF8 I am getting below WELD exception

      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type ServiceLocator with qualifiers @Default

        at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject private org.glassfish.hk2.internal.ImmediateHelper(ServiceLocator)

        at org.glassfish.hk2.internal.ImmediateHelper.<init>(ImmediateHelper.java:0)

       

          at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:368)

          at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289)

          at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)

          at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166)

          at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514)

          at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)

          at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)

          at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)

          at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)

          at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_45]

          ... 3 more

       

      Can anyone let me know, how to fix this one?

        • 1. Re: Jersey2 application is not getting deployed to WildFly 8
          Tomaz Cerar Master

          Looks like you are bundling some glassfish internal jars in your application and that is causing you problems.

           

          can you post list of jars in your lib directory so we can better help you.

          • 2. Re: Jersey2 application is not getting deployed to WildFly 8
            Rishikesh Darandale Newbie

            I am using Jersey2 Client and if do dependency tree on my project, I do see following output:

             

            [INFO] |  +- org.glassfish.jersey.core:jersey-client:jar:2.8:compile

            [INFO] |  |  +- org.glassfish.jersey.core:jersey-common:jar:2.8:compile

            [INFO] |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile

            [INFO] |  |  |  +- org.glassfish.jersey.bundles.repackaged:jersey-guava:jar:2.8:compile

            [INFO] |  |  |  \- org.glassfish.hk2:osgi-resource-locator:jar:1.0.1:compile

            [INFO] |  |  +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile

            [INFO] |  |  +- org.glassfish.hk2:hk2-api:jar:2.2.0:compile

            [INFO] |  |  |  +- org.glassfish.hk2:hk2-utils:jar:2.2.0:compile

            [INFO] |  |  |  \- org.glassfish.hk2.external:aopalliance-repackaged:jar:2.2.0:compile

            [INFO] |  |  +- org.glassfish.hk2.external:javax.inject:jar:2.2.0:compile

            [INFO] |  |  \- org.glassfish.hk2:hk2-locator:jar:2.2.0:compile

             

            and above jars are also bundled in my war file.

            • 3. Re: Jersey2 application is not getting deployed to WildFly 8
              Michal Gajdos Newbie

              CDI container (Weld) in WildFly is trying to satisfy injection points in Jersey 2 jars (annotated with @Inject). This is because of the fact that CDI handles all jars located in a war as "client" libraries (meaning they expect the injection points to be injected by CDI container) rather than "framework" libraries even though if these libraries are able to handle the injection by themselves. Try to add 'org.glassfish.jersey.containers.glassfish:jersey-gf-cdi' to your application as well. This module tells the CDI container to leave injections in Jersey 2 code to be handled by Jersey itself.

              • 4. Re: Re: Jersey2 application is not getting deployed to WildFly 8
                Rishikesh Darandale Newbie

                Thanks Michal,

                I need to add two more dependency(mentioned below) to my project to get deployed to WF 8.0.

                 

                 

                org.glassfish.jersey.containers.glassfish:jersey-gf-cdi
                org.glassfish.jersey.containers:jersey-container-servlet
                
                • 5. Re: Jersey2 application is not getting deployed to WildFly 8
                  Ahsan Shaikh Newbie

                  I added dependencies as mentioned by Rishikesh , but no luck yet . I am getting the same exception on deployment of Jersey 2x  based war.

                   

                  any suggestion ?

                   

                  MSC000001: Failed to start service jboss.deployment.unit."MyApplication.war".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit.".war".WeldStartService: Failed to start service

                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.0.Final.jar:1.2.0.Final]

                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_45]

                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_45]

                    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45]

                  Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Providers with qualifiers @Default

                    at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide(@Context Providers, Provider<CloseableService>)

                    at org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide.<init>(MultiPartReaderServerSide.java:0)

                   

                   

                   

                   

                    at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:368)

                    at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:289)

                    at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:135)

                    at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:166)

                    at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:514)

                    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)

                    at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)

                    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)

                    at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)

                    at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_45]

                    ... 3 more

                   

                   

                   

                   

                  16:08:41,338 ERROR [org.jboss.as.controller.management-operation] (XNIO-1 task-3) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "MyApplication.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MyApplication.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MyApplication.war\".WeldStartService: Failed to start service

                      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Providers with qualifiers @Default

                    at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide(@Context Providers, Provider<CloseableService>)

                    at org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide.<init>(MultiPartReaderServerSide.java:0)

                  "}}

                  16:08:41,341 ERROR [org.jboss.as.server] (XNIO-1 task-3) JBAS015870: Deploy of deployment "MyApplication.war" was rolled back with the following failure message:

                  {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"MyApplication.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"MyApplication.war\".WeldStartService: Failed to start service

                      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Providers with qualifiers @Default

                    at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide(@Context Providers, Provider<CloseableService>)

                    at org.glassfish.jersey.media.multipart.internal.MultiPartReaderServerSide.<init>(MultiPartReaderServerSide.java:0)

                  "}}

                  16:08:41,345 INFO  [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) JBAS010418: Stopped Driver service with driver-name = MyApplication.war_com.microsoft.sqlserver.jdbc.SQLServerDriver_2_0

                  16:08:41,345 INFO  [org.jboss.weld.deployer] (MSC service thread 1-8) JBAS016009: Stopping weld service for deployment MyApplication.war

                  16:08:41,446 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-6) JBAS015877: Stopped deployment MyApplication.war (runtime-name: MyApplication.war) in 105ms

                  16:08:41,450 INFO  [org.jboss.as.controller] (XNIO-1 task-3) JBAS014774: Service status report

                  JBAS014775:    New missing/unsatisfied dependencies:

                        service jboss.deployment.unit."MyApplication.war".WeldBootstrapService (missing) dependents: [service jboss.deployment.unit."MyApplication.war".CdiValidatorFactoryService, service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator, service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator, service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, JBAS014799: ... and 7 more ]

                        service jboss.deployment.unit."MyApplication.war".WeldStartService (missing) dependents: [service jboss.deployment.unit."MyApplication.war".CdiValidatorFactoryService, service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator, service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator, service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator, JBAS014799: ... and 4 more ]

                        service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".START]

                        service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".START (missing) dependents: [service jboss.deployment.unit."MyApplication.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./MyApplication, service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".START]

                        service jboss.deployment.unit."MyApplication.war".component."javax.faces.webapp.FacetTag".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."javax.faces.webapp.FacetTag".START]

                        service jboss.deployment.unit."MyApplication.war".component."javax.faces.webapp.FacetTag".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication, service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".component."javax.faces.webapp.FacetTag".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."javax.faces.webapp.FacetTag".START]

                        service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]

                        service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication, service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV".START]

                        service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]

                        service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START]

                        service jboss.deployment.unit."MyApplication.war".component."org.glassfish.jersey.servlet.ServletContainer".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.glassfish.jersey.servlet.ServletContainer".START]

                        service jboss.deployment.unit."MyApplication.war".component."org.glassfish.jersey.servlet.ServletContainer".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication, service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".component."org.glassfish.jersey.servlet.ServletContainer".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.glassfish.jersey.servlet.ServletContainer".START]

                        service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".START]

                        service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".START (missing) dependents: [service jboss.deployment.unit."MyApplication.war".deploymentCompleteService, service jboss.undertow.deployment.default-server.default-host./MyApplication, service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldInitialListener".START]

                        service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".CREATE (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".START]

                        service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".START (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication, service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".WeldInstantiator (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".START]

                        service jboss.deployment.unit."MyApplication.war".ee.ComponentRegistry (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                        service jboss.deployment.unit."MyApplication.war".jndiDependencyService (missing) dependents: [service jboss.deployment.unit."MyApplication.war".component."org.jboss.weld.servlet.WeldTerminalListener".START, service jboss.deployment.unit."MyApplication.war".component."javax.faces.webapp.FacetTag".START, service jboss.deployment.unit."MyApplication.war".component."javax.servlet.jsp.jstl.tlv.ScriptFreeTLV".START, service jboss.deployment.unit."MyApplication.war".component."com.sun.faces.config.ConfigureListener".START, JBAS014799: ... and 4 more ]

                        service jboss.undertow.deployment.default-server.default-host./MyApplication (missing) dependents: [service jboss.deployment.unit."MyApplication.war".deploymentCompleteService]

                        service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication]

                        service jboss.undertow.deployment.default-server.default-host./MyApplication.codec (missing) dependents: [service jboss.undertow.deployment.default-server.default-host./MyApplication.UndertowDeploymentInfoService]

                  JBAS014777:   Services which failed to start:      service jboss.deployment.unit."MyApplication.war".WeldStartService

                  • 6. Re: Jersey2 application is not getting deployed to WildFly 8
                    nicolae marasoiu Newbie

                    Thank you it works! It seems risky to add glassfish CDI engine and servlet container. I know WildFly makes sure that we do not load a different jee7 api jar, but i am not sure if it protects us from overriding other parts