jax-ws in Weblogic 10.3.5: IllegalAnnotationsException: 2 counts of IllegalAnnotationExceptions - web-services

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.

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.

Related

Jetty vs Weblogic Axis Response deserialization difference

I am testing my application with both Jetty(Eclipse) & Weblogic. I am calling an axis web service, receive a response and deserialize it. While everything works like a charm in Jetty, when I pack & deploy my application to weblogic I receive
org.xml.sax.SAXException: Invalid element in
com.xxx.yyyy.soa.schemas.INVOICE_ITEMType - CHARGE_TYPE
I am sure, both call the same Web service URL.
I decompiled the INVOICE_ITEMType class at war that I deploy to weblogic and made sure there is CHARGE_TYPE at INVOICE_ITEMType class.
What should I do to further investigate the case? I am stuck
Thank you
Finally realized that it is a classloader issue. My application unfortunately calls different web services from same third party company, whose interfaces re-uses same named-packeged objects with different implementations.

Name collision in webservice using enterprise application, Weblogic 12

I have a web application that is using (calling) two identical webservices, they only differ in URL. I use Netbeans 8 to generate the webservice clients, both of which are in the same separate project but in two separate packages. The main application packages everything in a super jar.
Deploying the super jar to Weblogic causes a JAXBException, name collision. The relevant part of the error message:
Two classes have the XML type with uri http://yet.another/useless/namespace/url and name fault.
All of the classes have identical names, yet it's the one with the name fault that is bothering Weblogic.
I could totally separate these web services into different enterprise applications of course but that seems like overkill.
I read the WSDLs from a remote server and don't really have a chance to convince our contractor to change namespaces.
I just worked around it: I'm using Axis2 to generate client side code as I'm free to perform whatever refactoring is necessary on it to avoid name collisions. Morale of the story: Avoid IDE wizards (if they cause trouble).

JAX-WS and sun-jaxws.xml

I have read a lot of posts on public forums about deploying JAX-WS on different servet containers
and I have following questions/queries based on that.
Following is my understanding :
1)sun-jaxws.xml is required ONLY BY Sun's RI (metro project) since com.sun.xml.ws.transport.http.servlet.WSServletContextListener class needs it.
(looking at source for this class , it reads this file from hardcoded location).
2)It is also required if servlet container is not Java EE 5 compliant.
3)Different application servers like Jboss , GlassFish can use their own JAX-WS implementations (like Apache CXF,Metro)
So my questions are :
1)If I use Sun's RI (metro) on Java EE 5 container like JBoss or GlassFish , do I still need to use sun-jaxs.xml ?
2)If I develope JAX-WS web service on Java EE 5 container like Jboss , can it be portable to another Java EE 5 container like GlassFish. What I mean is can I deploy the war as it is on another container ?
Please help me sort out above queries since I am really confused about Sun's RI and sun-jaxws.xml descriptor usage.
Application servers have own web service client frameworks. You can think these are like jaxws. When you deploy an app to app server default option app server use own framework for web service call. Therefore if server need a configuration file like as sun-jaxws.xml you must put it relevant directory. But I dont think you need it.
Second option is configuring the app server for using your third part jax-ws library. It is an extra option. For example I made in WAS. Because of that when you choose this choice you must use sun-jaxws.xml
Hopefully I have been clear in my answer :)

how to version jax-ws web services

is there any best practice to version every release of my jax-ws based web services build ? I have seen a few ways to version REST based services (for example to include the version information in URL etc.) Is there any other different way of versioning JAX-WS based web services. .
To version my services, I use a different targetNamespace.
For instance, I add the annotation to my interface :
#WebService(name = "YourService", targetNamespace = "http://whatever/you/want/VersionNumber")
Running wsgen you will end up with a different targetNamespace in you xsd. All old clients won't be able to use your webservice, with a clean, "fail fast" error.
However, as this is quite annoying, I only update this version when the signature of the service has changed, to prevent from wierd, hard to debug, errors

How to deploy an Axis-generated soap service to an embedded Tomcat instance

I generated a Soap Service from a WSDL and now I need to deploy it to my existing application which uses embedded tomcat (I.E. I have a class which extends TomcatServeletContainer and a main class which instantiates that class and starts the server).
I see many examples for how to deploy an axis service to a standalone tomcat using a WAR, or a WSDD, but I don't see how to wire it together myself. I assume I have to define a servelet in the web.xml and provide some other glue. Any assistance or pointers to appropriate documentation would be most appreciated.
Thanks!
-Carl
Have you been able to get this to work?
I've been trying to build a webservice (in a standalone war-file containing the axis jars (w/dependencies)+server-config.wsdd) using maven. I really don't want to make any calls to the AdminClient at all (meaning not to install Axis).
I've generated the server side sources from a WSDL using the axistools-maven-plugin, and everything seems to work ok until I have deployed the service. http://localhost:8080/myApp/services gives me the name of the service and two exposed methods. But clicking the wsdl link displays an Axis error message telling me "Could not generate WSDL! There is no SOAP service at this location".
Is it at all possible to build a standalone Axis webservice this way using maven?
Yes, you will need build your application the same way you would for a WAR but programmatically inform tomcat where you exploded war lives.
Everything else should be the same as the standard servlet spec.