3 Replies Latest reply on Jan 12, 2015 6:55 AM by Tomas Remes

    DeploymentException: WELD-001408: Unsatisfied dependencies for RequestScope object

    Arun Gujjar Newbie

      Hi,

       

      I am deploying an application using CDI Weld 2.2.7, I have modules like REST, DAO and MODEL, REST generates the war, DAO and MODEL are libraries, that generates jar files. These DAO and MODEL libraries are added as dependency in REST pom.xml.

       

      I have @Request and @Application scoped beans in all the modules (REST, DAO and MODEL). I have empty beans.xml defied in /WEB-INF/classes/META-INF/ folder. I do have beans.xml in DAO and MODEL modules under /src/main/resource/MATA-INF folder.

       

      I am able to generate the build but fails that the time of deployment with error WELD-001408 for @RequestScoped bean. If I comment this bean and deploy everything works fine. Weld is able to find @ApplicationScoped beans but not @RequestScoped bean (TxnLogDiagnosticContext is a RequestScoped bean).

       

      Can someone help with me on how to fix this issue?

       

      Here is the entire exception log:

       

      2015-01-07 22:34:33 DEBUG Reflection:80 - WELD-000601: interface javax.inject.Named is missing @Target. Weld will use this annotation, however this may make the application unportable.

      2015-01-07 22:34:34 DEBUG Bootstrap:433 - WELD-000100: Weld initialized. Validating beans

      07-Jan-2015 22:34:34.129 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:

      org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/zcard]]

              at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)

              at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:725)

              at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:701)

              at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:714)

              at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:917)

              at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1701)

              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)

              at java.util.concurrent.FutureTask.run(FutureTask.java:266)

              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

              at java.lang.Thread.run(Thread.java:745)

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

        at injection point [BackedAnnotatedField] @Inject protected com.example.webservice.interceptor.TxnLogInterceptor.txnLogDC

        at com.example.webservice.interceptor.TxnLogInterceptor.txnLogDC(TxnLogInterceptor.java:0)

       

       

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

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

              at org.jboss.weld.bootstrap.Validator.validateInterceptor(Validator.java:568)

              at org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:85)

              at org.jboss.weld.bootstrap.ConcurrentValidator$2.doWork(ConcurrentValidator.java:83)

        • 1. Re: DeploymentException: WELD-001408: Unsatisfied dependencies for RequestScope object
          Tomas Remes Expert

          Hi Arun,

          So TxnLogDiagnosticContext is @RequestScoped right? Can you please post output from "jar tf <your_archive>"? Information in which archive resides TxnLogDiagnosticContext and TxnLogInterceptor could be also helpful.    

          • 2. Re: DeploymentException: WELD-001408: Unsatisfied dependencies for RequestScope object
            Arun Gujjar Newbie

            Hi Tomas,

             

            Please find the MODEL library details that has TxnLogDiagnosticContext.java

             

            META-INF/

            META-INF/MANIFEST.MF

            com/

            com/example

            com/example/model/

            com/example/model/TxnLogDiagnosticContext.class

            META-INF/beans.xml

            META-INF/maven/

            META-INF/maven/com.example/

            META-INF/maven/com.example/model/

            META-INF/maven/com.example/model/pom.xml

            META-INF/maven/com.example/model/pom.properties

             

            Here is the code snippet from TxnLogDiagnosticContext


            @Named("txnLogDiagnosticContext")

            public @RequestScoped class TxnLogDiagnosticContext  implements java.io.Serializable, Cloneable

            {

            }

             

            Here is the code snippet from TxnLogInterceptor class

             

            @TxnLogInject

            public @Interceptor class TxnLogInterceptor {

             

                   @Inject TxnLogUtil txnLogUtil;

                   @Inject protected TxnLogDiagnosticContext txnLogDC;

             

                   private final static Logger logger = Logger.getLogger(TxnLogInterceptor.class);

             

                   @AroundInvoke

                   public Object invoke(InvocationContext ctx) throws Exception {

             

                   //Let's store txnLogDC

                   txnLogDC.setAppName(ZCardConstants.APPNAME);

                   txnLogDC.setMethodName(ctx.getMethod().getName());

               }

            }

             

            Thanks for the help Tomas

            • 3. Re: DeploymentException: WELD-001408: Unsatisfied dependencies for RequestScope object
              Tomas Remes Expert

              Hm ok, this seems to be correct. So this MODEL library resides in WAR archive right? Can you please also post the same dump output for you WAR archive? Or where is TxnLogInterceptor packaged?