2 Replies Latest reply on Apr 15, 2016 11:54 PM by Kaleem Ahmed

    [Fuse 6.2.1]Osgi Missing Requirement: Oracle JDBC Driver

    Prabal Rakshit Newbie

      Hi All,

       

       

      I am trying to deploy a Fuse project which uses the Oracle JDBC driver. While I can run the source code successfully in the Jboss developer studio, I am unable to deploy into a Karaf container. Whenever I try doing that I get an error as follows:

       

       

      JBossFuse:karaf@root> osgi:install -s file:D:/JBoss/Fuse-Workspace-900/NBN/ASN_CommonFramework/target/ASN_CommonFramework.jar

      Bundle ID: 307

      Error executing command: Error installing bundles:

              Unable to start bundle file:D:/JBoss/Fuse-Workspace-900/NBN/ASN_CommonFramework/target/ASN_CommonFramework.jar: Unresolved constraint in bundle ASN_Comm

      onFramework [307]: Unable to resolve 307.0: missing requirement [307.0] osgi.wiring.package; (osgi.wiring.package=oracle.jdbc)

       

       

      The pom.xml documents the dependency as follows (ojdbc6.version is set to 11.2.0):

        <dependency>

         <groupId>com.oracle</groupId>

         <artifactId>ojdbc6</artifactId>

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

            <scope>compile</scope>

        </dependency>

       

       

      Here is what I tried to fix this:

      - Deploy this as a FAB but get the following error:

      osgi:install fab:mvn:au.com.nbnco/ASN_CommonFramework/1.0.0

       

       

      Caused by: java.lang.Exception: Unable to install bundle fab:mvn:au.com.nbnco/ASN_CommonFramework/1.0.0

        at org.apache.karaf.shell.osgi.InstallBundle.doExecute(InstallBundle.java:45)

        ... 18 more

      Caused by: org.osgi.framework.BundleException: Unable to cache bundle: fab:mvn:au.com.nbnco/ASN_CommonFramework/1.0.0

        at org.apache.felix.framework.Felix.installBundle(Felix.java:2878)

        at org.apache.felix.framework.BundleContextImpl.installBundle(BundleContextImpl.java:165)

        at org.apache.karaf.shell.osgi.InstallBundle.doExecute(InstallBundle.java:43)

        ... 18 more

      Caused by: java.net.MalformedURLException: Unknown protocol: fab

        at java.net.URL.<init>(URL.java:620)[:1.8.0_66]

       

       

      - Modify the POM file (ref lines 358-359) to Oracle driver jar as an embedded dependency.

      Changed the following from:

      <Import-Package>*</Import-Package>

      to

      <Import-Package>!oracle.jdbc,*</Import-Package>

      <Embed-Dependency>ojdbc6</Embed-Dependency>

      However this raises a new setof dependencies in

      \target\classes\META-INF\MANIFEST.MF

      Import-Package: com.sun.security.auth.module,javax.crypto,javax.crypto.s

      pec,javax.management,javax.naming,javax.naming.directory,javax.naming.s

      pi,javax.net,javax.net.ssl,javax.resource,...and many others.

       

      None of these dependencies are used in the project.I am not sure if these are transitive dependencies originating from ojdbc6.jar.

       

       

      Questions:

      - Why is the FAB deployment command marked incorrect? I took it from

      https://access.redhat.com/documentation/en-US/Fuse_ESB_Enterprise/7.1/html/Deploying_into_the_Container/files/DeployFab-Manual.html

       

      - Any idea how to handle such a dependency? An example could would be really useful.

       

      I have attached my source code. The details of the environment are:

      Red Hat JBoss Developer Studio - Version: 9.0.0.GA

      Boss Fuse 6.2.1.redhat-084

       

      Thanks a lot for reading through this and any suggestions that you have.

       

      Regards,

      Prabal

       

      Message was edited by: Prabal Rakshit

        • 1. Re: [Fuse 6.2.1]Osgi Missing Requirement: Oracle JDBC Driver
          Sundar Munirathnam Rajendran Newbie

          fabric:bundle is needed for the fab protocol to be recognized , I see that that bundle has not been available from 6.2 . To resolve your issue however , you can go ahead install the bundle without the fab protocol and also you would have to install the ojdbc jar

           

          osgi:install wrap:mvn:<oracle-coordinates>

          osgi:install -s mvn:au.com.nbnco/ASN_CommonFramework/1.0.0

          • 2. Re: [Fuse 6.2.1]Osgi Missing Requirement: Oracle JDBC Driver
            Kaleem Ahmed Newbie

            I have the same problem as mentioned by the original post. However, I tried the above recommended solution and that did not solve the problem. Any one out there who can help.

             

            the project runs fine locally, but when trying to deploy to fuse as fabric profile and then a container if fails with the exact same error mentioned earlier.

             

            io.fabric8.common.util.MultiException: Error

              at io.fabric8.agent.download.impl.MavenDownloadManager$MavenDownloader.(MavenDownloadManager.java:93)

              at io.fabric8.agent.download.impl.MavenDownloadManager.createDownloader(MavenDownloadManager.java:71)

              at io.fabric8.agent.region.Subsystem.downloadBundles(Subsystem.java:329)

              at io.fabric8.agent.region.SubsystemResolver.resolve(SubsystemResolver.java:182)

              at io.fabric8.agent.service.Deployer.deploy(Deployer.java:273)

              at io.fabric8.agent.service.Agent.provision(Agent.java:366)

              at io.fabric8.agent.service.Agent.provision(Agent.java:199)

              at io.fabric8.agent.DeploymentAgent.doUpdate(DeploymentAgent.java:727)

              at io.fabric8.agent.DeploymentAgent$4.run(DeploymentAgent.java:283)

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

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

              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)

            java.lang.Exception: Unable to create resource for bundle fab:mvn:com.oracle/ojdbc6/11.2.0.4

              at io.fabric8.agent.region.Subsystem.createResource(Subsystem.java:491)

              at io.fabric8.agent.region.Subsystem$ResourceBuilderCallback.downloaded(Subsystem.java:422)

              at io.fabric8.agent.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:143)

              at io.fabric8.agent.download.impl.MavenDownloadManager$MavenDownloader$1.operationComplete(MavenDownloadManager.java:137)

              at io.fabric8.agent.download.impl.DefaultFuture.notifyListener(DefaultFuture.java:343)

              at io.fabric8.agent.download.impl.DefaultFuture.notifyListeners(DefaultFuture.java:328)

              at io.fabric8.agent.download.impl.DefaultFuture.setValue(DefaultFuture.java:254)

              at io.fabric8.agent.download.impl.AbstractDownloadTask.setFile(AbstractDownloadTask.java:53)

              at io.fabric8.agent.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:41)

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

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

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)

              at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)

              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)

            Caused by: org.osgi.framework.BundleException: Unsupported 'Bundle-ManifestVersion' value: 1

              at io.fabric8.agent.resolver.ResourceBuilder.build(ResourceBuilder.java:72)

              at io.fabric8.agent.resolver.ResourceBuilder.build(ResourceBuilder.java:65)

              at io.fabric8.agent.region.Subsystem.createResource(Subsystem.java:489)

            ... 15 more

             

            the pom file used is this:

             

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

            <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"

                xmlns="http://maven.apache.org/POM/4.0.0"

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

              <modelVersion>4.0.0</modelVersion>

              <groupId>com.mycompany.cbp.dv</groupId>

              <artifactId>demo-cbp-dv</artifactId>

              <version>1.0.0-SNAPSHOT</version>

              <name>demo app </name>

              <url>http://www.demhas.com</url>

              <packaging>bundle</packaging>

              <properties>

             

                <fabric8.profile>demhas-cbp-dv</fabric8.profile>

               

                <fabric8.features>feature-camel</fabric8.features>

                <fabric8.bundles>wrap:mvn:com.oracle/ojdbc6/${ojdbc-version}

                                wrap:mvn:commons-dbcp/commons-dbcp/${commons-dbcp-version}

                                wrap:mvn:org.json/json/${json-version}

                </fabric8.bundles>

             

                     

                <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

                <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

                <activemq-version>5.10.0</activemq-version>

                <jackson-version>2.5.4</jackson-version>

                <json-version>20150729</json-version>

                <json2-version>20140107</json2-version>

                <slf4j-version>1.7.12</slf4j-version>

                <log4j-version>1.2.17</log4j-version>

                <ojdbc-version>11.2.0.4</ojdbc-version>

                <commons-dbcp-version>1.4</commons-dbcp-version>

                <camel-version>2.15.2</camel-version>

               

                <fabic8-version>1.2.0.redhat-133</fabic8-version>

               

              </properties>

             

              <dependencies>

                  <dependency>

                    <groupId>org.ow2.asm</groupId>

                    <artifactId>asm-commons</artifactId>

                    <version>4.1</version>

                    <scope>runtime</scope>

                </dependency>

             

                <dependency>

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

                  <artifactId>camel-core</artifactId>

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

                </dependency>

                <dependency>

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

                  <artifactId>camel-blueprint</artifactId>

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

                </dependency>

                <dependency>

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

                  <artifactId>camel-salesforce</artifactId>

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

                </dependency>

                <dependency>

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

                  <artifactId>camel-http</artifactId>

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

                </dependency>

              

                <dependency>

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

                  <artifactId>camel-jsonpath</artifactId>

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

                </dependency>

             

                <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-api</artifactId>

                  <version>${slf4j-version}</version>

                </dependency>

             

                <dependency>

                  <groupId>org.slf4j</groupId>

                  <artifactId>slf4j-log4j12</artifactId>

                  <version>${slf4j-version}</version>

                </dependency>

             

                <dependency>

                  <groupId>log4j</groupId>

                  <artifactId>log4j</artifactId>

                  <version>${log4j-version}</version>

                </dependency>

             

                <dependency>

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

                  <artifactId>camel-mybatis</artifactId>

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

                </dependency>

               

                <dependency>

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

                  <artifactId>camel-test-blueprint</artifactId>

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

                  <scope>test</scope>

                </dependency>

               

                <dependency>

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

                  <artifactId>camel-test</artifactId>

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

                  <scope>test</scope>

                </dependency>

               

                <dependency>

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

                    <artifactId>camel-jackson</artifactId>

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

                </dependency>    

               

                <dependency>

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

                  <artifactId>camel-jaxb</artifactId>

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

                </dependency>

                   

                    <dependency>

                        <groupId>com.oracle</groupId>

                        <artifactId>ojdbc6</artifactId>

                        <version>${ojdbc-version}</version>

                    </dependency>

             

                <dependency>

                  <groupId>commons-dbcp</groupId>

                  <artifactId>commons-dbcp</artifactId>

                  <version>${commons-dbcp-version}</version>

                </dependency>

             

                    <!-- the ActiveMQ client with connection pooling -->

                <dependency>

                  <groupId>org.apache.activemq</groupId>

                  <artifactId>activemq-client</artifactId>

                  <version>${activemq-version}</version>

                </dependency>

                <dependency>

                  <groupId>org.apache.activemq</groupId>

                  <artifactId>activemq-camel</artifactId>

                  <version>${activemq-version}</version>

                </dependency>

                <dependency>

                  <groupId>org.apache.activemq</groupId>

                  <artifactId>activemq-pool</artifactId>

                  <version>${activemq-version} </version>

                   <scope>provided</scope>

                </dependency>

               

                <!-- Jackson Dependencies -->

                <!--

                <dependency>

                  <groupId>com.fasterxml.jackson.core</groupId>

                  <artifactId>jackson-annotations</artifactId>

                  <version>${jackson-version}</version>

                </dependency>

                <dependency>

                  <groupId>com.fasterxml.jackson.core</groupId>

                  <artifactId>jackson-core</artifactId>

                  <version>${jackson-version}</version>

                </dependency>

                <dependency>

                  <groupId>com.fasterxml.jackson.core</groupId>

                  <artifactId>jackson-databind</artifactId>

                  <version>${jackson-version}</version>

                </dependency>

                 -->

                

                <!-- JSON Dependencies -->

             

                <dependency>

                    <groupId>org.json</groupId>

                    <artifactId>json</artifactId>

                    <version>${json-version}</version>

                </dependency>

             

              </dependencies>

              <repositories>

                <repository>

                  <releases>

                    <enabled>true</enabled>

                  </releases>

                  <snapshots>

                    <enabled>false</enabled>

                  </snapshots>

                  <id>public.fusesource.org</id>

                  <name>FuseSource Public Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/groups/public/</url>

                </repository>

                <repository>

                  <releases>

                    <enabled>true</enabled>

                  </releases>

                  <snapshots>

                    <enabled>false</enabled>

                  </snapshots>

                  <id>release.fusesource.org</id>

                  <name>FuseSource Release Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>

                </repository>

                <repository>

                  <releases>

                    <enabled>true</enabled>

                  </releases>

                  <snapshots>

                    <enabled>false</enabled>

                  </snapshots>

                  <id>ea.fusesource.org</id>

                  <name>FuseSource Community Early Access Release Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/groups/ea</url>

                </repository>

                <repository>

                  <releases>

                    <enabled>false</enabled>

                  </releases>

                  <snapshots>

                    <enabled>true</enabled>

                  </snapshots>

                  <id>snapshot.fusesource.org</id>

                  <name>FuseSource Snapshot Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>

                </repository>

              </repositories>

              <pluginRepositories>

                <pluginRepository>

                  <releases>

                    <enabled>true</enabled>

                  </releases>

                  <snapshots>

                    <enabled>false</enabled>

                  </snapshots>

                  <id>public.fusesource.org</id>

                  <name>FuseSource Public Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/groups/public</url>

                </pluginRepository>

             

                <pluginRepository>

                  <releases>

                    <enabled>true</enabled>

                  </releases>

                  <snapshots>

                    <enabled>false</enabled>

                  </snapshots>

                  <id>release.fusesource.org</id>

                  <name>FuseSource Release Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/repositories/releases</url>

                </pluginRepository>

                <pluginRepository>

                  <releases>

                    <enabled>true</enabled>

                  </releases>

                  <snapshots>

                    <enabled>false</enabled>

                  </snapshots>

                  <id>ea.fusesource.org</id>

                  <name>FuseSource Community Early Access Release Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/groups/ea</url>

                </pluginRepository>

                <pluginRepository>

                  <releases>

                    <enabled>false</enabled>

                  </releases>

                  <snapshots>

                    <enabled>true</enabled>

                  </snapshots>

                  <id>snapshot.fusesource.org</id>

                  <name>FuseSource Snapshot Repository</name>

                  <url>http://repo.fusesource.com/nexus/content/repositories/snapshots</url>

                </pluginRepository>

              </pluginRepositories>

              <build>

                <defaultGoal>install</defaultGoal>

                <plugins>

                  <plugin>

                    <groupId>org.apache.felix</groupId>

                    <artifactId>maven-bundle-plugin</artifactId>

                    <version>2.3.7</version>

                    <extensions>true</extensions>

                    <configuration>

                      <instructions>

                        <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>

                        <Private-Package>com.mycompany.*</Private-Package>

                        <Import-Package>*</Import-Package>

                      </instructions>

                    </configuration>

                  </plugin>

                  <plugin>

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

                    <artifactId>camel-maven-plugin</artifactId>

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

                    <configuration>

                      <useBlueprint>true</useBlueprint>

                    </configuration>

                   </plugin>

                 

             

                     <!-- fabric8 plugin for using deploying via mvn fabric:deploy -->

             

                   <plugin>

                    <groupId>io.fabric8</groupId>

                    <artifactId>fabric8-maven-plugin</artifactId>

                    <version>${fabic8-version}</version>

                  </plugin>

                           

                </plugins>

              </build>

             

            </project>