Hi Aruna,

Thanks a lot. That solved the problem. :) and thanks Thusitha and Kalpa for
the support.


On Tue, Mar 1, 2016 at 4:39 PM, Aruna Karunarathna <ar...@wso2.com> wrote:

> <DynamicImport-Package>*</DynamicImport-Package> is defined wrong.
>
> Try adding
>
> <dynamic.import.package>*</dynamic.import.package>
>
> Refer this [1] for more details.
>
> [1]. https://docs.wso2.com/display/Carbon500/Using+the+Maven+Bundle+Plugin
>
> On Tue, Mar 1, 2016 at 4:24 PM, Anupama Pathirage <anup...@wso2.com>
> wrote:
>
>> Hi,
>>
>> Thanks for the suggestions.
>>
>> I already tried with followings. May be something is wrong in the way I
>> specified them.
>>
>> 1) import the com.mysql.jdbc pacakage
>>
>> <mysql.import.version.range>[5.1.35, 5.1.38)</mysql.import.version.range>
>> com.mysql.jdbc.*;version="${mysql.import.version.range}"
>>
>> 2) Adding dynamic import
>>
>> <DynamicImport-Package>*</DynamicImport-Package>
>>
>> I have attached my pom.xml file herewith.
>>
>>
>>
>> On Tue, Mar 1, 2016 at 3:45 PM, Aruna Karunarathna <ar...@wso2.com>
>> wrote:
>>
>>> 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 <
>>> thusit...@wso2.com> 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 <anup...@wso2.com>
>>>> 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: anup...@wso2.com
>>>>> Mobile:+94 71 8273 979
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Dev mailing list
>>>>> Dev@wso2.org
>>>>> 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
>>>> Dev@wso2.org
>>>> 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: ar...@wso2.com | Web: www.wso2.com
>>>
>>>
>>
>>
>>
>> --
>> Anupama Pathirage
>> Associate Technical Lead
>> WSO2, Inc.  http://wso2.com/
>> Email: anup...@wso2.com
>> Mobile:+94 71 8273 979
>> Blog:http://mycodeideas.blogspot.com/
>>
>>
>>
>
>
> --
>
> *Aruna Sujith Karunarathna *
> WSO2, Inc | lean. enterprise. middleware.
> #20, Palm Grove, Colombo 03, Sri Lanka
> Mobile: +94 71 9040362 | Work: +94 112145345
> Email: ar...@wso2.com | Web: www.wso2.com
>
>



-- 
Anupama Pathirage
Associate Technical Lead
WSO2, Inc.  http://wso2.com/
Email: anup...@wso2.com
Mobile:+94 71 8273 979
Blog:http://mycodeideas.blogspot.com/
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to