1 Reply Latest reply on Jun 13, 2017 6:34 PM by Sebastian Brandt

    How to JDBC DataSource in Fuse6.3

    raja annamalai Newbie

      Hi,

        Im completely new to fuse.Im trying to create datasource. The Datasource works fine as Camel standalone Application.

      Im using ANT for build task(not maven).

       

      Fuse DataSource:

      <bean id="ds" class="org.apache.commons.dbcp.BasicDataSource">

          <property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerConnection"/>            

          <property name="url" value="${dburl}"/>

          <property name="username" value="${dbuname}"/>

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

      </bean>

       

      In camel I used "org.springframework.jdbc.datasource.SimpleDriverDataSource" as class.

       

      When I convert it to blueprint and deploy it in the Fuse following error Shows:

       

      2017-06-08 10:17:07,617 | ERROR | l Console Thread | BlueprintContainerImpl       | 23 - org.apache.aries.blueprint.core - 1.4.5 | Unable to start blueprint container for bundle name.jar/0.0.0

      org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to load class org.apache.commons.dbcp.BasicDataSource from recipe BeanRecipe[name='ds']

          at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:195)

          at org.apache.aries.blueprint.di.AbstractRecipe.loadType(AbstractRecipe.java:161)

          at org.apache.aries.blueprint.container.BeanRecipe.loadClass(BeanRecipe.java:250)

          at org.apache.aries.blueprint.container.BeanRecipe.getType(BeanRecipe.java:917)

          at org.apache.aries.blueprint.container.BeanRecipe.getInstanceFromType(BeanRecipe.java:341)

          at org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:282)

          at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:830)

          at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)

          at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)

          at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]

          at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)

          at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:247)

          at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:183)

          at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:688)

          at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:383)

          at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:270)

          at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:294)

          at org.apache.aries.blueprint.container.BlueprintExtender.createContainer(BlueprintExtender.java:263)

          at org.apache.aries.blueprint.container.BlueprintExtender.modifiedBundle(BlueprintExtender.java:253)

          at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:500)[17:org.apache.aries.util:1.1.0]

          at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.customizerModified(BundleHookBundleTracker.java:433)[17:org.apache.aries.util:1.1.0]

          at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$AbstractTracked.track(BundleHookBundleTracker.java:725)[17:org.apache.aries.util:1.1.0]

          at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$Tracked.bundleChanged(BundleHookBundleTracker.java:463)[17:org.apache.aries.util:1.1.0]

          at org.apache.aries.util.tracker.hook.BundleHookBundleTracker$BundleEventHook.event(BundleHookBundleTracker.java:422)

          at org.apache.felix.framework.util.SecureAction.invokeBundleEventHook(SecureAction.java:1127)

          at org.apache.felix.framework.util.EventDispatcher.createWhitelistFromHooks(EventDispatcher.java:696)

          at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:484)

          at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:4429)

          at org.apache.felix.framework.Felix.startBundle(Felix.java:2100)

          at org.apache.felix.framework.Felix.updateBundle(Felix.java:2412)

          at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:994)

          at org.apache.felix.framework.BundleImpl.update(BundleImpl.java:981)

          at org.apache.karaf.util.bundles.BundleUtils.update(BundleUtils.java:43)

          at org.apache.karaf.util.bundles.BundleUtils.update(BundleUtils.java:36)

          at org.apache.karaf.shell.osgi.UpdateBundle.doExecute(UpdateBundle.java:37)

          at org.apache.karaf.shell.osgi.BundleCommand.doExecute(BundleCommand.java:41)

          at org.apache.karaf.shell.console.OsgiCommandSupport.execute(OsgiCommandSupport.java:38)

          at org.apache.felix.gogo.commands.basic.AbstractCommand.execute(AbstractCommand.java:35)

          at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[:1.8.0_121]

          at java.lang.reflect.Method.invoke(Method.java:498)[:1.8.0_121]

          at org.apache.aries.proxy.impl.ProxyHandler$1.invoke(ProxyHandler.java:54)[19:org.apache.aries.proxy.impl:1.0.5]

          at org.apache.aries.proxy.impl.ProxyHandler.invoke(ProxyHandler.java:119)[19:org.apache.aries.proxy.impl:1.0.5]

          at org.apache.karaf.shell.console.commands.$BlueprintCommand2065848678.execute(Unknown Source)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:78)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:477)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:403)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:92)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.karaf.shell.console.jline.Console.run(Console.java:197)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

          at org.apache.karaf.shell.console.jline.DelayedStarted.run(DelayedStarted.java:79)[38:org.apache.karaf.shell.console:2.4.0.redhat-630187]

      Caused by: java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource not found by camelEmail.jar [335]

          at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1556)

          at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:77)

          at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1993)

          at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_121]

          at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1853)

          at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:958)

          at org.apache.aries.blueprint.container.BlueprintContainerImpl.loadClass(BlueprintContainerImpl.java:439)

          at org.apache.aries.blueprint.container.BlueprintRepository.loadClass(BlueprintRepository.java:410)

          at org.apache.aries.blueprint.container.GenericType.parse(GenericType.java:113)

          at org.apache.aries.blueprint.di.AbstractRecipe.doLoadType(AbstractRecipe.java:168)

          ... 52 more

       

       

      I also tried to wrap using:

      osgi:install -s wrap:mvn:commons-dbcp/commons-dbcp/1.4

      wrap result:

      >osgi:list

      [ 338] [Active ] [        ] [   ] [   80] Commons DBCP (1.4)

       

       

      How to resolve this problem?

        • 1. Re: How to JDBC DataSource in Fuse6.3
          Sebastian Brandt Newbie

          Can you try adding org.apache.commons.dbcp and com.microsoft.sqlserver.jdbc to <Import-Package> in the maven-bundle-plugin config in your POM?

          You would also need to deploy the SQL Server JDBC driver.

           

          <build>

            <plugins>

              <plugin>

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

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

                <extensions>true</extensions>

                  <configuration>

                    <instructions>

                      <Import-Package>org.apache.commons.dbcp, com.microsoft.sqlserver.jdbc</Import-Package>

                    </instructions>

                  </configuration>

              </plugin>

          [...]