Note that there are some explanatory texts on larger screens.

plurals
  1. POJava Web service using Apt. Do I need an annotation processor? What is wrong?
    text
    copied!<p>I have been trying to make a simple web service and have been following <a href="http://www.artima.com/lejava/articles/threeminutes.html" rel="nofollow noreferrer"> this tutorial </a>. Unfortunately I am stuck. Here is what I have done so far:</p> <p>1) I created this class:</p> <pre><code>package server; import javax.jws.WebService; @WebService public class HelloImpl { /** * @param name * @return Say hello to the person. */ public String sayHello(String name) { return "Hello, " + name + "!"; } } </code></pre> <p>2) I ran:</p> <pre><code>apt HelloImpl.java </code></pre> <p>3) I get this warning: </p> <pre><code>hostName[username:~/Desktop/webtest][534]% apt HelloImpl.java warning: Annotation types without processors: [javax.xml.bind.annotation.XmlRootElement, javax.xml.bind.annotation.XmlAccessorType, javax.xml.bind.annotation.XmlType, javax.xml.bind.annotation.XmlElement] 1 warning </code></pre> <p>The apt command should (according to the tutorial) produce these files:</p> <pre><code>HelloServiceImpl.wsdl schema1.xsd classes/server/HelloImpl.class classes/server/jaxrpc/SayHello.class classes/server/jaxrpc/SayHelloResponse.class classes/server/jaxrpc/SayHello.java classes/server/jaxrpc/SayHelloResponse.java </code></pre> <p>This is what was generated when I called apt:</p> <pre><code>HelloImpl.java (not generated but it is still in the directory) HelloImpl.class server/jaxws/SayHello.cass server/jaxws/SayHell.java server/jaxws/SayHelloResponse.class server/jaxws/SayHelloResponse.java </code></pre> <p>(missing:)</p> <pre><code>HelloServiceImpl.wsdl schema1.xsd </code></pre> <p>(the paths are also slightly different)</p> <p>I suspect that the warning is being generated and the other files are not being generated because I have "Annotation types without processors:". </p> <p>I think that the warning indicates that it needs an annotation factory (processor). I know that you can specify what a factory by:</p> <p><code>enter code here</code>-cp Specify where to find user class files and annotation processor factories</p> <p>I am just unsure of what factory to specify. (Or maybe I need to configure something differently). </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