简体   繁体   中英

NoClassDefFoundError: com/sun/xml/internal/bind/DatatypeConverterImpl using knopfletfish

I am new to ogsi and when I run the bundle in the knopfletfish framework, I obtain this error:

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

I don´t know why is happening this, I have referenced all jabxb jars, and maybe is important saying that it happened since I changed jdk8 by jdk7 in order to work with another jdk7 bundles.

This is the class where the exception is marked:

//
// 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;
    }

}

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

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

use Wrapper classes in Bean with getter and setter. don't use primitive data type in bean class with getter and setter.

wrong: int i;
right: Integer i;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM