通过使用eclipse RCP部署应用程序构建无法使用JAXB

时间:2023-01-12 14:21:38

currently I have build an application using eclipse RCP. The application can create multiple products, save them in an XML file, and the file is loaded inside the application and displayed inside a table. I have used JAXB to marshall and unmarshall the XML-file.

目前我已经使用eclipse RCP构建了一个应用程序。应用程序可以创建多个产品,将它们保存在XML文件中,文件将加载到应用程序中并显示在表中。我使用JAXB来编组和解组XML文件。

the current problem occurs when I want to deploy or export the application. After explorting the application in the log file I get this error:

当我想部署或导出应用程序时,会出现当前问题。在日志文件中探索应用程序后,我收到此错误:

rcp application with XML-file

带有XML文件的rcp应用程序

[Command-Thread]1:CMD_TABLE_CHANGE_PRODUCT_DATA -> command thread started CMD_TABLE_CHANGE_PRODUCT_DATA loading products data Loading data from XML file: C:/temp/myCompanyProductSuite/configuration/org.eclipse.osgi/2/0/.cp/appdata/products.xml Exception: javax.xml.bind.UnmarshalException: Unable to create an instance of com.myCompany.app.model.objects.Product - with linked exception: [java.lang.reflect.InvocationTargetException] com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:740) com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262) com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:705) com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:186) com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:576) com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:555) com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168) com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source) com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source) com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:258) com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229) javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source) javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source) com.myCompany.server.ProductServer.loadProductsFromXMLFile(ProductServer.java:188) com.myCompany.server.ProductServer.loadProductData(ProductServer.java:106) com.myCompany.server.ProductServer.loadProductServerData(ProductServer.java:68) com.myCompany.server.ProductServer.getApplicationProducts(ProductServer.java:83) com.myCompany.app.gui.parts.model.ProductViewerModel.getApplicationProducts(ProductViewerModel.java:65) com.myCompany.app.gui.parts.ProductViewerPart$ProductViewerPartController.handleControlledCommand(ProductViewerPart.java:261) com.myCompany.app.mvc.MVCController$1.run(MVCController.java:106) Loading data from XML file: unmarshalling ended

[Command-Thread] 1:CMD_TABLE_CHANGE_PRODUCT_DATA - >命令线程启动CMD_TABLE_CHANGE_PRODUCT_DATA加载产品数据从XML文件加载数据:C:/temp/myCompanyProductSuite/configuration/org.eclipse.osgi/2/0/.cp/appdata/products.xml异常:javax.xml.bind.UnmarshalException:无法创建com.myCompany.app.model.objects.Product的实例 - 具有链接异常:[java.lang.reflect.InvocationTargetException] com.sun.xml.bind.v2 .runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:740)com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:262)com.sun.xml.bind.v2.runtime .unmarshaller.UnmarshallingContext.createInstance(UnmarshallingContext.java:705)com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:186)com.sun.xml.bind.v2.runtime.unmarshaller .UnmarshallingContext._startElement(UnmarshallingContext.java:576)com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement (UnmarshallingContext.java:555)com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:168)com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown来源)com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(未知来源)com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl $ FragmentContentDriver.next(未知来源)com.sun。或者.gap。 impl.XMLDocumentFragmentScannerImpl.scanDocument(未知来源)com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(未知来源)com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(未知来源) )com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.pa rse(未知来源)com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl $ JAXPSAXParser.parse(未知来源)com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java: 258)com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:229)javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)javax.xml.bind.helpers.AbstractUnmarshallerImpl .unmarshal(未知来源)com.myCompany.server.ProductServer.loadProductsFromXMLFile(ProductServer.java:188)com.myCompany.server.ProductServer.loadProductData(ProductServer.java:106)com.myCompany.server.ProductServer.loadProductServerData(ProductServer。 java:68)com.myCompany.server.ProductServer.getApplicationProducts(ProductServer.java:83)com.myCompany.app.gui.parts.model.ProductViewerModel.getApplicationProducts(ProductViewerModel.java:65)com.myCompany.app.gui。 parts.ProductViewerPart $ ProductViewerPartController.handleControlledCommand(ProductViewerPart.java:261)co m.myCompany.app.mvc.MVCController $ 1.run(MVCController.java:106)从XML文件加载数据:unmarshalling结束

I did not really find a helpul answer on the internet.

我没有在网上找到帮助答案。

I can only assure you that I have included the 3 JAR files (jaxb-api, jaxb-core, jaxb-impl) of JAXB for the deployment inside the manifest of the plugin.

我只能向您保证,我已将JAXB的3个JAR文件(jaxb-api,jaxb-core,jaxb-impl)包含在插件清单中的部署中。

Bundle-ClassPath: .,
 properties/,
 appdata/,
 lib/log4j.jar,
 lib/jaxb-2.2.11/jaxb-api.jar,
 lib/jaxb-2.2.11/jaxb-impl.jar,
 lib/jaxb-2.2.11/jaxb-core.jar,
 lib/jaxb-2.2.11/jaxb-xjc.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy

Can you please advice me what I can do to solve the problem.

能否请您告诉我如何解决问题。

Best Regards, Kais

最诚挚的问候,凯斯

1 个解决方案

#1


0  

I'm also using JAXB in one of my app (JMSToolBox) and I didn't do anything specific for the application (one product + multiple plugins) to work.
I didn't add extra libraries to neither the plugin or product or manifest as you did.
JMSToolBox runs on JDK 7 with eclipse v4.5.2 and JAXB classes (ie javax.xml.bind.* classes) are included within the JRE that I bundle (the JRE) with the application, specifically Oracle/Sun JRE v1.7.0.80 Does your application runs well inside eclipse, ie when started from the eclipse worbench or do you have this problem only when you build/export the application?

我也在我的一个应用程序(JMSToolBox)中使用JAXB,我没有做任何特定的应用程序(一个产品+多个插件)工作。我没有像你那样为插件,产品或清单添加额外的库。 JMSToolBox在JDK 7上运行,带有eclipse v4.5.2和JAXB类(即javax.xml.bind。* classes)包含在我与应用程序捆绑(JRE)的JRE中,特别是Oracle / Sun JRE v1.7.0.80你的应用程序是否在eclipse中运行良好,即从eclipse worbench启动时,或者只有在构建/导出应用程序时才遇到此问题?

#1


0  

I'm also using JAXB in one of my app (JMSToolBox) and I didn't do anything specific for the application (one product + multiple plugins) to work.
I didn't add extra libraries to neither the plugin or product or manifest as you did.
JMSToolBox runs on JDK 7 with eclipse v4.5.2 and JAXB classes (ie javax.xml.bind.* classes) are included within the JRE that I bundle (the JRE) with the application, specifically Oracle/Sun JRE v1.7.0.80 Does your application runs well inside eclipse, ie when started from the eclipse worbench or do you have this problem only when you build/export the application?

我也在我的一个应用程序(JMSToolBox)中使用JAXB,我没有做任何特定的应用程序(一个产品+多个插件)工作。我没有像你那样为插件,产品或清单添加额外的库。 JMSToolBox在JDK 7上运行,带有eclipse v4.5.2和JAXB类(即javax.xml.bind。* classes)包含在我与应用程序捆绑(JRE)的JRE中,特别是Oracle / Sun JRE v1.7.0.80你的应用程序是否在eclipse中运行良好,即从eclipse worbench启动时,或者只有在构建/导出应用程序时才遇到此问题?