1 Reply Latest reply on Feb 24, 2016 9:39 AM by soltzu

    Unable to deploy when marking Camel as provided

    soltzu

      Hello everyone,

       

      I've recently began trying to use Fuse and are currently having some trouble with Camel.

       

      I am trying to use the camel version provided with Fuse 6.2.1 (2.15.1.redhat-621084)

       

      This is what my pom file looks like when when marking as provided the packages available in the fuse modules folder ($EAP_HOME/modules/system/layers/fuse/):

                  <!-- Camel dependencies -->

                  <dependency>

                      <groupId>org.apache.camel</groupId>

                      <artifactId>camel-core</artifactId>

                      <version>${camel.version}</version>

                      <scope>provided</scope>

                  </dependency>

             

                  <dependency>

                      <groupId>org.apache.camel</groupId>

                      <artifactId>camel-cdi</artifactId>

                      <version>${camel.version}</version>

                      <scope>provided</scope>

                  </dependency>

                 

                  <dependency>

                      <groupId>org.apache.camel</groupId>

                      <artifactId>camel-smpp</artifactId>

                      <version>${camel.version}</version>

                      <scope>compile</scope>

                  </dependency>

                 

                  <dependency>

                      <groupId>org.apache.camel</groupId>

                      <artifactId>camel-spring</artifactId>

                      <version>${camel.version}</version>

                      <scope>provided</scope>

                  </dependency>

       

      I didn't find smpp there so I marked that one as compile.

       

      I get the following error when trying to deploy:

       

      {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"mywar.war\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"mywar.war\".WeldStartService: Failed to start service

          Caused by: org.jboss.weld.exceptions.DeploymentException: Exception List with 3 exceptions:

      Exception 0 :

      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [CdiCamelContext] with qualifiers [@Default] at injection point [[field] @Inject private com.project.ex.boundary.myservice.camelCtx]

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

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

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

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

          at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:386)

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

          at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)

          at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913)

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

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

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

      Exception 0 :

      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [CdiCamelContext] with qualifiers [@Default] at injection point [[field] @Inject com.project.ex.boundary.myservice.v1.MyserviceV1.camelCtx]

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

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

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

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

          at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:386)

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

          at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)

          at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913)

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

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

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

      Exception 0 :

      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [CdiCamelContext] with qualifiers [@Default] at injection point [[field] @Inject com.project.ex.startup.MyServiceBootStrap.camelCtx]

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

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

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

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

          at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:386)

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

          at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)

          at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1980)

          at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1913)

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

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

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

      "}}}}

       

      My JBOSS_MODULEPATH env var looks like:

      JBOSS_MODULEPATH=$EAP_HOME/modules/system/layers/base:$EAP_HOME/modules/system/layers/fuse:$EAP_HOME/modules/system/layers/soa

       

      And my jboss startup:

      ...

      14:22:10,449 INFO  [org.jboss.modules] (main) JBoss Modules version 1.3.6.Final-redhat-1

      14:22:11,049 INFO  [org.jboss.msc] (main) JBoss MSC version 1.1.5.Final-redhat-1

      14:22:11,422 INFO  [org.jboss.as] (MSC service thread 1-7) JBAS015899: JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) starting

      14:22:13,535 INFO  [org.switchyard] (ServerService Thread Pool -- 25) SwitchYard version 2.0.1.redhat-621084

      14:22:13,980 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found switchyard-bpel-console.war in deployment directory. To trigger deployment create a file called switchyard-bpel-console.war.dodeploy

      ...

       

      Could somebody assist me in any way please?

        • 1. Re: Unable to deploy when marking Camel as provided
          soltzu

          Hello again,

           

          I managed to finally deploy. However, the solution doesn't look that nice to me, but maybe this is the way it should be.

           

          So when it was failing, the jboss-deployment-structure.xml file of my project was looking like:

           

          <?xml version="1.0" encoding="UTF-8"?>
          <!--
          To change this license header, choose License Headers in Project Properties.
          To change this template file, choose Tools | Templates
          and open the template in the editor.
          -->
          
          <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">
              <deployment>
                  <dependencies>
                      <module name="org.apache.cxf.impl" slot="main"/>
                      <module name="org.apache.camel.core" slot="main"/>
                      <module name="org.apache.camel.component.cdi" slot="main"/>
                      <module name="org.apache.camel.spring" slot="main"/>
                  </dependencies>
              </deployment>
          </jboss-deployment-structure>
          e>tr
          
          

           

          After reading around a bit (what most helped me was this Camel on JBoss EAP with Custom Modules – Software Blog) I added this lines under the urn:jboss:domain:ee:1.2 subsystem:

           

          <global-modules>
              <module name="org.apache.camel.core" slot="main"/>
              <module name="org.apache.camel.component.cdi" slot="main"/>
              <module name="org.apache.camel.spring" slot="main"/>
              <module name="org.apache.deltaspike.core.api"/>
              <module name="org.apache.deltaspike.core.impl"/>
              <module name="org.apache.deltaspike.cdictrl.api"/>
          </global-modules>
          
          

           

          To my $EAP_HOME/standalone/configuration/standalone.xml

           

          The first three camel related are for my project and the last 3 deltaspike related are in turn dependencies of the camel-cdi module (this is the content of module.xml for that component):

           

          <?xml version="1.0" encoding="UTF-8"?>
          <module xmlns="urn:jboss:module:1.1" name="org.apache.camel.component.cdi">
            <resources>
              <resource-root path="camel-cdi-2.15.1.redhat-621084.jar" />
            </resources>
            <dependencies>
              <module name="javax.annotation.api" />
              <module name="javax.enterprise.api" />
              <module name="javax.xml.bind.api" />
              <module name="org.apache.deltaspike.core.api" />
              <module name="org.apache.deltaspike.core.impl" />
              <module name="org.apache.deltaspike.cdictrl.api" />
              <module name="org.jboss.weld.core" />
              <module name="org.jboss.weld.spi" />
              <module name="org.slf4j" />
              <module name="org.apache.camel.core" />
            </dependencies>
          </module>
          
          

           

          I guess this is normal according to Chapter 3. Class Loading and Modules:

           

          A module's class path contains only its own classes and that of it's immediate dependencies. A module is not able to access the classes of the dependencies of one of its dependencies. However a module can specify that an explicit dependency is exported. An exported dependency is provided to any module that depends on the module that exports it.

           

          Example 3.2. Module dependencies

          Module A depends on Module B and Module B depends on Module C. Module A can access the classes of Module B, and Module B can access the classes of Module C. Module A cannot access the classes of Module C unless:

          • Module A declares an explicit dependency on Module C, or
          • Module B exports its dependency on Module C.

           

          But if correct, shouldn't at least camel export its dependencies so we don't have to go looking for them and adding them as well?