2

We have a test web application deployed In Weblogic 10.3.5. The web application contains a servlet which uses jax-ws to call a web service deployed in the same weblogic. Accessing the servlet throws the following exception:

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

I copied the logic of the servlet into a common java class, and ran it. The test succeeded. So the problem should lie in the web application.

I have tried many ways, modify weblogic-application.xml to add prefer-application-packages section like below, but still doesn't work.

<prefer-application-packages>
    <package-name>javax.xml.ws.*</package-name>
    <package-name>javax.xml.bind.*</package-name>
    <package-name>javax.jws.*</package-name>
    <package-name>javax.namespace.xml.*</package-name>
    <package-name>javax.xml.soap.*</package-name>
    <package-name>org.apache.xerces.*</package-name>
    <package-name>org.apache.commons.*</package-name>
    <package-name>com.sun.xml.*</package-name>
</prefer-application-packages>

Anyone can help me on this, spent several days on this bug, no progress at all. Thanks a million for your reply in advance.

Update 1

In the web application, we don't want to use metro, just use jax-ws downloaded from java.net, and put put jaxws-rt.jar, jaxws-api.jar, jaxb and other related jars in the ear/APP-INF/lib.

WebLogic Classloader Analysis Tool (wls-cat) tells there are some classes conflict, and suggests to add prefer-application-packages in weblogic-application.xml. So We add prefer-application-packages to tell weblogic load them from from our application, not from weblogic jax-ws/metro implmentation.

But still doesn't work.

jeffery.yuan
  • 1,177
  • 1
  • 17
  • 27

1 Answers1

0

The problem might come from the fact that you want to use Metro JaxWs in Weblogic which has it's own implementation called Oracle JaxWS (based on Metro).

Here is a link where is explained how use Metro with Weblogic : http://metro.java.net/guide/ch02.html#weblogic-10

If you don;t use Metro and rely on Oracle JaxWS you do not have to used preferred libs or any special packaging.

Cris
  • 4,947
  • 6
  • 44
  • 73
  • In the web application, we don't use metro, just use jax-ws RI from java.net. We put jaxws-rt.jar, jaxws-api.jar, jaxb and other related jars in the ear/APP-INF/lib. We add prefer-application-packages to make sure weblogic load them from from our application, not from weblogic jax-ws/metro implmentation. I update my question to add more information. – jeffery.yuan Sep 02 '12 at 03:48
  • This problem was resolved after change the weblogic-application.xml - I will post the solution after I find it :) – jeffery.yuan Oct 12 '12 at 20:30
  • 3
    @jeffery.yuan: Please do post the solution. – Christoffer Hammarström Dec 14 '12 at 10:58