You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by seriousme <se...@orange.fr> on 2008/08/23 19:53:03 UTC

Problems using java annotations

Hi,

trying to use the java annotations instead of xml files to deploy a web
service some problems arise.

The web service is a simple hello world :
@javax.jws.WebService()
public class ServiceTest
{
	@javax.jws.WebMethod()
	public String hello()
	{
		return "Hello world";
	}
}

It is compiled this way :
javac -cp
/usr/local/tomcat/webapps/axis2/WEB-INF/lib/axis2-jaxws-api-1.4.jar
ServiceTest.java

And deployed in a directory named "pojo" under the WEB-INF directory of the
Axis2 web application inside Tomcat :
cp ServiceTest.class /usr/local/tomcat/webapps/axis2/WEB-INF/pojo

In the "axis2.xml" configuration file :
<deployer extension=".class" directory="pojo"
class="org.apache.axis2.deployment.POJODeployer"/>

So the pojo seems to be well deployed according to the Tomcat logs :
[INFO] Deploying pojo: ServiceTest -
/usr/local/tomcat/webapps/axis2/WEB-INF/pojo/ServiceTest.class

The service and its method "hello" appear in the services list at
"http://127.0.0.1:8080/axis2/services/listServices".

But when trying to access the wsdl description file of the service at
"http://127.0.0.1:8080/axis2/services/ServiceTestService?wsdl" the result is
:
<error><description>Unable to generate WSDL 1.1 for this
service</description><reason>If you wish Axis2 to automatically generate the
WSDL 1.1, then please +set useOriginalwsdl as false in your
services.xml</reason>javax.xml.ws.WebServiceException: Error occurred
generating WSDL file for Web service implementation class {ServiceTest}:
{java.lang.ClassNotFoundException:
com.sun.tools.ws.spi.WSToolsObjectFactory}
	at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:187)
	at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:371)
	at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:364)
	at
org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1319)
	at
org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:287)
	at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException:
com.sun.tools.ws.spi.WSToolsObjectFactory
	at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
	at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:169)
	at
org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:166)
	... 19 more
</error>

However the wsdl2 is available at
"http://127.0.0.1:8080/axis2/services/ServiceTestService?wsdl2".

Moreover when trying to invoke the service by using the url call
"http://127.0.0.1:8080/axis2/services/ServiceTestService/hello" the result
is :
<faultstring>Incoming message protocol does not match endpoint
protocol.</faultstring>

The same service without annotations and deployed with a "services.xml" file
as an "aar" archive in the "services" directory works fine.

So how to enable the use of annotated services by Axis2 ?

Thanks by advance for your help.
-- 
View this message in context: http://www.nabble.com/Problems-using-java-annotations-tp19123613p19123613.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Problems using java annotations

Posted by thierrymu <th...@gmail.com>.
I have the same exact problem as seriousme. Were you able to find it's
solution? 
It is my understanding as well that the annotations replace the need for the
"service.xml."

I just downloaded the  http://metro.java.net/  metro  packet; it is supposed
to gather libraries needed to use jax-ws services. I'll report here if it
solves the problem. 
  


seriousme wrote:
> 
> Thanks for your answer.
> 
> There is no "services.xml" configuration file, only the ".class" file
> deployed in the "pojo" directory.
> 
> The purpose of using annotations was to avoid writting the "services.xml"
> file.
> 
> Is this file mandatory even with annotations in the service implementation
> ?
> Is it possible to put all the necessary configuration informations in the
> source file ?
> 
> Thanks by advance.
> 

-- 
View this message in context: http://old.nabble.com/Problems-using-java-annotations-tp19123613p30449986.html
Sent from the Axis - User mailing list archive at Nabble.com.

RE: Problems using java annotations

Posted by seriousme <se...@orange.fr>.
Thanks for your answer.

There is no "services.xml" configuration file, only the ".class" file
deployed in the "pojo" directory.

The purpose of using annotations was to avoid writting the "services.xml"
file.

Is this file mandatory even with annotations in the service implementation ?
Is it possible to put all the necessary configuration informations in the
source file ?

Thanks by advance.
-- 
View this message in context: http://www.nabble.com/Problems-using-java-annotations-tp19123613p19130658.html
Sent from the Axis - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


