Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing JAW-XS Annotations in Tomcat/Axis2
    text
    copied!<p>I'm working on a java web services and I would like to use JAW-XS annotations (to configure the web service) and deploy it with tomcat 7/Axis2.</p> <p>But I always get an error, whatever I try.</p> <p>So here my web Services (it's just a basic web service for the moment) with the annotations :</p> <p><strong>Interface</strong></p> <pre><code> package wtp; import javax.jws.WebMethod; import javax.jws.WebService; @WebService public interface ConverterContract { @WebMethod float celsiusToFarenheit(float celsius); @WebMethod float farenheitToCelsius(float farenheit); } </code></pre> <p><strong>Service implementation</strong></p> <pre><code> package wtp; import javax.jws.WebService; @WebService(endpointInterface = "wtp.ConverterContract") public class Converter implements ConverterContract { public Converter() { } public float celsiusToFarenheit(float celsius) { return (celsius * 9 / 5) + 32; } public float farenheitToCelsius(float farenheit) { return (farenheit - 32) * 5 / 9; } } </code></pre> <p>Then for the deployment, I use Tomcat7 and Axis2 and so are the Server and Runtime preferences in Eclipse.</p> <p>So to use the orignal WSDL (generate by JAX-WS), the paramater useOriginalwsdl is set to true in the service.xml file. But It doesn't work...</p> <p>So here is the output when I launch the web service on tomcat :</p> <p><strong>Output</strong></p> <pre><code>juil. 11, 2013 11:38:55 AM org.apache.catalina.core.AprLifecycleListener init INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\VisualSVN\bin;C:\Program Files\TortoiseSVN\bin;C:\Users\f_gil\Documents\eclipse-jee-kepler-R-win32\eclipse;;. juil. 11, 2013 11:38:55 AM org.apache.tomcat.util.digester.SetPropertiesRule begin WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:ConverterProj' did not find a matching property. juil. 11, 2013 11:38:55 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["http-bio-8080"] juil. 11, 2013 11:38:55 AM org.apache.coyote.AbstractProtocol init INFO: Initializing ProtocolHandler ["ajp-bio-8009"] juil. 11, 2013 11:38:55 AM org.apache.catalina.startup.Catalina load INFO: Initialization processed in 278 ms juil. 11, 2013 11:38:55 AM org.apache.catalina.core.StandardService startInternal INFO: Démarrage du service Catalina juil. 11, 2013 11:38:55 AM org.apache.catalina.core.StandardEngine startInternal INFO: Starting Servlet Engine: Apache Tomcat/7.0.42 [ERROR] Unable to find config file. Creating new servlet engine config file: /WEB-INF/server-config.wsdd [WARN] Web application uses org.apache.axis2.transport.http.AxisAdminServlet; please update web.xml to use org.apache.axis2.webapp.AxisAdminServlet instead [INFO] Clustering has been disabled [INFO] Deploying module: addressing-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/addressing-1.6.2.mar [INFO] Deploying module: jaxws-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/axis2-jaxws-mar-1.6.2.mar [INFO] Deploying module: metadataExchange-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/mex-1.6.2.mar [INFO] Deploying module: mtompolicy-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/mtompolicy-1.6.2.mar [INFO] Deploying module: ping-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/ping-1.6.2.mar [INFO] Deploying module: script-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/scripting-1.6.2.mar [INFO] Deploying module: soapmonitor-1.6.2 - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/modules/soapmonitor-1.6.2.mar [INFO] Deploying JAXWS annotated class wtp.Converter as a service - ConverterService [INFO] Deploying Web service: Converter - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/services/Converter/ [INFO] Deploying Web service: version-1.6.2.aar - file:/C:/Users/f_gil/Documents/Workspace/AirNavLight_WS/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/ConverterProj/WEB-INF/services/version-1.6.2.aar juil. 11, 2013 11:38:57 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["http-bio-8080"] juil. 11, 2013 11:38:57 AM org.apache.coyote.AbstractProtocol start INFO: Starting ProtocolHandler ["ajp-bio-8009"] juil. 11, 2013 11:38:57 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 1673 ms </code></pre> <p>Then the http page generate by tomcat :</p> <p><strong>Available service page :</strong> <img src="https://i.stack.imgur.com/6a1Xj.png" alt="Available service page"></p> <p>And now the response I get with ?wsdl on ConverterService and Converter :</p> <p><strong>ConverterService?wsdl</strong></p> <pre><code>&lt;error&gt; &lt;description&gt; Unable to generate WSDL 1.1 for this service &lt;/description&gt; &lt;reason&gt; If you wish Axis2 to automatically generate the WSDL 1.1, then please set useOriginalwsdl as false in your services.xml &lt;/reason&gt; javax.xml.ws.WebServiceException: Error occurred generating WSDL file for Web service implementation class {wtp.Converter} at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:198) at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:390) at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:383) at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1394) at org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327) at org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: com.sun.tools.ws.spi.WSToolsObjectFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:177) ... 24 more &lt;/error&gt; </code></pre> <p><strong>Converter?wsdl</strong></p> <pre><code>&lt;error&gt; &lt;description&gt; Unable to generate WSDL 1.1 for this service &lt;/description&gt; &lt;reason&gt; If you wish Axis2 to automatically generate the WSDL 1.1, then please set useOriginalwsdl as false in your services.xml &lt;/reason&gt; &lt;/error&gt; </code></pre> <p>And to finish the output when ?WSDL is hit : </p> <p><strong>output when ?WSDL is hit</strong></p> <pre><code>[ERROR] Error occurred generating WSDL file for Web service implementation class {wtp.Converter} java.lang.ClassNotFoundException: com.sun.tools.ws.spi.WSToolsObjectFactory at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Unknown Source) at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:177) at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:390) at org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:383) at org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1394) at org.apache.axis2.transport.http.ListingAgent.handleWSDLRequest(ListingAgent.java:327) at org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:183) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:260) at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) </code></pre> <p>So, as you can see, the WSDL was not generate...</p> <p>So my questions : </p> <ol> <li>Why on the available service page, I can see Converter with no operations specified and a ConverterService with the 2 available operations? I hava only one web service : the interface and the implementation (which specify the endpointInterface).</li> <li>Then How to use JAX-WS annotation with axis2? Does the parameters "useOriginalwsdl" and "useGeneratedWSDLinJAXWS" are relevant?</li> </ol> <p>I try to resolve this errors by adding a setenv.bat file (where I set the CLASSPATH variable) in the bin folder of Tomcat, but it doesn't seem to work. (There is no errors when I run startup.bat).</p> <p>Here the setenv.bat I wrote : </p> <p><strong>setenv.bat</strong></p> <pre><code>set "CLASSPATH=%CLASSPATH%;C:\Program Files (x86)\Java\jdk1.7.0_25\lib\tools.jar;C:\Program Files (x86)\Java\jre7\lib\javaws.jar" </code></pre> <p>So does anyone have any idea of how use JAX-WS annotations and Axis2?</p> <p>Sorry for the length, but I wanted to provide all available documents/information. Thanks</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload