Can you show me the annotations on HelloService, HelloPortType and HelloPort?
Andreas On Mon, Feb 1, 2010 at 21:12, Daniel Walsh <walsh94...@gmail.com> wrote: > Andreas, > > I annotated my service class per your example and I am still getting the "No > annotated classes found in the jar" message when I click on the link > > Faulty Services > > c:\tomcat-6.0.20\webapps\axis2\WEB-INF\servicejars\HelloService.jar > > on the list services page at > "http://localhost:8080/axis2/services/listServices" > > My annotated implementation class, HelloPortImpl, is pretty simple: > > package com.wb.hello; > > import java.io.PrintStream; > > import javax.jws.WebMethod; > import javax.jws.WebParam; > import javax.jws.WebResult; > import javax.jws.WebService; > import javax.jws.soap.SOAPBinding; > import javax.xml.bind.annotation.XmlSeeAlso; > > @WebService(endpointInterface = "com.wb.hello.HelloPort", > serviceName = "HelloService", > portName = "HelloPort", > targetNamespace = "com/wb/hello", > wsdlLocation = "META-INF/hello.wsdl") > > public class HelloPortImpl implements HelloPort { > > @WebMethod > @WebResult(name = "helloResponseElement", targetNamespace = > "com/wb/hello", partName = "parameters") > public HelloResponseType hello(HelloRequestType helloRequestType) { > HelloResponseType helloResponseType = new HelloResponseType(); > helloResponseType.setResponse("Hello " + helloRequestType.getRequest()); > return helloResponseType; > } > } > > > And the class shows up in the jar file: > > $ jar tvf > c:/tomcat-6.0.20/webapps/axis2/WEB-INF/servicejars/HelloService.jar > 0 Mon Feb 01 12:11:02 PST 2010 META-INF/ > 71 Mon Feb 01 12:11:02 PST 2010 META-INF/MANIFEST.MF > 890 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/HelloPort.class > 1095 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/HelloPortImpl.class > 898 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/HelloPortType.class > 752 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/HelloRequestType.class > 758 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/HelloResponseType.class > 2003 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/HelloService.class > 1708 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/ObjectFactory.class > 230 Mon Feb 01 12:11:02 PST 2010 com/wb/hello/package-info.class > 1804 Mon Feb 01 12:11:00 PST 2010 META-INF/hello.wsdl > 805 Mon Feb 01 12:11:00 PST 2010 META-INF/helloSchema.xsd > 296 Sat Jan 30 16:26:00 PST 2010 META-INF/service.xml > > If you have any thoughts as to why I can't get this thing to deploy I would > sure be happy to hear them. > > Dan > > > > <andreas.veit...@gmail.com> wrote: >> >> Dan, >> >> Actually the error message should read "No @WebService annotated >> service implementations found" or something like that :-) >> >> In fact, you also need to annotate your service implementation with >> @WebService. Note that while this is the same annotation type than on >> the service interface (generated by wsimport), the attributes have a >> different meaning. There is an example here [1]. Note that this >> requirement is not specific to Axis2, but comes from JSR-109/181. >> >> Andreas >> >> [1] >> https://svn.apache.org/repos/asf/webservices/axis2/scratch/java/veithen/AXIS2-4611/jaxws-calculator-aar/src/main/java/org/apache/axis2/jaxws/calculator/impl/CalculatorImpl.java >> >> On Thu, Jan 28, 2010 at 19:46, Daniel Walsh <walsh94...@gmail.com> wrote: >> > Andreas, >> > >> > Thanks for the tip. I would never have figured that out by myself. >> > >> > Unfortunately, simply moving the "services/HelloService.aar" file to >> > "servicejars/HelloServices.jar" seems to have made things worse. Whereas >> > before I saw the service listed as deployed on the listServices page >> > (but >> > got the exception when trying to run the client), now the service >> > doesn't >> > even deploy. Clicking through the faulty services link on the >> > listServices >> > page gives me this: >> > >> > Error: No annotated classes found in the jar: >> > >> > file:/c:/tomcat-6.0.20/webapps/axis2/WEB-INF/servicejars/HelloService.jar. >> > Service deployment failed. >> > >> > Looking for annotations in just the .java files generated by "wsimport >> > -keep >> > -verbose hello.wsdl" (the .class files of which are in the jar file) I >> > find >> > the following (I used grep "^@" | sort) >> > >> > @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) >> > @WebService(name = "helloPort", targetNamespace = "com/wb/hello") >> > @WebServiceClient(name = "HelloService", targetNamespace = >> > "com/wb/hello", >> > wsdlL >> > ocation = >> > "file:/C:/Documents%20and%20Settings/dan/My%20Documents/tmp/hello2/ser >> > vice/hello.wsdl") >> > @XmlAccessorType(XmlAccessType.FIELD) >> > @XmlAccessorType(XmlAccessType.FIELD) >> > @XmlRegistry >> > @XmlSeeAlso({ >> > @XmlType(name = "helloRequestType", propOrder = { >> > @XmlType(name = "helloResponseType", propOrder = { >> > @javax.xml.bind.annotation.XmlSchema(namespace = "com/wb/hello") >> > >> > Clearly, there are lots of annotations, so the error message is >> > incorrect. >> > >> > I'm not sure what to do at this point. >> > >> > Dan >> > >> > >> > On Wed, Jan 27, 2010 at 12:46 PM, Andreas Veithen >> > <andreas.veit...@gmail.com> wrote: >> >> >> >> Daniel, >> >> >> >> Please have a look at AXIS2-4611 [1]. If deploying as a servicejar is >> >> not an option for you, feel free to vote for the issue and leave a >> >> comment. >> >> >> >> Andreas >> >> >> >> [1] https://issues.apache.org/jira/browse/AXIS2-4611 >> >> >> >> On Wed, Jan 27, 2010 at 21:32, Daniel Walsh <walsh94...@gmail.com> >> >> wrote: >> >> > >> >> > I have written a simple hello application in Axis2 JAX-WS and when I >> >> > run >> >> > my client I am getting an error that the service class cannot be >> >> > found. In >> >> > this email I'm including the exact message, my services.xml file, a >> >> > jar >> >> > output of my aar file, my wsdl file, my schema file, a snippet from >> >> > the >> >> > available services webpage and a stacktrace from catalina.out. >> >> > >> >> > I wrote the services.xml, the schema and the wsdl files by hand and >> >> > generated all the classes (except HelloClient, my client class) by >> >> > "wsimport >> >> > -keep -verbose hello.wsdl". >> >> > >> >> > I have tried every Google search I can think of and have looked at >> >> > several tutorials and dozens of mail archives without finding out the >> >> > answer. If you can help, I would really appreciate it. >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > The error message I get when I run the client (java -cp >> >> > HelloService.jar >> >> > com/wb/hello/HelloClient) is: >> >> > >> >> > "Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: >> >> > java.lang.RuntimeException: The service class cannot be found for >> >> > this >> >> > AxisService." >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > My services.xml file is simple: >> >> > >> >> > <service name="HelloService"> >> >> > <parameter >> >> > name="ServiceClass">com.wb.hello.HelloService</parameter> >> >> > <operation name="hello"> >> >> > <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" >> >> > class="org.apache.axis2.jaxws.server.JAXWSMessageReceiver"/> >> >> > </operation> >> >> > </service> >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > When I go to /cygdrive/c/tomcat-6.0.20/webapps/axis2/WEB-INF/services >> >> > and jar the aar file, the service class is there: >> >> > >> >> > $ jar tvf HelloService.aar >> >> > 0 Tue Jan 26 14:41:52 PST 2010 META-INF/ >> >> > 71 Tue Jan 26 14:41:52 PST 2010 META-INF/MANIFEST.MF >> >> > 1287 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloClient.class >> >> > 886 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloPort.class >> >> > 898 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloPortType.class >> >> > 752 Tue Jan 26 14:41:52 PST 2010 >> >> > com/wb/hello/HelloRequestType.class >> >> > 758 Tue Jan 26 14:41:52 PST 2010 >> >> > com/wb/hello/HelloResponseType.class >> >> > 2079 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/HelloService.class >> >> > 1708 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/ObjectFactory.class >> >> > 230 Tue Jan 26 14:41:52 PST 2010 com/wb/hello/package-info.class >> >> > 1794 Tue Jan 26 14:41:50 PST 2010 META-INF/hello.wsdl >> >> > 805 Tue Jan 26 14:41:50 PST 2010 META-INF/helloSchema.xsd >> >> > 301 Tue Jan 26 14:41:36 PST 2010 META-INF/services.xml >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > My wsdl file is: >> >> > >> >> > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> >> >> > <definitions targetNamespace="com/wb/hello" >> >> > name="hello" >> >> > xmlns="http://schemas.xmlsoap.org/wsdl/" >> >> > xmlns:tns="com/wb/hello" >> >> > xmlns:xsd="http://www.w3.org/2001/XMLSchema" >> >> > xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" >> >> > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" >> >> > > >> >> > >> >> > <!-- define schema elements for helloRequest, helloResponse --> >> >> > <types> >> >> > <xsd:schema> >> >> > <xsd:import namespace="com/wb/hello" >> >> > schemaLocation="helloSchema.xsd"/> >> >> > </xsd:schema> >> >> > </types> >> >> > >> >> > <!-- define messages for helloRequest, helloResponse elements --> >> >> > <message name="helloRequestMessage"> >> >> > <part name="name" element="tns:helloRequestElement"/> >> >> > </message> >> >> > >> >> > <message name="helloResponseMessage"> >> >> > <part name="result" element="tns:helloResponseElement"/> >> >> > </message> >> >> > >> >> > <!-- define port for helloRequest, hello Response messages --> >> >> > <portType name="helloPort"> >> >> > <operation name="hello"> >> >> > <input message="tns:helloRequestMessage"/> >> >> > <output message="tns:helloResponseMessage"/> >> >> > </operation> >> >> > </portType> >> >> > >> >> > <!-- define binding for hello operation --> >> >> > <binding name="helloBinding" type="tns:helloPort"> >> >> > <soap:binding transport="http://schemas.xmlsoap.org/soap/http" >> >> > style="document"/> >> >> > <operation name="hello"> >> >> > <soap:operation soapAction=""/> >> >> > <input> >> >> > <soap:body use="literal"/> >> >> > </input> >> >> > <output> >> >> > <soap:body use="literal"/> >> >> > </output> >> >> > </operation> >> >> > </binding> >> >> > >> >> > <!-- finally, define the service --> >> >> > <service name="HelloService"> >> >> > <port name="helloPort" binding="tns:helloBinding"> >> >> > <soap:address >> >> > location="http://localhost:8080/axis2/services/HelloService"/> >> >> > </port> >> >> > </service> >> >> > >> >> > </definitions> >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > My schema file is: >> >> > >> >> > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> >> >> > <xsd:schema targetNamespace="com/wb/hello" >> >> > xmlns:tns="com/wb/hello" >> >> > xmlns:xsd="http://www.w3.org/2001/XMLSchema"> >> >> > >> >> > <!-- define types for helloRequest, helloResponse --> >> >> > <xsd:complexType name="helloRequestType"> >> >> > <xsd:sequence> >> >> > <xsd:element name="request" type="xsd:string" minOccurs="1"/> >> >> > </xsd:sequence> >> >> > </xsd:complexType> >> >> > >> >> > <xsd:complexType name="helloResponseType"> >> >> > <xsd:sequence> >> >> > <xsd:element name="response" type="xsd:string" minOccurs="1"/> >> >> > </xsd:sequence> >> >> > </xsd:complexType> >> >> > >> >> > <!-- define elements for helloRequest, helloResponse --> >> >> > <xsd:element name="helloRequestElement" >> >> > type="tns:helloRequestType"/> >> >> > <xsd:element name="helloResponseElement" >> >> > type="tns:helloResponseType"/> >> >> > >> >> > </xsd:schema> >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > When I point my browser to >> >> > http://localhost:8080/axis2/services/listServices it shows it as >> >> > available: >> >> > >> >> > Back Home | Refresh >> >> > >> >> > >> >> > Available services >> >> > >> >> > HelloService >> >> > >> >> > Service EPR : http://localhost:8080/axis2/services/HelloService >> >> > >> >> > Service Description : HelloService >> >> > >> >> > Service Status : Active >> >> > Available Operations >> >> > >> >> > hello >> >> > >> >> > >> >> > >> >> > ------------------------------------------------------------------------------------------------------------------------------------------------------ >> >> > >> >> > And for what it's worth, /cygdrive/c/tomcat-6.0.20/logs/catalina.out >> >> > includes: >> >> > >> >> > [ERROR] The service class cannot be found for this AxisService. >> >> > java.lang.RuntimeException: The service class cannot be found for >> >> > this >> >> > AxisServi >> >> > ce. >> >> > at >> >> > org.apache.axis2.jaxws.server.JAXWSMessageReceiver.receive(JAXWSMessa >> >> > geReceiver.java:95) >> >> > at >> >> > org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:173) >> >> > at >> >> > org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostReq >> >> > uest(HTTPTransportUtils.java:167) >> >> > at >> >> > org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:1 >> >> > 42) >> >> > at >> >> > javax.servlet.http.HttpServlet.service(HttpServlet.java:637) >> >> > at >> >> > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) >> >> > at >> >> > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl >> >> > icationFilterChain.java:290) >> >> > at >> >> > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF >> >> > ilterChain.java:206) >> >> > at >> >> > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV >> >> > alve.java:233) >> >> > at >> >> > org.apache.catalina.core.StandardContextValve.invoke(StandardContextV >> >> > alve.java:191) >> >> > at >> >> > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j >> >> > ava:128) >> >> > at >> >> > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j >> >> > ava:102) >> >> > at >> >> > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal >> >> > ve.java:109) >> >> > at >> >> > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav >> >> > a:293) >> >> > at >> >> > org.apache.coyote.http11.Http11Processor.process(Http11Processor.java >> >> > :849) >> >> > at >> >> > org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce >> >> > ss(Http11Protocol.java:583) >> >> > at >> >> > org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:45 >> >> > 4) >> >> > at java.lang.Thread.run(Thread.java:619) >> >> > >> > >> > > >