12 Replies Latest reply on Apr 15, 2014 3:31 PM by schellinger

    Camel Deployment to JBoss Fuse 6.1 Server Errors

    schellinger

      First post - excuse the length of this post - it includes part of POM, a Camel context, and 2 call stacks from deployment!

       

      I am trying to deploy Camel projects (including the Chapter 7 JMS project) from the JBoss Dev Studio into the JBoss Fuse 6.1 Server.  When I initially deploy, I get one error, and when I then restart the server, I see a second error - sometimes!  It's a mess!  On top of it all, the route runs perfectly inside the IDE via the JUnit run as well as via command line Maven builds.  Please let me know if anyone has any thoughts on these issues.

       

      First, I copied the Camel in Action's Chapter 7 CXF Contract First project and added some ActiveMQ processing to it.  So the POM I use references the parent CXF POM which references the parent Chapter 7 POM, etc.  Not sure if I need to include the entire POM or any of the parents, but here's the top of it so you see the parent POM reference:

       

      <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

               xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

       

        <modelVersion>4.0.0</modelVersion>

       

        <parent>

          <groupId>com.camelinaction</groupId>

          <artifactId>cxf</artifactId>

          <version>1.0.0</version>

        </parent>

       

        <artifactId>cxf-to-jms-queue</artifactId>

        <name>Camel in Action :: Chapter 7 :: CXF To JMS Queue</name>

       

        <dependencies>

          <dependency>

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

            <artifactId>camel-core</artifactId>

          </dependency>

       

          <dependency>

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

            <artifactId>camel-cxf</artifactId>

          </dependency>

      ...

       

      When I deploy to the Fuse 6.1 Server in the IDE, I see this call stack (I'll highlight the part that caught my eyes):

       

      10:50:39,918 | ERROR | edhat-328/deploy | fileinstall                  | 7 - org.apache.felix.fileinstall - 3.3.11.redhat-610328 | Failed to install artifact: C:\apps\jboss-fuse-6.1.0.redhat-328\deploy\cxf-to-jms-queue-1.0.0.jar

      java.io.IOException: Failed to read artifact descriptor for com.camelinaction:cxf-to-jms-queue:pom:1.0.0

          at io.fabric8.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.getInfo(FabResolverFactoryImpl.java:256)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.osgi.internal.FabConnection.getInputStream(FabConnection.java:93)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at java.net.URL.openStream(URL.java:1037)[:1.7.0_51]

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:941)[7:org.apache.felix.fileinstall:3.3.11.redhat-610328]

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.install(DirectoryWatcher.java:857)[7:org.apache.felix.fileinstall:3.3.11.redhat-610328]

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:483)[7:org.apache.felix.fileinstall:3.3.11.redhat-610328]

          at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:291)[7:org.apache.felix.fileinstall:3.3.11.redhat-610328]

      Caused by: org.sonatype.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.camelinaction:cxf-to-jms-queue:pom:1.0.0

          at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:317)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.readArtifactDescriptor(DefaultArtifactDescriptorReader.java:172)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.impl.internal.DefaultRepositorySystem.readArtifactDescriptor(DefaultRepositorySystem.java:316)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.MavenResolverImpl.collectDependencies(MavenResolverImpl.java:312)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.MavenResolverImpl.collectDependenciesFromPom(MavenResolverImpl.java:294)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.MavenResolverImpl.collectDependencies(MavenResolverImpl.java:263)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.collectDependencyTree(FabResolverFactoryImpl.java:148)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.osgi.internal.FabClassPathResolver.resolve(FabClassPathResolver.java:135)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.configureInstructions(FabResolverFactoryImpl.java:279)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.createInstructions(FabResolverFactoryImpl.java:271)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at io.fabric8.fab.osgi.internal.FabResolverFactoryImpl$FabResolverImpl.getInfo(FabResolverFactoryImpl.java:241)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          ... 6 more

      Caused by: org.apache.maven.model.resolution.UnresolvableModelException: Could not transfer artifact com.camelinaction:cxf:pom:1.0.0 from/to repos2 (https://repository.jboss.org/nexus/content/repositories/fs-ea): Access denied to: https://repository.jboss.org/nexus/content/repositories/fs-ea/com/camelinaction/cxf/1.0.0/cxf-1.0.0.pom

          at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:126)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.model.building.DefaultModelBuilder.readParentExternally(DefaultModelBuilder.java:819)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.model.building.DefaultModelBuilder.readParent(DefaultModelBuilder.java:670)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:308)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.model.building.DefaultModelBuilder.build(DefaultModelBuilder.java:232)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.repository.internal.DefaultArtifactDescriptorReader.loadPom(DefaultArtifactDescriptorReader.java:308)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          ... 16 more

      Caused by: org.sonatype.aether.resolution.ArtifactResolutionException: Could not transfer artifact com.camelinaction:cxf:pom:1.0.0 from/to repos2 (https://repository.jboss.org/nexus/content/repositories/fs-ea): Access denied to: https://repository.jboss.org/nexus/content/repositories/fs-ea/com/camelinaction/cxf/1.0.0/cxf-1.0.0.pom

          at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:541)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:220)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:197)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.repository.internal.DefaultModelResolver.resolveModel(DefaultModelResolver.java:122)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          ... 21 more

      Caused by: org.sonatype.aether.transfer.ArtifactTransferException: Could not transfer artifact com.camelinaction:cxf:pom:1.0.0 from/to repos2 (https://repository.jboss.org/nexus/content/repositories/fs-ea): Access denied to: https://repository.jboss.org/nexus/content/repositories/fs-ea/com/camelinaction/cxf/1.0.0/cxf-1.0.0.pom

          at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:949)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$4.wrap(WagonRepositoryConnector.java:940)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:695)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.flush(WagonRepositoryConnector.java:689)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.connector.wagon.WagonRepositoryConnector.get(WagonRepositoryConnector.java:445)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.impl.internal.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:460)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          ... 24 more

      Caused by: org.apache.maven.wagon.authorization.AuthorizationException: Access denied to: https://repository.jboss.org/nexus/content/repositories/fs-ea/com/camelinaction/cxf/1.0.0/cxf-1.0.0.pom

          at org.apache.maven.wagon.providers.http.LightweightHttpWagon.fillInputData(LightweightHttpWagon.java:119)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.wagon.StreamWagon.getInputStream(StreamWagon.java:116)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.wagon.StreamWagon.getIfNewer(StreamWagon.java:88)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.apache.maven.wagon.StreamWagon.get(StreamWagon.java:61)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.connector.wagon.WagonRepositoryConnector$GetTask.run(WagonRepositoryConnector.java:608)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at org.sonatype.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:64)[106:io.fabric8.fab.fab-osgi:1.0.0.redhat-328]

          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)[:1.7.0_51]

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

          at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]

       

       

      The deployment doesn't seem to be able to find the parent POM (cxf) in the parent folder and appears to be looking at the JBoss repository?  I tried putting a <relativePath> attribute in my POM of ../pom.xml in hopes that it would locate the parent POM.  Any thoughts on this?

       

      But then, sometimes it seems to get by this previous issue, but then dies with a ClassNotFoundException when trying to access some of the classes I have referenced in my Camel route.  Here is my route (I'm highlighting the class that is referenced in the subsequent call stack during deployment):

       

      <?xml version="1.0" encoding="UTF-8"?>

       

      <beans xmlns="http://www.springframework.org/schema/beans"

             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

             xmlns:camel="http://camel.apache.org/schema/spring"

             xsi:schemaLocation="

               http://www.springframework.org/schema/beans  http://www.springframework.org/schema/beans/spring-beans-3.0.xsd

               http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

       

        <import resource="classpath:META-INF/spring/camel-cxf.xml" />

       

        <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">

          <property name="location" value="classpath:cxf-to-jms-queue.properties"/>

          <property name="ignoreUnresolvablePlaceholders" value="true"/>

        </bean>

       

        <bean id="activemq" class="org.apache.camel.component.jms.JmsComponent">

          <property name="connectionFactory">

            <bean class="org.apache.activemq.ActiveMQConnectionFactory">

              <property name="brokerURL" value="tcp://localhost:61616" />

              <property name="userName" value="${activeMQ.username}" />

              <property name="password" value="${activeMQ.password}" />

            </bean>

          </property>

        </bean>

       

        <camelContext xmlns="http://camel.apache.org/schema/spring">

          <route>

              <from uri="cxf:bean:orderEndpoint"/>

              <log message="Message received:  ${body[0]},${body[1]},${body[2]}"/>

              <choice>

                  <when>

                      <simple>${body[2]} == 'honda'</simple>

                      <log message="Honda Order Received and put into ActiveMQ {{activeMQ.queueName.honda}} queue"/>

                      <inOnly uri="activemq:queue:{{activeMQ.queueName.honda}}"/>

                      <transform>

                          <description>route starts from the cxf webservice, see camel-cxf.xml for details and then create the OK reply for the webservice which is still waiting for a reply</description>

                          <constant>OK</constant>

                      </transform>

                  </when>

                  <when>

                      <simple>${body[2]} == 'gm'</simple>

                      <log message="GM Order Received and put into ActiveMQ {{activeMQ.queueName.gm}} queue"/>

                      <inOnly uri="activemq:queue:{{activeMQ.queueName.gm}}"/>

                      <transform>

                          <description>route starts from the cxf webservice, see camel-cxf.xml for details and then create the OK reply for the webservice which is still waiting for a reply</description>

                          <constant>OK</constant>

                      </transform>

                  </when>

                  <otherwise>

                      <log message="Unknown customer (${body[2]}) Order Received and put into ActiveMQ {{activeMQ.queueName.unknownCustomer}} queue"/>

                      <inOnly uri="activemq:queue:{{activeMQ.queueName.unknownCustomer}}"/>

                      <transform>

                          <description>route starts from the cxf webservice, see camel-cxf.xml for details and then create the OK reply for the webservice which is still waiting for a reply</description>

                          <constant>BAD</constant>

                      </transform>

                  </otherwise>

              </choice>

          </route>

          <route>

              <from uri="activemq:queue:{{activeMQ.queueName.honda}}"/>

              <log message="Production consuming Honda orders:  ${body}"/>

              <to uri="file:c:/temp/jms/honda"/>

          </route>

          <route>

              <from uri="activemq:queue:{{activeMQ.queueName.gm}}"/>

              <log message="Production consuming GM orders:  ${body}"/>

              <to uri="file:c:/temp/jms/gm"/>

          </route>

          <route>

              <from uri="activemq:queue:{{activeMQ.queueName.unknownCustomer}}"/>

              <log message="Production consuming Unknown Customer orders:  ${body}"/>

              <to uri="file:c:/temp/jms/unknown"/>

          </route>

          <route>

              <description>test route</description>

              <from uri="seda:incomingOrders"/>

              <to uri="mock:end"/>

          </route>

      </camelContext>

       

      </beans>

       

      And here is the call stack during deployment:

       

      org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer] for bean with name 'bridgePropertyPlaceholder' defined in URL [bundle://253.2:0/META-INF/spring/camel-route.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer not found from bundle [cxf-to-jms-queue]

          at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1275)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1344)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:910)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)[122:org.springframework.context:3.2.4.RELEASE]

          at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[144:org.springframework.osgi.core:1.2.1]

          at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[144:org.springframework.osgi.core:1.2.1]

          at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[144:org.springframework.osgi.core:1.2.1]

          at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[144:org.springframework.osgi.core:1.2.1]

          at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[143:org.springframework.osgi.extender:1.2.1]

          at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]

      Caused by: java.lang.ClassNotFoundException: org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer not found from bundle [cxf-to-jms-queue]

          at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)[144:org.springframework.osgi.core:1.2.1]

          at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)[144:org.springframework.osgi.core:1.2.1]

          at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_51]

          at org.springframework.util.ClassUtils.forName(ClassUtils.java:260)[120:org.springframework.core:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:416)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1296)[124:org.springframework.beans:3.2.4.RELEASE]

          at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1267)[124:org.springframework.beans:3.2.4.RELEASE]

          ... 11 more

      Caused by: java.lang.ClassNotFoundException: org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer not found by cxf-to-jms-queue [253]

          at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

          at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

          at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

          at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_51]

          at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1870)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

          at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

          at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)[144:org.springframework.osgi.core:1.2.1]

          ... 17 more

       

      Again, this all functions great when I run it in the IDE as a JUnit run or at the Maven command line, but during deployment if fails.  The org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer class is in camel-spring dependency in my POM and it appears under the Fuse "system" folder in a JAR file.  So not sure why it's not being found.  Additionally, if I remove that bean from my Camel route, it then starts complaining about org.apache.camel.component.jms.JmsComponent.  Again, in my list of dependencies and a part of camel-jms in the Fuse installation.  Is there something I need to do in Fuse to fix what appears to be a classpath issue?

       

      So, 2 separate problems.  Hopefully someone out there has seen this before and can help out.  Thanks!

       

      Shawn

        • 1. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
          davsclaus

          You need to add camel-spring as a dependency in your pom.xml

          • 2. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
            schellinger

            Thanks for your quick reply Claus.  The camel-spring dependency was already in one of the parent POMs of your Camel in Action samples.  In this case, in the camelinaction-master/pom.xml.  Just for sanity sake, I duplicated the dependency in my project's POM, but with the same results.

             

            To further paint the picture of what my problems are from above, it appears that I get the UnresolvableModelExceptions when I first deploy the project to the Fuse server. But if I simply restart the server (leaving the project JAR in the Fuse "deploy" folder) I then start getting the ClassNotFoundExceptions, in my case, complaining about org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer.  Just don't know why Fuse isn't looking in the correct places to find the JAR for this class - I find this class in its "system" folder as follows:  C:\apps\jboss-fuse-6.1.0.redhat-328-old2\system\org\apache\camel\camel-spring\2.12.0.redhat-610328\camel-spring-2.12.0.redhat-610328.jar.

             

            Thanks again for looking into this.  It has been a solid 2 weeks trying to get past this issue.

             

            Shawn

            • 3. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
              davsclaus

              The deployment mode you use is FAB when you do not specify your project as an OSGi bundle. When using FAB it has some benefits and also limitations.

              FAB is being de-scoped in the future as we recommend using OSGi when you use Karaf based containers.

              And in the future Fuse Fabric is becoming poly container (all that works happens at the fabric8 project - hawtio), so you can run it in Apache Tomcat / JBoss Wildfly / and other containers etc. And they are not OSGi based, and therefore do not need FAB.

               

              Instead if you may try one of the quickstarts of JBoss Fuse to get started as on OSGi based project.

              Or use one of the Maven archetypes to create a new project.

              Or if you use Fuse IDE then it has a "New Fuse Project .." wizard you can use.

               

              All of those works out of the box with JBoss Fuse.

              • 4. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                davsclaus

                You may try setting the scope = provided for the camel-spring dependencies, as that ought to tell FAB to use the built-in spring from the fuse container.

                • 5. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                  schellinger

                  Claus,

                   

                  Again, thanks for your input.  I tried creating one of the quickstart Maven Fuse projects (camel-cxf-contract-first), and as you predicted, it deployed perfectly and allowed me to look at the order WSDL from a web browser.  However, when I add the following lines to the Camel Route:

                   

                    <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">

                      <property name="location" value="classpath:cxf-to-jms-queue.properties"/>

                      <property name="ignoreUnresolvablePlaceholders" value="true"/>

                    </bean>

                   

                  And add the following dependencies to the POM.xml (I tried with and without the scope setting):

                   

                  <dependency>
                      <groupId>org.apache.camel</groupId>
                      <artifactId>camel-spring</artifactId>
                      <version>2.12.0.redhat-610328</version>
                      <scope>provided</scope>
                  </dependency>

                   

                  I get the following deployment-time error:

                   

                  org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer] for bean with name 'bridgePropertyPlaceholder' defined in URL [bundle://252.3:0/META-INF/spring/camel-route.xml]; nested exception is java.lang.ClassNotFoundException: org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer not found from bundle [camel-cxf-contract-first]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1275)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:575)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1344)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:910)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:609)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)[122:org.springframework.context:3.2.4.RELEASE]

                      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)[144:org.springframework.osgi.core:1.2.1]

                      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)[144:org.springframework.osgi.core:1.2.1]

                      at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)[144:org.springframework.osgi.core:1.2.1]

                      at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)[144:org.springframework.osgi.core:1.2.1]

                      at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)[143:org.springframework.osgi.extender:1.2.1]

                      at java.lang.Thread.run(Thread.java:744)[:1.7.0_51]

                  Caused by: java.lang.ClassNotFoundException: org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer not found from bundle [camel-cxf-contract-first]

                      at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)[144:org.springframework.osgi.core:1.2.1]

                      at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)[144:org.springframework.osgi.core:1.2.1]

                      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_51]

                      at org.springframework.util.ClassUtils.forName(ClassUtils.java:260)[120:org.springframework.core:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:416)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1296)[124:org.springframework.beans:3.2.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1267)[124:org.springframework.beans:3.2.4.RELEASE]

                      ... 11 more

                  Caused by: java.lang.ClassNotFoundException: org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer not found by camel-cxf-contract-first [252]

                      at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

                      at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

                      at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

                      at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_51]

                      at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1870)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

                      at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)[org.apache.felix.framework-4.0.3.redhat-610328.jar:]

                      at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)[144:org.springframework.osgi.core:1.2.1]

                      ... 17 more

                   

                  Just don't know what it takes to get Fuse to look at its own set of JARs to find the camel-spring JAR.  I even forced the version for the dependency to match what I see under the Fuse deployment - the JAR is:  system\org\apache\camel\camel-spring\2.12.0.redhat-610328\camel-spring-2.12.0.redhat-610328.jar.  You can see that in my dependency above.  The POM was originally created with 610355, but thought I needed to fix that in the POM since Fuse didn't have those underneath.  Any thoughts?  Thanks again.

                   

                  Shawn

                  • 6. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                    davsclaus

                    You are welcome to make a zip file with your project then I can take a look with that - that's easier for me to investigate.

                     

                    Not sure if we can attach files to this user forum. If not you are welcome to mail it to cibsen@redhat.com

                     

                    Also take a look in the pom.xml file, there may be a plugin called felix-bundle-plugin. That guy is responsible for packaging your code as an OSGi bundle. That plugin can be configured in a million ways. But normally it scans any spring or OSGi blueprint xml files and automatic detects what you refer to as 3rd party classes, and adds the package names as imports automatic.

                     

                    You can also try in the Fuse shell to type

                     

                    headers 252

                     

                    which shows all the OSGi headers for your bundle. That can help diagnose if any imports is missing, which are red etc.

                     

                    And you can also try use enable dynamic import on your bundle, which allows OSGi to load classes in an even more dynamic way

                     

                    dev:dynamic-import 252

                     

                    And you can also force a refresh on your bundle to let OSGi re-scan the bundle dependencies

                    • 7. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                      davsclaus

                      Also instead of using Spring in the example, then you can use OSGi blueprint which works better in OSGi. There is a camel-archetype-cxf-code-first-blueprint archetype that setup a similar web service project but uses OSGi blueprint instead.

                       

                      Then using a .properties file is a little different than the spring bridge you are trying to get working.

                      There is some details on using blueprint property placeholders here: https://camel.apache.org/using-propertyplaceholder.html

                      1 of 1 people found this helpful
                      • 8. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                        schellinger

                        Claus,

                         

                        I tried switching over to a Blueprint project as per your recommendation.  I selected the camel-cxf-contract-first-blueprint.  I successfully deployed it to my Fuse 6.1 server within my JBoss Dev Studio IDE.  Then I added the following to my blueprint.xml:

                         

                          <bean id="bridgePropertyPlaceholder" class="org.apache.camel.spring.spi.BridgePropertyPlaceholderConfigurer">

                            <property name="location" value="classpath:camel-cfx-contract-first-blueprint.properties"/>

                          </bean>

                         

                        After it was deployed, I saw this error in the log file:

                         

                        org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property: PropertyDescriptor <name: location, getter: null, setter: [class org.springframework.core.io.support.PropertiesLoaderSupport.setLocation(interface org.springframework.core.io.Resource)]

                            at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:941)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:907)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                        ...

                        Caused by: java.lang.Exception: Unable to convert value classpath:camel-cfx-contract-first-blueprint.properties to type interface org.springframework.core.io.Resource. Type interface org.springframework.core.io.Resource is an interface or an abstract class

                            at org.apache.aries.blueprint.container.AggregateConverter.createObject(AggregateConverter.java:310)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.container.AggregateConverter.convertFromString(AggregateConverter.java:304)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.container.AggregateConverter.convert(AggregateConverter.java:174)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.container.BlueprintRepository.convert(BlueprintRepository.java:402)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.convert(ReflectionUtils.java:394)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.utils.ReflectionUtils$MethodPropertyDescriptor.internalSet(ReflectionUtils.java:628)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.utils.ReflectionUtils$PropertyDescriptor.set(ReflectionUtils.java:378)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:939)[12:org.apache.aries.blueprint.core:1.0.1.redhat-610328]

                            ... 30 more

                         

                        I tried it with and without the classpath in front of the properties file name, but no luck.  My properties file is at the root of my src/main/resources folder in my project.  It looks like I'm defining this bean properly based on the link you included in your reply.  What am I doing wrong here?  Thanks again Claus.

                         

                        Shawn

                        • 9. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                          davsclaus

                          Yeah you cannot use the spring bridge property placeholder with blueprint. You need to use the OSGi blueprint way.

                           

                          For an example you can see the Examples -> Camel -> Twitter which uses property placeholders in the camel xml file.

                          fabric8/fabric/fabric8-karaf/src/main/resources/distro/fabric/import/fabric/profiles/example/camel/twitter.profile/camel…

                           

                          The twitter example comes out of the box in JBoss Fuse 6.1, so you can also take a look at it from the web console.

                          1 of 1 people found this helpful
                          • 10. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                            schellinger

                            Thanks Claus.  This may ultimately solve my problem.  Will look into this information right away, but curious if you can use these properties in 3rd party bean definitions.  I know these properties can be referenced inside the route using the {{xx}} syntax.  But I was looking to use these properties in my ActiveMQ configuration using the ${xx} syntax.  I will play around with it, but hoped you might know immediately.  Thanks again.

                             

                            Shawn

                            • 11. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                              schellinger

                              Claus,

                               

                              Know you're probably busy, but wanted to reply with an update.  I added the following line to my Blueprint.xml:

                               

                                   <cm:property-placeholder id="myConfig" persistent-id="camel-cfx-contract-first-blueprint"/>

                               

                              I started getting errors outside of the route when using the ${} syntax.  When I hard coded those values, I started getting errors inside my route when using the {{}} syntax.  So I then got rid of the hard coded values outside the route and added default property values inside the property-placeholder tag and everything then started getting resolved properly - good news.  So my problem is obviously that my "camel-cfx-contract-first-blueprint" properties file isn't being located.  Reading some of the help out there it looked like it would attach the ".cfg" extension to the persistent-id and look inside the etc folder.  I tried putting a camel-cfx-contract-first-blueprint.cfg under the Fuse 6.1 server's etc folder, but that didn't work.  I then tried creating an etc folder parallel with the wsdl folder (inside src/main/resources), but still, no luck.  I also tried using the ".properties" extension, but no good either.  What am I missing?

                               

                              Thanks Claus.

                               

                              Shawn

                              • 12. Re: Camel Deployment to JBoss Fuse 6.1 Server Errors
                                schellinger

                                Claus,

                                 

                                Alright - give me enough time, I'll figure it out!!  I don't really know why it doesn't work the original way I tried, but as you see in my previous post to you, my persistent-id was "camel-cfx-contract-first-blueprint" and I put a file in the JBoss etc folder named camel-cfx-contract-first-blueprint.cfg.  For whatever reason, I decided to switch over to a persistent-id of "abc" - it found my abc.cfg file!  So I decided to change my dashes in my original persistent-id to dots:  camel.cfx.contract.first.blueprint.  Lo and behold, it found my camel.cfx.contract.first.blueprint.cfg file.  Not sure why dashes aren't allowed, but that seems to be the problem.

                                 

                                Thanks again for all of your input.  It helped a lot.

                                 

                                Shawn