Hi Anupama, Since you are doing a class.forName();, you have to do dynamic import package.
Can you try adding that to your pom.xml? Regards, Aruna On Tue, Mar 1, 2016 at 2:54 PM, Thusitha Thilina Dayaratne < [email protected]> wrote: > Hi Anupama, > > Are you importing the com.mysql.jdbc package inside your bundle which > uses mysql? > > Thanks > Thusitha > > On Tue, Mar 1, 2016 at 2:49 PM, Anupama Pathirage <[email protected]> > wrote: > >> Hi, >> >> I need to query MySQL database with Carbon 5 based product and I added >> the mysql-connector-java-5.1.35.jar [1] file to the osgi/droppings >> directory. Since the jar file is already an osgi bundle I copied it >> directly to osgi/droppings folder. >> >> But when I load the class as below it gives the >> java.lang.ClassNotFoundException. >> >> Class.forName("com.mysql.jdbc.Driver"); >> >> Is there any missing step I followed which can cause this error? >> >> >> java.lang.ClassNotFoundException: com.mysql.jdbc.Driver cannot be found >> by org.wso2.carbon.ibus_1.0.0.SNAPSHOT >> at >> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:432) >> at >> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:345) >> at >> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:337) >> at >> org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160) >> at java.lang.ClassLoader.loadClass(ClassLoader.java:357) >> at java.lang.Class.forName0(Native Method) >> at java.lang.Class.forName(Class.java:264) >> at org.wso2.carbon.ibus.Activator.start(Activator.java:55) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319) >> at org.eclipse.osgi.container.Module.doStart(Module.java:571) >> at org.eclipse.osgi.container.Module.start(Module.java:439) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412) >> at >> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.startBundles(ConfigApplier.java:438) >> at >> org.eclipse.equinox.internal.simpleconfigurator.ConfigApplier.install(ConfigApplier.java:111) >> at >> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:191) >> at >> org.eclipse.equinox.internal.simpleconfigurator.SimpleConfiguratorImpl.applyConfiguration(SimpleConfiguratorImpl.java:205) >> at >> org.eclipse.equinox.internal.simpleconfigurator.Activator.start(Activator.java:60) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1) >> at java.security.AccessController.doPrivileged(Native Method) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764) >> at >> org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319) >> at org.eclipse.osgi.container.Module.doStart(Module.java:571) >> at org.eclipse.osgi.container.Module.start(Module.java:439) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:393) >> at >> org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:412) >> at >> org.wso2.carbon.launcher.CarbonServer.loadInitialBundles(CarbonServer.java:243) >> at org.wso2.carbon.launcher.CarbonServer.start(CarbonServer.java:84) >> at org.wso2.carbon.launcher.Main.main(Main.java:83) >> >> >> [1] http://mvnrepository.com/artifact/mysql/mysql-connector-java/5.1.35 >> >> >> Thanks. >> -- >> Anupama Pathirage >> Associate Technical Lead >> WSO2, Inc. http://wso2.com/ >> Email: [email protected] >> Mobile:+94 71 8273 979 >> >> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > Thusitha Dayaratne > Software Engineer > WSO2 Inc. - lean . enterprise . middleware | wso2.com > > Mobile +94712756809 > Blog alokayasoya.blogspot.com > About http://about.me/thusithathilina > > > _______________________________________________ > Dev mailing list > [email protected] > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Aruna Sujith Karunarathna * WSO2, Inc | lean. enterprise. middleware. #20, Palm Grove, Colombo 03, Sri Lanka Mobile: +94 71 9040362 | Work: +94 112145345 Email: [email protected] | Web: www.wso2.com
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
