Skip to main content

"Two classes have the same XML type name" - error when deploying in Tomcat

4 replies [Last post]
johnyboyd
Offline
Joined: 2008-02-22
Points: 0

We have developed a web services interface to a third party app using metro. If I use this code within a standalone java program, everything works fine - we're able to succesfully communicate with the other app. However, when I include this code in a webapp and deploy into tomcat, I get the following error:

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "address". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address javax.xml.ws.wsaddressing.W3CEndpointReference.address
at javax.xml.ws.wsaddressing.W3CEndpointReference
Two classes have the same XML type name "elements". Use @XmlType.name and @XmlType.namespace to assign different names to them.
this problem is related to the following location:
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
at public com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
this problem is related to the following location:
at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
at javax.xml.ws.wsaddressing.W3CEndpointReference

com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:286)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)
com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)
java.security.AccessController.doPrivileged(Native Method)
com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)
com.sun.xml.ws.spi.ProviderImpl.(ProviderImpl.java:88)
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
java.lang.reflect.Constructor.newInstance(Constructor.java:494)
java.lang.Class.newInstance0(Class.java:350)
java.lang.Class.newInstance(Class.java:303)
javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
javax.xml.ws.spi.Provider.provider(Provider.java:83)
javax.xml.ws.Service.(Service.java:56)
com.itron.ami._2008._10.lan.LanService.(ItronService.java:42)
com.comverge.lms.itronws.client.Lan2WS.open(Unknown Source)
com.comverge.commreg.action.LoginAction.perform(Unknown Source)
org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

I am using Tomcat 5.5.27, JDK1.5, on a Mac.
Now, the error message is implicating two classes -
com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
and
javax.xml.ws.wsaddressing.W3CEndpointReference$Address
Both of which are in the Metro libraries.

So, doesn't seem to be even related to the application.

Any help, greatly appreciated.
thanx
-jb

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
aashishdalmia
Offline
Joined: 2007-09-20
Points: 0

Hi,

I was getting the same error and I was using netbeans.
In my netbeans project property libraries option, I had checked the JAXWS-2.1 option(check box is for building checked libraries).

Once I unchecked the JaxWS library box and rebuild the project and deployed it to tomcat server, it worked like a charm.

So, the error message basically says that the server found 2 counts of IlligalAnnotaion .... which means that either you already have the jaxws libraries in the server libs or there is another project that contains this library and is already deployed to the server.

Hope this Helps.

Thanks
Aashish Dalmia

joe_roberts_z
Offline
Joined: 2009-06-09
Points: 0

Hi, I am too having the same problem. However, I am using WAS 7.0. Did you resolve the error and how? I am also using Metro 2.0.

Thanks,

Joe

as2

For future (and google) reference:

Running tomcat with java 1.6 solved the problem for me.

metro-3 wrote:
>
> We have developed a web services interface to a third party app using
> metro. If I use this code within a standalone java program, everything
> works fine - we're able to succesfully communicate with the other app.
> However, when I include this code in a webapp and deploy into tomcat, I
> get the following error:
>
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 2 counts of
> IllegalAnnotationExceptions
> Two classes have the same XML type name "address". Use @XmlType.name and
> @XmlType.namespace to assign different names to them.
> this problem is related to the following location:
> at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
> at public
> com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
> com.sun.xml.ws.developer.MemberSubmissionEndpointReference.addr
> at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
> this problem is related to the following location:
> at javax.xml.ws.wsaddressing.W3CEndpointReference$Address
> at private javax.xml.ws.wsaddressing.W3CEndpointReference$Address
> javax.xml.ws.wsaddressing.W3CEndpointReference.address
> at javax.xml.ws.wsaddressing.W3CEndpointReference
> Two classes have the same XML type name "elements". Use @XmlType.name and
> @XmlType.namespace to assign different names to them.
> this problem is related to the following location:
> at com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
> at public
> com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Elements
> com.sun.xml.ws.developer.MemberSubmissionEndpointReference.referenceProperties
> at com.sun.xml.ws.developer.MemberSubmissionEndpointReference
> this problem is related to the following location:
> at javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
> at private javax.xml.ws.wsaddressing.W3CEndpointReference$Elements
> javax.xml.ws.wsaddressing.W3CEndpointReference.referenceParameters
> at javax.xml.ws.wsaddressing.W3CEndpointReference
>
>
> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:102)
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:438)
>
> com.sun.xml.bind.v2.runtime.JAXBContextImpl.(JAXBContextImpl.java:286)
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:139)
> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:117)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> java.lang.reflect.Method.invoke(Method.java:585)
> javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:211)
> javax.xml.bind.ContextFinder.find(ContextFinder.java:372)
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:574)
> javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:522)
> com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:220)
> com.sun.xml.ws.spi.ProviderImpl$2.run(ProviderImpl.java:218)
> java.security.AccessController.doPrivileged(Native Method)
> com.sun.xml.ws.spi.ProviderImpl.getEPRJaxbContext(ProviderImpl.java:217)
> com.sun.xml.ws.spi.ProviderImpl.(ProviderImpl.java:88)
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> java.lang.reflect.Constructor.newInstance(Constructor.java:494)
> java.lang.Class.newInstance0(Class.java:350)
> java.lang.Class.newInstance(Class.java:303)
> javax.xml.ws.spi.FactoryFinder.newInstance(FactoryFinder.java:36)
> javax.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:95)
> javax.xml.ws.spi.Provider.provider(Provider.java:83)
> javax.xml.ws.Service.(Service.java:56)
> com.itron.ami._2008._10.lan.LanService.(ItronService.java:42)
> com.comverge.lms.itronws.client.Lan2WS.open(Unknown Source)
> com.comverge.commreg.action.LoginAction.perform(Unknown Source)
>
> org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
> org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
> org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
> javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>
> I am using Tomcat 5.5.27, JDK1.5, on a Mac.
> Now, the error message is implicating two classes -
> com.sun.xml.ws.developer.MemberSubmissionEndpointReference$Address
> and
> javax.xml.ws.wsaddressing.W3CEndpointReference$Address
> Both of which are in the Metro libraries.
>
> So, doesn't seem to be even related to the application.
>
> Any help, greatly appreciated.
> thanx
> -jb
> [Message sent by forum member 'johnyboyd' (johnyboyd)]
>
> http://forums.java.net/jive/thread.jspa?messageID=313633
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
> For additional commands, e-mail: users-help@metro.dev.java.net
>
>
>

--
View this message in context: http://www.nabble.com/%22Two-classes-have-the-same-XML-type-name%22---er...
Sent from the Metro - Users mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@metro.dev.java.net
For additional commands, e-mail: users-help@metro.dev.java.net

ssch
Offline
Joined: 2008-10-29
Points: 0

Yeah, I am seeing a similar issue when having multiple WebServices all having an init method which have varying parameters.
I think JAX-WS generates classes for each service, method so methods can't have the same name within a Netbeans project:
ll ~/NetBeansProjects/SecondWS/build/generated/wsgen/service/net/tdc/ip/oss/ConfigurationEngine/jaxws/Init*
-rw-r--r-- 1 ssch staff 1419 29 Okt 13:17 Init.java
-rw-r--r-- 1 ssch staff 499 29 Okt 13:17 InitResponse.java

So I've been forced to split things up into several projects to curcumvent this problem.
If only jax-ws could be told to include the name of the service into the path so it would be:
.../ConfigurationEngine/jaxws/NetworkDeviceConnection/Init

Anyone know if that is possible?

/Steffen