Closed GoogleCodeExporter closed 9 years ago
Hello,
This is probably a class loader issue related to OSGi, which I have limited
knowledge of. But I do have one theory, please try the attached snapshot JAR
and let me know if that fixes the issue.
Thanks,
Kevin
Original comment by kevin.s...@gmail.com
on 22 Sep 2012 at 1:44
Attachments:
I'm getting the same exception in an OSGi environment. I'm not using Camel; I'm
just running some simple tests from Eclipse.
I'm importing the package org.beanio and using the public static StreamFactory
newInstance(ClassLoader classLoader) factory method.
The root cause seems to be that BeanIO is using the client-bundle-supplied
classloader to try to load its own resources - in this case,
org/beanio/internal/config/beanio.properties. This fails unless the client
bundle also imports org.beanio.internal.config.
The quick and dirty solution is to make sure all exported BeanIO packages are
imported by the client bundle. That doesn't look like it will be an option for
the original poster, though.
Eric
Original comment by emckenzi...@gmail.com
on 22 Sep 2012 at 6:54
Hi Eric,
Did you try the snapshot JAR I attached? I changed the class loader for
loading the default BeanIO settings file in there to use the same class loader
that loads the Settings class (instead of the user supplied one). I'm hoping
that resolves it... What OSGi environment do you use in Eclipse? I should
probably get one setup :)
Thanks,
Kevin
Original comment by kevin.s...@gmail.com
on 23 Sep 2012 at 2:26
Hi Kevin,
I tried installing the attached jar, while installing as a bundle on Karaf
Container I am getting the following Exception. Can you please look into it.
java.lang.NumberFormatException: For input string: "2-SNAPSHOT"
With the old version I am able to install the bundle without any issues, but
seeing the NullPointerException when I try to install my application on Karaf
Container.
Thanks a lot for the support.
Thanks,
Aravind
Original comment by aravindi...@gmail.com
on 24 Sep 2012 at 6:44
Hi Aravind,
Sorry about that, I didn't release the OSGi bundle-version had to be
".SNAPSHOT" instead of "-SNAPSHOT". Try the attached JAR instead.
Thanks,
Kevin
Original comment by kevin.s...@gmail.com
on 25 Sep 2012 at 1:52
Attachments:
Hi Kevin -
I just tried the jar from your latest post; here's the error I get:
org.beanio.BeanIOException: Failed to load stream factory implementation class
'org.beanio.internal.DefaultStreamFactory'
at org.beanio.StreamFactory.newInstance(StreamFactory.java:335)
at tests.SampleExternalTest.test(SampleExternalTest.java:10)
...
Caused by: java.lang.ClassNotFoundException:
org.beanio.internal.DefaultStreamFactory
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.beanio.StreamFactory.newInstance(StreamFactory.java:329)
...
You'll find that this is again a matter of using the client-bundle classloader.
Regarding Eclipse, I'm just using the Eclipse (3.7.2) Plug-in Development
Environment (PDE) that comes bundled with *some* of the Eclipse download
packages (I'm using the JEE package). I've attached a minimal test project that
I used to produce the error above; you'll need to run it as a JUnit Plug-in
Test to run it in the OSGi container.
Thank you,
Eric
Original comment by emckenzi...@gmail.com
on 25 Sep 2012 at 7:36
Attachments:
Hi Kevin,
I just tried the latest jar and got the same error as Eric.
Thanks,
Aravind
Original comment by aravindi...@gmail.com
on 25 Sep 2012 at 4:16
Hi guys,
Thanks for your patience. And the sample project was really helpful (thanks
Eric!).
Try the attached snapshot JAR. I think I've addressed the remaining class
loading issues in it....
Kevin
Original comment by kevin.s...@gmail.com
on 26 Sep 2012 at 3:14
Attachments:
Hi Kevin -
Just tried the latest JAR...so far, so good!
> Thanks for your patience.
Thank you for being so responsive! I'm glad the sample project was useful.
One more thought on the OSGi front: if your *.internal.* packages are really
intended to be private, a best practice would be to exclude them from the
Export-Package section of your MANIFEST.MF.
Thanks again!
Eric
Original comment by emckenzi...@gmail.com
on 26 Sep 2012 at 8:04
Hi Kevin,
I just tried the latest jar and its all working fine. Thank you for all the
effort you put in to make this work.
As always you are so prompt and responsive. Thanks !!
Thanks,
Aravind
Original comment by aravindi...@gmail.com
on 26 Sep 2012 at 6:24
Original comment by kevin.s...@gmail.com
on 29 Sep 2012 at 8:49
Original issue reported on code.google.com by
aravindi...@gmail.com
on 20 Sep 2012 at 6:34