问题描述
我正在用oxm xml元数据定义的对象图编组这个问题。
由:java.lang引起。 ClassNotFoundException:未在org.eclipse.persistence.core找到javax.xml.bind.JAXBElement [142] at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl
.java:1532)at
org.apache.felix.framework.BundleWiringImpl.access $ 400(BundleWiringImpl.java:75)at
org.apache.felix.framework.BundleWiringImpl $ BundleClassLoader.loadClass(BundleWiringImpl.jav
a: 1955)
导致:java.lang.NoClassDefFoundError:javax / xml / bind / JAXBElement $ b $在org.eclipse.persistence.internal.oxm.ChoiceUnmarshalContext.getValue(ChoiceUnmarshalContext.java:70 )
如果不使用外部定义的oxm对象图,它就可以运行..
我使用classloader从meta-inf加载xml文件
URL resource1 = this .getClass() 。.getClassLoader()的getResource( META-INF / contactsimpleoxm.xml);
URL resource2 = this.getClass()。getClassLoader()。getResource(META-INF / graph2oxm.xml);
我下载了eclipselink-plugins-2.5.2.v20140319-9ad6abd.zip。
并复制文件:
cp org.eclipse.persistence.antlr_3.2.0.v201302191141.jar / opt / glassfish4 / glassfish / modules / org.eclipse.persistence.antlr.jar
cp org.eclipse.persistence.asm_3.3.1.v201302191223.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.asm。 jar
cp org.eclipse.persistence.core_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.core.jar
cp org.eclipse.persistence。 dbws_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.dbws.jar
cp org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar / opt / glassfish4 / glassfish / modules / org.eclipse.persistence.jpa.jpql.jar
cp org.eclipse.persistence.jpa_2.5.2.v20140319-9ad6abd.jar / opt / glassfish4 / glassfish / modules / org。 eclipse.persistence.jpa.jar
cp org.eclipse.persistence.moxy_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.moxy.jar
cp org.eclipse.pe rsistence.oracle_2.5.1.v20130618-75cdba2.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.oracle.jar
cp javax.persistence_2.1.0.v201304241213.jar / opt / glassfish4 / glassfish / modules / javax.persistence.jar
我清除了osgi-cache并重新编译了glssfgish。 eclipse版本正确地报告为2.5.2我在EclipseLink 2.5.3中解决了这个问题。感谢您报告问题。
I'm having this issue marshaling with an oxm xml meta data defined object graph
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBElement not found by org.eclipse.persistence.core [142] at
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl
.java:1532) at
org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75) at
org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.jav
a:1955)
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBElement
at org.eclipse.persistence.internal.oxm.ChoiceUnmarshalContext.getValue(ChoiceUnmarshalContext.java:70)
Without using an external defined oxm object graph it works..
I'm using the classloader to load the xml file from meta-inf
URL resource1 = this.getClass().getClassLoader().getResource("META-INF/contactsimpleoxm.xml");
URL resource2 = this.getClass().getClassLoader().getResource("META-INF/graph2oxm.xml");
I downloaded eclipselink-plugins-2.5.2.v20140319-9ad6abd.zip.and copied the files:
cp org.eclipse.persistence.antlr_3.2.0.v201302191141.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.antlr.jar
cp org.eclipse.persistence.asm_3.3.1.v201302191223.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.asm.jar
cp org.eclipse.persistence.core_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.core.jar
cp org.eclipse.persistence.dbws_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.dbws.jar
cp org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.jpa.jpql.jar
cp org.eclipse.persistence.jpa_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.jpa.jar
cp org.eclipse.persistence.moxy_2.5.2.v20140319-9ad6abd.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.moxy.jar
cp org.eclipse.persistence.oracle_2.5.1.v20130618-75cdba2.jar /opt/glassfish4/glassfish/modules/org.eclipse.persistence.oracle.jar
cp javax.persistence_2.1.0.v201304241213.jar /opt/glassfish4/glassfish/modules/javax.persistence.jar
I cleared the osgi-cache and restated glssfgish. The eclipse version reports correctly as 2.5.2
I fixed this in EclipseLink 2.5.3. Thanks for reporting the issue.
这篇关于Glassfish 4 moxy eclipselink 2.5.2 oxm对象图形麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!