Exception when deploying Web service : "Two classes have the same XML type name"
Issue
- "Two classes have the same XML type name" exception when deploying web service:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://com.company.webservice.com/}createAccountResponse". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.company.webservice.account.message.CreateAccountResponse
at private com.company.webservice.account.message.CreateAccountResponse com.company.webservice.jaxws.CreateAccountResponse._return
at com.company.webserivce.jaxws.CreateAccountResponse
this problem is related to the following location:
at com.company.webservice.jaxws.CreateAccountResponse
...
at com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:448)
at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:297)
at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
at com.sun.xml.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:105)
at org.jboss.ws.core.jaxws.CustomizableJAXBContextFactory.createContext(CustomizableJAXBContextFactory.java:108)
... 40 more
- The following is my web service code:
@Stateless
@WebService()
public class AccountWS {
@WebMethod()
public CreateAccountResponse createAccount(@WebParam(name = "request") CreateAccountRequest request)
{
return null;
}
}
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.0.1
- JBossWS-Native
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.