Does Java 7 include a JAX-WS implementation or just the API?
Jdk 7 (like 6) includes a metro based implementation.
As you can see from your exception, the internal implementation is running "com.sun.xml.internal.ws.transport.http.server.EndpointImpl". The problem seems to be that it doesn't like your WsdlLocation (i believe jaxws is expecting a local resource, but you have given it a http resource).
Related videos on Youtube
kuloch
I like to write good code, play good guitars, and eat & cook good food. Oh, and I try to teach my kids to not be awful people.
Updated on June 04, 2022Comments
-
kuloch almost 2 years
I am told that Java 7 is supposed to include JAX-WS such that I don't need libraries like those in Apache CXF. However, the official docs say:
This release contains Java API for XML Processing (JAXP) 1.4.5, supports Java Architecture for XML Binding (JAXB) 2.2.3, and supports Java API for XML Web Services (JAX-WS) 2.2.4.
Further, the Eclipse page on JAX-WS speaks of using implementations such as Apache CXF, Sun Metro, or Apache Axis. And every example/tutorial I can find on JAX-WS uses a library set like CXF or Metro.
I have a project in Eclipse that calls "Endpoint.publish(...)" on a class with a javax.jws.WebService annotation. The WSDL file referenced below resides outside Eclipse. This project runs (as a "Java Application") fine with the Apache CXF libraries includes. As soon as I remove them (and Eclipse references to Apache CXF), it crashes with the following exception:
com.sun.xml.internal.ws.server.ServerRtException: [failed to localize] cannot.load.wsdl(http://localhost:8081/wsdl/csw.wsdl) at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.getPrimaryWsdl(EndpointImpl.java:313)
So either I'm doing something wrong or Apache is supplying implementations of things to which the JDK itself only has APIs. Please point out which is the case, along with the usual link to something relevant.
-
Christian Schneider almost 11 yearsJava 7 contains a JAX-WS implementation but it is quite limited compared with CXF or Metro.
-
-
kuloch over 12 yearsThanks for the details. You're right that I do get past that exception if I put the WSDL file in my classpath. Unfortunately, I'm now back to an exception that I only dealt with before because CXF was using its own JAXB library. The current version of JAXB is 2.2.4, which throws a NullPointerException. When I replaced CXF's jaxb-impl*.jar with the 2.2.3 version, that fixed it. But I can't find the system jaxb-impl, and putting 2.2.3 on the classpath doesn't fix it.
-
jtahlborn over 12 years@kuloch - you need to use the endorsed override mechanism to use a newer jaxb or jaxws implementation, see docs.oracle.com/javase/6/docs/technotes/guides/standards . related advice here weblogs.java.net/blog/ramapulavarthi/archive/2007/01/…
-
kuloch over 12 yearsThanks. We came across that before I saw your post, and the service is running again - this time on (presumably) Metro.
-
Miljen Mikic about 11 years@jtahlborn AFAIK, "Jdk 7 (like 6) includes the metro implementation." is not entirely correct. JDK 6+ does include JAX-WS RI (reference implementation), but Metro is a superset of JAX-WS RI, i.e. Metro = JAX-WS RI + WSIT.
-
John Eipe almost 10 years@MiljenMikic Is it possible to setup JAX-WS on tomcat just using RI? I tired but failed so used Metro.
-
Miljen Mikic almost 10 years@John Have you tried mkyong's tutorial? (mkyong.com/webservices/jax-ws/…). It gives nice, step-by-step cookbook how to setup JAX-WS on Tomcat.
-
John Eipe almost 10 yearsmkyongs tutorial explains using metro. My question is - is it possible to set up jax-ws on tomcat just using RI? Now this question is based on my understanding that RI is part of JDK, metro is not.
-
kuloch over 9 years@John If you haven't already, you should probably ask your question as a separate thread. I'm pretty confident that you can create a WAR that uses JAX-WS and runs in Tomcat. You will need to at least link in the javax.servlet-api-<version>.jar at compile time, as the container (e.g. Tomcat) will provide the API and an implementation at runtime. You'll also need to have a web.xml that instructs the container to use JAX-WS and probably your classes.