1 Reply Latest reply on Jul 31, 2009 3:38 AM by vector_jdev.work

    org.springframework.jdbc - ClassNotFoundException

    Peter Chandler Master

      Related to:

      http://fusesource.com/forums/thread.jspa?messageID=3801&#3801

       

      My bundle requires:

      org.springframework.jdbc.datasource

       

      What I tries:

      1. Download and start the springJdbc bundle in serviceMix. Import the springJdbc bundle into my bundle.

      2. Create a local bundle-classpath add springJdbc,

      3. Export org.springframework.jdbc.datasource

      4. Add org.springframework.jdbc.datasource to class list in etc/config.properties 

       

      I can't resolve org.springframework.jdbc. Any suggestions please?

       

      Peter.

       

      smx@root:osgi> start 306

      org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class for bean with name 'defaultOracleDatasource' defined in file /export/home/machine/1/user/programs/fuse-esb-4.1.0.1/dbConnectionInfo.xml; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource not found from bundle

              at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1141)

              at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1105)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:386)

              at java.security.AccessController.doPrivileged(Native Method)

              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

              at com.my.class.spring.LoadDataSource.createDataSource(LoadDataSource.java:28)

              at com.my.classpersistance.DBServiceImpl.getDBCapabilities(DBServiceImpl.java:156)

              at com.my.classservice.WFSServiceImpl.getCapabilitiesXML(WFSServiceImpl.java:72)

              at com.my.classservice.WFSServiceImpl.getCapabilities(WFSServiceImpl.java:80)

              at com.my.classservice.test.Activator.start(Activator.java:56)

              at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)

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

              at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:770)

              at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:751)

              at org.apache.servicemix.kernel.gshell.osgi.StartBundle.doExecute(StartBundle.java:24)

              at org.apache.servicemix.kernel.gshell.osgi.BundleCommand.doExecute(BundleCommand.java:74)

              at org.apache.servicemix.kernel.gshell.core.OsgiCommandSupport.execute(OsgiCommandSupport.java:48)

              at org.apache.geronimo.gshell.wisdom.command.CommandSupport.executeAction(CommandSupport.java:303)

              at org.apache.geronimo.gshell.wisdom.command.StatefulCommand.executeAction(StatefulCommand.java:94)

              at org.apache.geronimo.gshell.wisdom.command.CommandSupport.execute(CommandSupport.java:194)

              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

              at java.lang.reflect.Method.invoke(Method.java:597)

              at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:64)

              at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:78)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)

              at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invokeUnprivileged(ServiceTCCLInterceptor.java:57)

              at org.springframework.osgi.service.util.internal.aop.ServiceTCCLInterceptor.invoke(ServiceTCCLInterceptor.java:40)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)

              at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)

              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)

              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)

              at $Proxy16.execute(Unknown Source)

              at org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl.doExecute(CommandLineExecutorImpl.java:127)

              at org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl.execute(CommandLineExecutorImpl.java:106)

              at org.apache.geronimo.gshell.parser.visitor.ExecutingVisitor$1.run(ExecutingVisitor.java:208)

              at org.apache.geronimo.gshell.parser.visitor.ExecutingVisitor.executePiped(ExecutingVisitor.java:231)

              at org.apache.geronimo.gshell.parser.visitor.ExecutingVisitor.visit(ExecutingVisitor.java:107)

              at org.apache.geronimo.gshell.parser.ASTExpression.jjtAccept(ASTExpression.java:17)

              at org.apache.geronimo.gshell.parser.SimpleNode.childrenAccept(SimpleNode.java:61)

              at org.apache.geronimo.gshell.parser.visitor.ExecutingVisitor.visit(ExecutingVisitor.java:90)

              at org.apache.geronimo.gshell.parser.ASTCommandLine.jjtAccept(ASTCommandLine.java:17)

              at org.apache.geronimo.gshell.wisdom.shell.CommandLineBuilderImpl$1.execute(CommandLineBuilderImpl.java:96)

              at org.apache.geronimo.gshell.wisdom.shell.CommandLineExecutorImpl.execute(CommandLineExecutorImpl.java:71)

              at org.apache.geronimo.gshell.wisdom.shell.ShellImpl.execute(ShellImpl.java:172)

              at org.apache.geronimo.gshell.wisdom.shell.ShellImpl$2.execute(ShellImpl.java:208)

              at org.apache.geronimo.gshell.console.Console.work(Console.java:187)

              at org.apache.geronimo.gshell.console.Console.run(Console.java:128)

              at org.apache.geronimo.gshell.wisdom.shell.ShellImpl.run(ShellImpl.java:252)

              at org.apache.servicemix.kernel.gshell.core.ShellWrapper.run(ShellWrapper.java:81)

              at org.apache.servicemix.kernel.gshell.core.LocalConsole.run(LocalConsole.java:125)

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

      Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource not found from bundle

              at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)

              at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

              at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)

              at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)

              at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)

              ... 63 more

      Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.DriverManagerDataSource

              at org.apache.felix.framework.searchpolicy.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:558)

              at org.apache.felix.framework.searchpolicy.ModuleImpl.access$100(ModuleImpl.java:59)

              at org.apache.felix.framework.searchpolicy.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1427)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:252)

              at org.apache.felix.framework.searchpolicy.ModuleImpl.getClassByDelegation(ModuleImpl.java:421)

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

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

              at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)

              ... 68 more

      smx@root:osgi>

        • 1. Re: org.springframework.jdbc - ClassNotFoundException
          vector_jdev.work Newbie

          Let me explain some things about using spring-jdbc in your bundle. You should do the following:

          1. Check the spring bundles&their versions installed in your esb by typing osgi list | grep Spring

          2. Go to  Spring Bundles Repository and install the same version of spring-jdbc bundle. You also need to install its dependencies(transaction, logging, ...), check this at bundle's description page.

          3. You need only import required org.springframework.jdbc packages via manifest. No need to export anything or change etc/config.properties

          4. You're likely need to import your DB driver package via manifest. Even if you're not using it's directly, spring-jdbc will use it. You must need this driver installed as bundle in fuse.

          5. Attach the content of  /export/home/machine/1/user/programs/fuse-esb-4.1.0.1/dbConnectionInfo.xml in the next post.

          6. Connecting to DB is not a nuclear physics, many people did it, so just check everything and let us know the results.