RE: Problems using java annotations

Posted by Martin Gainty <mg...@hotmail.com>.
please display the useOriginalWSDL param from your services.xml is should look something like
<parameter name="useOriginalwsdl">false</parameter>

thanks,
Martin 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Date: Sat, 23 Aug 2008 10:53:03 -0700
> From: serious.seb@orange.fr
> To: axis-user@ws.apache.org
> Subject: Problems using java annotations
> 
> 
> Hi,
> 
> trying to use the java annotations instead of xml files to deploy a web
> service some problems arise.
> 
> The web service is a simple hello world :
> @javax.jws.WebService()
> public class ServiceTest
> {
> 	@javax.jws.WebMethod()
> 	public String hello()
> 	{
> 		return "Hello world";
> 	}
> }
> 
> It is compiled this way :
> javac -cp
> /usr/local/tomcat/webapps/axis2/WEB-INF/lib/axis2-jaxws-api-1.4.jar
> ServiceTest.java
> 
> And deployed in a directory named "pojo" under the WEB-INF directory of the
> Axis2 web application inside Tomcat :
> cp ServiceTest.class /usr/local/tomcat/webapps/axis2/WEB-INF/pojo
> 
> In the "axis2.xml" configuration file :
> <deployer extension=".class" directory="pojo"
> class="org.apache.axis2.deployment.POJODeployer"/>
> 
> So the pojo seems to be well deployed according to the Tomcat logs :
> [INFO] Deploying pojo: ServiceTest -
> /usr/local/tomcat/webapps/axis2/WEB-INF/pojo/ServiceTest.class
> 
> The service and its method "hello" appear in the services list at
> "http://127.0.0.1:8080/axis2/services/listServices".
> 
> But when trying to access the wsdl description file of the service at
> "http://127.0.0.1:8080/axis2/services/ServiceTestService?wsdl" the result is
> :
> <error><description>Unable to generate WSDL 1.1 for this
> service</description><reason>If you wish Axis2 to automatically generate the
> WSDL 1.1, then please +set useOriginalwsdl as false in your
> services.xml</reason>javax.xml.ws.WebServiceException: Error occurred
> generating WSDL file for Web service implementation class {ServiceTest}:
> {java.lang.ClassNotFoundException:
> com.sun.tools.ws.spi.WSToolsObjectFactory}
> 	at
> org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:187)
> 	at
> org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.initialize(JAXWSRIWSDLGenerator.java:371)
> 	at
> org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.getWSDL(JAXWSRIWSDLGenerator.java:364)
> 	at
> org.apache.axis2.description.AxisService.printWSDL(AxisService.java:1319)
> 	at
> org.apache.axis2.transport.http.ListingAgent.processListService(ListingAgent.java:287)
> 	at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:240)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 	at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
> 	at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
> 	at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
> 	at java.lang.Thread.run(Thread.java:619)
> Caused by: java.lang.ClassNotFoundException:
> com.sun.tools.ws.spi.WSToolsObjectFactory
> 	at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
> 	at
> org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:169)
> 	at
> org.apache.axis2.jaxws.description.builder.JAXWSRIWSDLGenerator.generateWsdl(JAXWSRIWSDLGenerator.java:166)
> 	... 19 more
> </error>
> 
> However the wsdl2 is available at
> "http://127.0.0.1:8080/axis2/services/ServiceTestService?wsdl2".
> 
> Moreover when trying to invoke the service by using the url call
> "http://127.0.0.1:8080/axis2/services/ServiceTestService/hello" the result
> is :
> <faultstring>Incoming message protocol does not match endpoint
> protocol.</faultstring>
> 
> The same service without annotations and deployed with a "services.xml" file
> as an "aar" archive in the "services" directory works fine.
> 
> So how to enable the use of annotated services by Axis2 ?
> 
> Thanks by advance for your help.
> -- 
> View this message in context: http://www.nabble.com/Problems-using-java-annotations-tp19123613p19123613.html
> Sent from the Axis - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 

_________________________________________________________________
Be the filmmaker you always wanted to be—learn how to burn a DVD with Windows®.
http://clk.atdmt.com/MRT/go/108588797/direct/01/