我已经在这里问了这个问题: https://www.eclipse.org/forums/index.php/t/1098133/
现在,三周后,我希望运气能在stackoverflow上得到回应。
我有一个使用MOXy解析复杂XML的RCP应用程序,带注释的类是由XJC生成的,并且该程序包包含一个ObjectFactory和一个指向MOXy的jaxb.properties。
问题:该应用程序适用于Java8,但是使用Java11启动该应用程序时,我遇到了以下异常:
java.lang.RuntimeException: javax.xml.bind.JAXBException
- with linked exception:
[Exception [EclipseLink-50000] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.JAXBException
Exception Description: The context path mypackage contains no ObjectFactory or jaxb.index, no external metadata was found in properties Map, and sessions.xml was found or was invalid.
Internal Exception: Exception [EclipseLink-7095] (Eclipse Persistence Services - 2.7.4.v20190115-ad5b7c6b2a): org.eclipse.persistence.exceptions.ValidationException
Exception Description: The sessions.xml resource [sessions.xml] was not found on the resource path. Check that the resource name/path and classloader passed to the SessionManager.getSession are correct. The sessions.xml should be included in the root of the application's deployed jar, if the sessions.xml is deployed in a sub-directory in the application's jar ensure that the correct resource path using "/" not "\" is used.]
我的目标平台包含:
我使用Multi-Release:true是为了能够处理Java8与Java9 +。 在主要的MANIFEST.FM中,我需要org.eclipse.persistence.moxy。 在版本9 / OSGI-INF / MANIFEST.FM中,添加导入包:com.sun.xml.bind.v2,javax.xml.bind
要在Eclipse运行配置对话框中启动该应用程序,请切换JRE Java8 vs Java11,然后在“插件”标签中,删除(J8)或添加(J11)com.sun.xml.bind.jaxb-osgi( jaxb-osgi.jar)使其可启动。
有人可以帮忙吗?
致谢 弗兰克