Hallo,
ich habe folgendes Problem: Ich möchte einen Webservice implementieren, welcher zwei Listen einliest und eine andere ausgibt. Problem ist, dass ich beim ausführen folgende Exception aus den Klassen, welche ich mit wsimport erstellt habe. Die Fehlermeldung ist unten als Zitat angehängt. Es geht wohl um die markierten Zeilen. Die Klassen erben von einander, aber waum sollen die Namen den gleich sein?
Vielen Dank im Voraus!
Hier die Klassen. Als erstes steht der Client, dann die wsimport-Klassen. Auf den Webservice verzichte ich:
Fehlermeldung ist:
ich habe folgendes Problem: Ich möchte einen Webservice implementieren, welcher zwei Listen einliest und eine andere ausgibt. Problem ist, dass ich beim ausführen folgende Exception aus den Klassen, welche ich mit wsimport erstellt habe. Die Fehlermeldung ist unten als Zitat angehängt. Es geht wohl um die markierten Zeilen. Die Klassen erben von einander, aber waum sollen die Namen den gleich sein?
Vielen Dank im Voraus!
Hier die Klassen. Als erstes steht der Client, dann die wsimport-Klassen. Auf den Webservice verzichte ich:
Code:
package Client;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import com.chrisws.Webservice;
import com.chrisws.WebserviceService;
import com.chrisws.*;
public class Client {
public static void main( String[] args )
{//com.chrisws.wieso??? Wieso nimmt er nicht die List aus dem util?
LinkedList<Integer> notenliste = new LinkedList<Integer>();
List<Integer> inhalt1 = Arrays.asList(767610,100,767611, 50);
notenliste.addAll(inhalt1);
LinkedList<Integer> punkteliste = new LinkedList<Integer>();
List<Integer> inhalt2 = Arrays.asList(1,95,2, 75, 3, 65, 4, 50,5,10);
punkteliste.addAll(inhalt2);
Webservice port = new WebserviceService().getWebservicePort();
System.out.printf("Die Ergebnisse der Klausur",
port.webservice(notenliste, punkteliste)
);
}
}
Code:
package com.chrisws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für abstractCollection complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="abstractCollection">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "abstractCollection") <--Hier-->
@XmlSeeAlso({
AbstractList.class
})
public abstract class AbstractCollection {
}
Code:
package com.chrisws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für abstractList complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="abstractList">
* <complexContent>
* <extension base="{http://Server/}abstractCollection">
* <sequence>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "abstractList") <--Hier-->
@XmlSeeAlso({
AbstractSequentialList.class
})
public abstract class AbstractList
extends AbstractCollection
{
}
</Java>
<Java>
package com.chrisws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für abstractSequentialList complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="abstractSequentialList">
* <complexContent>
* <extension base="{http://Server/}abstractList">
* <sequence>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "abstractSequentialList") <--Hier-->
@XmlSeeAlso({
LinkedList.class
})
public abstract class AbstractSequentialList
extends AbstractList
{
}
Code:
package com.chrisws;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java-Klasse für linkedList complex type.
*
* <p>Das folgende Schemafragment gibt den erwarteten Content an, der in dieser Klasse enthalten ist.
*
* <pre>
* <complexType name="linkedList">
* <complexContent>
* <extension base="{http://Server/}abstractSequentialList">
* <sequence>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "linkedList") <--Hier-->
public class LinkedList
extends AbstractSequentialList
{
}
Code:
package com.chrisws;
import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
* generated in the com.chrisws package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
* content can consist of schema derived interfaces
* and classes representing the binding of schema
* type definitions, element declarations and model
* groups. Factory methods for each of these are
* provided in this class.
*
*/
@XmlRegistry
public class ObjectFactory {
/**
* Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: com.chrisws
*
*/
public ObjectFactory() {
}
/**
* Create an instance of {@link LinkedList }
*
*/
public LinkedList createLinkedList() {
return new LinkedList();
}
}
Code:
@javax.xml.bind.annotation.XmlSchema(namespace = "http://Server/")
package com.chrisws;
Fehlermeldung ist:
Exception in thread "main" com.sun.xml.internal.ws.spi.db.DatabindingException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}abstractCollection". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.AbstractCollection
at com.chrisws.AbstractList
at com.chrisws.AbstractSequentialList
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.AbstractCollection
at java.util.AbstractList
at java.util.AbstractSequentialList
at java.util.LinkedList
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}abstractList". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.AbstractList
at com.chrisws.AbstractSequentialList
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.AbstractList
at java.util.AbstractSequentialList
at java.util.LinkedList
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}abstractSequentialList". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.AbstractSequentialList
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.AbstractSequentialList
at java.util.LinkedList
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}linkedList". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.LinkedList
at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextFactory.newContext(Unknown Source)
at com.sun.xml.internal.ws.spi.db.BindingContextFactory.create(Unknown Source)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(Unknown Source)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(Unknown Source)
at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(Unknown Source)
at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
at javax.xml.ws.Service.getPort(Unknown Source)
at com.chrisws.WebserviceService.getWebservicePort(WebserviceService.java:72)
at Client.Client.main(Client.java:24)
Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}abstractCollection". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.AbstractCollection
at com.chrisws.AbstractList
at com.chrisws.AbstractSequentialList
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.AbstractCollection
at java.util.AbstractList
at java.util.AbstractSequentialList
at java.util.LinkedList
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}abstractList". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.AbstractList
at com.chrisws.AbstractSequentialList
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.AbstractList
at java.util.AbstractSequentialList
at java.util.LinkedList
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}abstractSequentialList". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.AbstractSequentialList
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.AbstractSequentialList
at java.util.LinkedList
Zwei Klassen haben denselben XML-Typnamen"{http://Server/}linkedList". Verwenden Sie @XmlType.name und @XmlType.namespace, um ihnen unterschiedliche Namen zuzuweisen.
this problem is related to the following location:
at com.chrisws.LinkedList
at public com.chrisws.LinkedList com.chrisws.ObjectFactory.createLinkedList()
at com.chrisws.ObjectFactory
this problem is related to the following location:
at java.util.LinkedList
at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.<init>(Unknown Source)
at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(Unknown Source)
at com.sun.xml.internal.bind.v2.ContextFactory.createContext(Unknown Source)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(Unknown Source)
at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(Unknown Source)
at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(Unknown Source)
... 21 more