使用knopfletfish的NoClassDefFoundError:com / sun / xml / internal / bind / DatatypeConverterImpl

时间:2016-10-14 09:46:36

标签: java jaxb osgi knopflerfish

我是ogsi的新手,当我在knopfletfish框架中运行bundle时,我得到了这个错误:

Exception in thread "Thread-17" [stderr] java.lang.NoClassDefFoundError: com/sun/xml/internal/bind/DatatypeConverterImpl
[stderr]    at eu.datex2.schema._2_0._2_3.IntermediatePointOnLinearElement_JaxbXducedAccessor_index.parse(TransducedAccessor_field_Integer.java:57)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:195)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.ProxyLoader.startElement(ProxyLoader.java:45)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:559)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153)
[stderr]    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
[stderr]    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:380)
[stderr]    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2781)
[stderr]    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:606)
[stderr]    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:118)
[stderr]    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:504)
[stderr]    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:848)
[stderr]    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:777)
[stderr]    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
[stderr]    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
[stderr]    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
[stderr]    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
[stderr]    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
[stderr]    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:162)
[stderr]    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171)
[stderr]    at core.Transformer.<init>(Transformer.java:57)
[stderr]    at datexdenm.Activator.run(Activator.java:42)
[stderr] Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.bind.DatatypeConverterImpl
[stderr]    at org.knopflerfish.framework.BundleClassLoader.findClass(BundleClassLoader.java:177)
[stderr]    at org.knopflerfish.framework.BundleClassLoader.loadClass(BundleClassLoader.java:306)
[stderr]    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
[stderr]    ... 24 more

我不知道为什么会发生这种情况,我已经引用了所有的jabxb jar,也许很重要的说它发生了,因为我用jdk7更改了jdk8以便与另一个jdk7包一起工作。

这是标记例外的类:

//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
// Any modifications to this file will be lost upon recompilation of the source schema. 
// Generated on: 2016.08.31 at 09:49:57 AM CEST 
//


package eu.datex2.schema._2_0._2_3;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.DatatypeConverter; //not used


/**
 * <p>Java class for _IntermediatePointOnLinearElement complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="_IntermediatePointOnLinearElement">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="referent" type="{http://datex2.eu/schema/2/2_0}Referent"/>
 *       &lt;/sequence>
 *       &lt;attribute name="index" use="required" type="{http://www.w3.org/2001/XMLSchema}int" />
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "_IntermediatePointOnLinearElement", propOrder = {
    "referent"
})
public class IntermediatePointOnLinearElement {

    @XmlElement(required = true)
    protected Referent referent;
    @XmlAttribute(name = "index", required = true)
    protected int index;

    /**
     * Gets the value of the referent property.
     * 
     * @return
     *     possible object is
     *     {@link Referent }
     *     
     */
    public Referent getReferent() {
        return referent;
    }

    /**
     * Sets the value of the referent property.
     * 
     * @param value
     *     allowed object is
     *     {@link Referent }
     *     
     */
    public void setReferent(Referent value) {
        this.referent = value;
    }

    /**
     * Gets the value of the index property.
     * 
     */
    public int getIndex() {
        return index;
    }

    /**
     * Sets the value of the index property.
     * 
     */
    public void setIndex(int value) {
        this.index = value;
    }

}

2 个答案:

答案 0 :(得分:3)

我认为您需要将com.sun软件包添加到引导委派中。

org.osgi.framework.bootdelegation=com.sun.*

答案 1 :(得分:0)

使用Bean中的Wrapper类与getter和setter。 不要在bean类中使用带有getter和setter的原始数据类型。

错误:int i;
右:Integer i;