(no subject) [message #693255] |
Wed, 06 July 2011 02:13  |
Eclipse User |
|
|
|
Hi,
I try to setup the wiki.eclipse.org/EclipseLink/Examples/MOXy/GettingStarted as an OSGI bundle.
MANIFEST.MF:
Require-Bundle: javax.xml.bind;bundle-version="2.2.0",
org.eclipse.persistence.moxy;bundle-version="2.1.3"
Launch configuration:
org.eclipse.persistence.core startlevel 2 auto-start true
my bundle startlevel 3 auto-start true
When running equinox I get the exception:
javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:330)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:565)
What do I miss here? How do I have to setup my bundle project when using MOXy in an OSGI bundle?
Regards,
Michael
|
|
|
|
|
|
|
|
|
|
|
|
Re: (no subject) [message #693936 is a reply to message #693927] |
Thu, 07 July 2011 10:04  |
Eclipse User |
|
|
|
This is interesting!
I tried three different calls, only the first of them works:
JAXBContext jaxbContext = JAXBContext.newInstance(
"org.jessas.annotator.jaxb.moxy",
Customer.class.getClassLoader());
These two
JAXBContext jaxbContext = JAXBContext.newInstance(
Customer.class, Address.class, PhoneNumber.class);
JAXBContext jaxbContext = JAXBContext.newInstance(new Class[] {
Customer.class, Address.class, PhoneNumber.class },
Collections.<String, Object> emptyMap());
both result in
javax.xml.bind.JAXBException
- with linked exception:
[java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory]
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:186)
at javax.xml.bind.ContextFinder.find(ContextFinder.java:330)
at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:618)
at org.jessas.annotator.jaxb.Activator.doit(Activator.java:77)
at org.jessas.annotator.jaxb.Activator.start(Activator.java:33)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:783)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:774)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:755)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:370)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.resume(AbstractBundle.java:374)
at org.eclipse.osgi.framework.internal.core.Framework.resumeBundle(Framework.java:1067)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:561)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.resumeBundles(StartLevelManager.java:546)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.incFWSL(StartLevelManager.java:459)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.doSetStartLevel(StartLevelManager.java:243)
at org.eclipse.osgi.framework.internal.core.StartLevelManager.dispatchEvent(StartLevelManager.java:440)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:337)
Caused by: java.lang.ClassNotFoundException: org.eclipse.persistence.jaxb.JAXBContextFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at org.eclipse.core.runtime.internal.adaptor.ContextFinder.loadClass(ContextFinder.java:129)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
at javax.xml.bind.ContextFinder.safeLoadClass(ContextFinder.java:480)
at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:184)
... 18 more
Anyway. I see how easy it is to use moxy and am happy to provide the ClassLoader by hand. This way I can use it in my bundle an proceed with my requirements.
Thank you for your kind support.
Regards,
Michael
|
|
|
(no subject) [message #693939 is a reply to message #693739] |
Thu, 07 July 2011 09:48  |
Eclipse User |
|
|
|
When you pass an array of classes the classloader used by the JAXB bootstrap classes is obtained from the classes themselves. So this means that the domain classes' bundle would need to have visibility to MOXy. Again, JAXB wasn't designed for OSGi so the API isn't ideal.
--Shaun
|
|
|
Powered by
FUDForum. Page generated in 0.15787 seconds