Hello Good Afternoon Guys,
我对Xstream jar有疑问。我正在编写独立的后台进程,它将XML转换为对象。它使用jdk1.6.0_35在我的eclipse中工作我创建了jar文件并使用jdk1.6.27部署在服务器中它无法正常工作。
错误是
java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer
at com.thoughtworks.xstream.converters.reflection.CGLIBEnhancedConverter.canConvert(CGLIBEnhancedConverter.java:67)
at com.thoughtworks.xstream.core.DefaultConverterLookup.lookupConverterForType(DefaultConverterLookup.java:60)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:65)
at com.thoughtworks.xstream.core.TreeUnmarshaller.convertAnother(TreeUnmarshaller.java:59)
at com.thoughtworks.xstream.core.TreeUnmarshaller.start(TreeUnmarshaller.java:142)
at com.thoughtworks.xstream.core.AbstractTreeMarshallingStrategy.unmarshal(AbstractTreeMarshallingStrategy.java:33)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:931)
at com.thoughtworks.xstream.XStream.unmarshal(XStream.java:917)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:861)
at com.thoughtworks.xstream.XStream.fromXML(XStream.java:853)
我的课程路径
<classpathentry kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"/>
<classpathentry kind="var" path="M2_REPO/log4j/log4j/1.2.9/log4j-1.2.9.jar"/>
<classpathentry kind="var" path="M2_REPO/hibernate-entitymanager/ejb3-persistence/3.0/ejb3-persistence-3.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-annotations/3.3.0.ga/hibernate-annotations-3.3.0.ga.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-commons-annotations/3.3.0.ga/hibernate-commons-annotations-3.3.0.ga.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate-core/3.3.2.GA/hibernate-core-3.3.2.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-net/commons-net/3.3/commons-net-3.3.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/mail/mail/1.4/mail-1.4.jar"/>
<classpathentry kind="var" path="M2_REPO/com/snowbound/Snow/1.0/Snow-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/snowbound/snowbndcommon/1.0/snowbndcommon-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar"/>
<classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-simple/1.5.8/slf4j-simple-1.5.8.jar"/>
<classpathentry kind="var" path="M2_REPO/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/transaction/jta/1.1/jta-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/javassist/javassist/3.6.0.GA/javassist-3.6.0.GA.jar"/>
<classpathentry kind="var" path="M2_REPO/jaxen/jaxen/1.1.1/jaxen-1.1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/ibm/as400/jt400/5.4.0.2/jt400-5.4.0.2.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/activation/activation/1.1/activation-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/poi/poi/3.8-beta3/poi-3.8-beta3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-ooxml/3.8-beta3/poi-ooxml-3.8-beta3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-scratchpad/3.8-beta3/poi-scratchpad-3.8-beta3.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-ooxml-schemas/3.8-beta3/poi-ooxml-schemas-3.8-beta3.jar"/>
<classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar"/>
<classpathentry kind="var" path="M2_REPO/asm/asm/3.1/asm-3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/drewnoakes/metadata-extractor/2.4.0-beta-1/metadata-extractor-2.4.0-beta-1.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/xmlbeans/xmlbeans/2.4.0/xmlbeans-2.4.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/ccil/cowan/tagsoup/tagsoup/1.2/tagsoup-1.2.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tika/tika-parsers/0.9/tika-parsers-0.9.jar" sourcepath="/tika-parsers-0.9_SourceDocument"/>
<classpathentry kind="var" path="M2_REPO/org/apache/tika/tika-core/0.9/tika-core-0.9.jar" sourcepath="/tika_0.9_sourceFolder"/>
<classpathentry kind="var" path="M2_REPO/org/apache/pdfbox/fontbox/1.6.0/fontbox-1.6.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/pdfbox/jempbox/1.6.0/jempbox-1.6.0.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/pdfbox/pdfbox/1.6.0/pdfbox-1.6.0.jar" sourcepath="/pdfbox-1.6.0-sourcedoc"/>
<classpathentry kind="var" path="M2_REPO/opensymphony/oscache/2.2/oscache-2.2.jar"/>
<classpathentry kind="var" path="M2_REPO/commons-logging/commons-logging/1.1/commons-logging-1.1.jar"/>
<classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
<classpathentry kind="var" path="M2_REPO/org/hibernate/hibernate3/3.3.1/hibernate3-3.3.1.jar"/>
<classpathentry kind="var" path="M2_REPO/com/nationwide/scs/efile/alerter/1.1/alerter-1.1.jar" sourcepath="/Alert_SRC"/>
<classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45.jar"/>
<classpathentry kind="var" path="M2_REPO/org/bouncycastle/bcmail-jdk16/1.45/bcmail-jdk16-1.45.jar"/>
<classpathentry kind="var" path="M2_REPO/com/itextpdf/iText/5.0.2/iText-5.0.2.jar" sourcepath="/iText_5.0.2_Source_Folder"/>
<classpathentry kind="var" path="M2_REPO/org/bouncycastle/bctsp-jdk16/1.45/bctsp-jdk16-1.45.jar"/>
<classpathentry kind="var" path="M2_REPO/stax/stax/1.2.0/stax-1.2.0.jar"/>
<classpathentry kind="var" path="M2_REPO/com/oracle/ojdbc6/11/ojdbc6-11.jar"/>
<classpathentry kind="var" path="M2_REPO/com/jcraft/jsch/0.1.38/jsch-0.1.38.jar"/>
<classpathentry kind="var" path="M2_REPO/org/apache/poi/poi-excelant/3.8-beta3/poi-excelant-3.8-beta3.jar"/>
<classpathentry kind="var" path="M2_REPO/com/thoughtworks/xstream/xstream/1.3/xstream-1.3.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_35"/>
可能是什么问题?提前致谢。
我已将JDK复制到服务器并尝试了相同的结果。
XStream xstream1 = new XStream(new StaxDriver());
//I tried both Stax and DOM Drivers same result
XStream xstream1 = new XStream(new DomDriver()); //Same result.
xstream1.alias("custom01", ConversionXstreamHelper.class);
//binding between xml elements and class and variables,
................
ConversionXstreamHelper helper = (ConversionXstreamHelper)xstream1.fromXML(line);
答案 0 :(得分:0)
我能够解决这个问题。 Xstream有CGLIB的问题,我已经将CGLIB-NODEP jar文件添加到我的maven构建并构建了Jar,它正在工作
我正在使用XStream 1.3 jar和cglib-nodep2.1_3.jar文件。
谢谢,
CVSR Sarma