Uploaded image for project: 'FUSE Mediation Router'
  1. FUSE Mediation Router
  2. MR-653

java.lang.NoClassDefFoundError: org.osgi.vendor.framework property not set Using Camel Route test

XMLWordPrintable

      1. Create a project using camel-archetype-blueprint 2.9.0.fuse-7-061 archetype.

      2. This will build and execute (mvn clean install) after creation as expected.

      3. Add to dependencies an ActiveMQ jar.

        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-core</artifactId>
            <version>5.5.1-fuse-7-061</version> <!-- tried version 03-06 as well -->
          </dependency>  
          <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-camel</artifactId>
            <version>5.5.1.fuse-7-061</version> <!-- tried version 03-06 as well -->
          </dependency>
      

      4. rebuild - "java.lang.NoClassDefFoundError: org.osgi.vendor.framework property not set " will be observed during test phase.

      -------------------------------------------------------
       T E S T S
      -------------------------------------------------------
      Running com.mycompany.camel.blueprint.RouteTest
      [                          main] RouteTest                      INFO  ********************************************************************************
      [                          main] RouteTest                      INFO  Testing done: testRoute(com.mycompany.camel.blueprint.RouteTest)
      [                          main] RouteTest                      INFO  Took: 0.005 seconds (5 millis)
      [                          main] RouteTest                      INFO  ********************************************************************************
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.145 sec <<< FAILURE!
      
      Results :
      
      Tests in error: 
        testRoute(com.mycompany.camel.blueprint.RouteTest): org.osgi.vendor.framework property not set
      
      Tests run: 1, Failures: 0, Errors: 1, Skipped: 0
      

      Notes:

      A similar issue was resolved for Camel 2.10.0:
      https://issues.apache.org/jira/browse/CAMEL-5248
      http://mail-archives.apache.org/mod_mbox/camel-commits/201205.mbox/%3C20120505094322.24E4A238897A@eris.apache.org%3E

      It would appear that the OSGi core jars appear on the classpath during the test phase - these should come from a vendor such as Felix, or equinox.

      I will also note that the archetype for camel blueprint produces:

      <!-- must use fork mode pertest for unit testing with camel-test-blueprint -->
            <plugin>
              <groupId>org.apache.maven.surefire</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.11</version>
              <configuration>
                <forkMode>pertest</forkMode>
              </configuration>
            </plugin>
      

      this does not compile on command line, you need the following:

      <!-- must use fork mode pertest for unit testing with camel-test-blueprint -->
            <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-surefire-plugin</artifactId>
              <version>2.11</version>
              <configuration>
                <forkMode>pertest</forkMode>
              </configuration>
            </plugin>
      

              cibsen@redhat.com Claus Ibsen
              jgoodyear_icbts_jira jamie goodyear (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: