I wanted to install it on my Tomcat 6 (apache-tomcat-6.0.18) with JDK (1.6.0_10)
I followed Java example in the “Getting started with Metro” guide from https://metro.java.net/getting-started/basic.html
Below are the issues I ran into during this process so thought of posting this for others benefit.
Issue #1 : Tomcat endorsed directory location in Ant build.xml
When you run the “server” target in build.xml it throws following error message.
C:wsit-jaxws-fromjava>ant -Duse.tomcat=true server Buildfile: build.xml BUILD FAILED C:wsit-jaxws-fromjavabuild.xml:129: C:Toolsapache-tomcat-6.0.18commonendorsed not found. Total time: 0 seconds
This issue is due the wrong directory path for lib.endorsed in build.xml to fix this issue open the wsit-jaxws-fromjavabuild.xml file and search for following
Change the directory value ${catalina.home}/common/endorsed to ${catalina.home}/endorsed as shown below and save the build.xml file.
Now run the “ant -Duse.tomcat=true server” command again, build should be successful.
Issue #2 : The xendorsed option is required for JDK6
Once the you are done generating the server side for this web service you need to generate the client sources for the same sample service.
When I run the “ant -Duse.tomcat=true client” command I get following error message and build is failed again.
C:wsit-jaxws-fromjava>ant -Duse.tomcat=true client Buildfile: build.xml Trying to override old definition of task apt setup: generate-client: BUILD FAILED C:wsit-jaxws-fromjavabuild.xml:192: You are running on JDK6 which comes with JAX-WS 2.1 API, but this tool requires JAX-WS 2.2 API. Use the endorsed standards override mechanism (http://java.sun.com/javase/6/docs/technotes/guides/standards/), or set xendorsed="true" on. Total time: 0 seconds
As the message says it clearly, this problem is due to the JDK6 being shipped with older version of JAX-WS API. To make the
Open the build.xml file and look for below tag
Now change this to add a new attribute as shown below.
Now run the “ant -Duse.tomcat=true client” command again, and this time it should generate all your client sources properly.
Issue #3 : Using the endorsed directory in JDK6
When I run the client using command “ant -Duse.tomcat=true run”, it gives me below error.
C:wsit-jaxws-fromjava>ant run Buildfile: build.xml Trying to override old definition of task apt run: [java] Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName()Ljava/lang/String; [java] at com.sun.xml.ws.model.RuntimeModeler.processExceptions(RuntimeModeler.java:1162) [java] at com.sun.xml.ws.model.RuntimeModeler.processDocWrappedMethod(RuntimeModeler.java:898) [java] at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:666) [java] at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:420) [java] at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:254) [java] at com.sun.xml.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:661) [java] at com.sun.xml.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:649) [java] at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:343) [java] at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:326) [java] at com.sun.xml.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:308) [java] at javax.xml.ws.Service.getPort(Service.java:92) [java] at fromjava.client.AddNumbersImplService.getAddNumbersImplPort(AddNumbersImplService.java:72) [java] at fromjava.client.AddNumbersClient.main(Unknown Source) [java] Java Result: 1 BUILD SUCCESSFUL Total time: 2 seconds
———–
The error message is due to client using older version of jaxws-ri which already bundled with the JDK6.
The annotation javax.xml.ws.WebFault in the rt.jar that ships with JDK1.6.0_X does not contain a messageName property
where as the javax.xml.ws.WebFault annotation that comes in the webservices-api.jar does contain this property.
To avoid this error you need to copy the
if
For more details on endorsed directory read details at http://java.sun.com/javase/6/docs/technotes/guides/standards/
Now run the command “ant run” you should see the successful output.
C:Downloadswsit-jaxws-fromjavawsit-jaxws-fromjava>ant run Buildfile: build.xml Trying to override old definition of task apt run: [java] Invoking addNumbers(10, 20) [java] The result of adding 10 and 20 is 30. [java] [java] Invoking addNumbers(-10, 20) [java] Caught AddNumbersException_Exception: Numbers: -10, 20 BUILD SUCCESSFUL Total time: 1 second
Let me know if you face any other issue while following steps.
You are awesome!!! you saved me the big trouble. I have been trying this for last 2 days and going absolutely crazy on it.
I added endorsed in jrelib but that didn't work. So I moved it under catalina_home and it worked like a charm.
Thankyou so much once again.
It did solve my problem. NetBeans 6.9.1 and JDK 1.6_21. After I created 'endorsed' dir in JDK's lib folder and copied webservices-api from netbeans's provided Metro lib into it problem was solved.
THNX
I mean,
If it didn't fix, place the same endorsed folder in endorsed (or)
endorsed where catalina-home is apache tomcat6.x home i.e., C:Apache Software FoundationApache Tomcat 6.0.26 in my case
and catalina-base is tomcat instance i.e., C:Documents and Settingso404028.netbeans6.9apache-tomcat-6.0.26_base in my case.
It should fix.
I got the same issue. java.lang.NoSuchMethodError: javax.xml.ws.WebFault.messageName()Ljava/lang/String
I'm using netbeans 6.9.1, java 1.6.16 tomcat 6.x, metro 2.0, try copying "endorsed" folder with webservices-api.jar to you javahome1.6.16jrelibendorsed and restart netbeans. If it didn't fix, place the same endorsed folder in endorsed or endorsed where catalina-home is apache tomcat6.x home and catalina-base is tomcat instance. It should fix.
The metro distribution should contain a webservices-api.jar file in lib directory. Let me know what problem you are facing? Which version of Metro are you using?
I also, would like to know where I can download the webservices-api.jar file?
I tried the above steps but still same error 🙁
from where you download webservices-api.jar file??
Great page, contained everything I needed to get the samples working. Thanks for putting it together
@twig – As per your feedback I was able to incorporate the year in my post headers. Hope this helps.
I was having the same problems described here also using Tomcat and this article just made my day everything is up and running now!
Thanks a lot keep up the good work!!!
Hi just something I noticed on your blog. It doesn't seem to display the year of post, which is somewhat useful for older entries 😉
seems so frustrating to endure all the error messages. could there be a simpler way?
I think their emphasis is to use Metro with Glassfish 3.0. That could be one reason they didnt spend time on this sample app for tomcat. BTW Metro 2.0 core functionalities are good and I didnt see any issues using it in my recent applications. The build scripts used in sample app are handy and can be copied to use in our own project for server and client code generation. Let me know if you need any help on that front.
Metro 2.0 ha still this problems… why they do not fix these things ?
HI, I have added the webservices-api.jar in:
C:Program FilesJavajdk1.6.0_06jrelibendorsed
and also in my jboss C:jboss-6.1.0.Finallibendorsed , but it still displays the same error: "Trying to override old definition of task apt." I took the jar from the metro 2.0, Does anyone have a suggestion for me?