Reputation: 2591
I'm attempting to use WildFly's implementation of JAX-RS - RESTEasy to create some Java based Restful webservices, and having a little trouble simply getting it to initiate once deployed.
Note that I'm adding the RESTEasy annotations to a set of classes in an already working project that is deployed as an .ear file, that should be OK right? To be clear the package structure looks something like:
com.something.app
com.something.app.resteasyannotatedclasses
Now I am using no web.xml or any xml conf for that matter and only annotations as documented here
I simply have two classes, the RESTEasy Activator:
@ApplicationPath("/coordinates")
public class RestEasyActivator extends Application {
RestEasyActivator () {
Logger.getAnonymousLogger().warning("RestEasyActivator Initialised Rest Easy.");
}
}
And the actual service:
@Path("get")
public class CoordinatesServiceWrapper {
private static final Logger LOG = Logger.getLogger(CoordinatesServiceWrapper.class.getName());
@GET
@Path("getByName")
public String findCoordinates(){
LOG.info("Called coordinates service!");
return "Hi";
}
}
When the ear is deployed to WildFly I see the log:
WARN [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 4) WELD-000167: Class org.jboss.resteasy.core.AsynchronousDispatcher is annotated with @RequestScoped but it does not declare an appropriate constructor therefore is not registered as a bean!
WARN [org.jboss.weld.Bootstrap] (Weld Thread Pool -- 1) WELD-000167: Class org.jboss.resteasy.plugins.providers.DocumentProvider is annotated with @ApplicationScoped but it does not declare an appropriate constructor therefore is not registered as a bean!
INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 391) WFLYUT0021: Registered web context: '/CoordinateSearch' for server 'default-server'
INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) WFLYSRV0010: Deployed "CoordinateSearch.ear" (runtime-name : "CoordinateSearch.ear")
Im guessing the warnings relating to RESTEasy are fine to ignore, and the info messages show that the .ear has successfully deployed.
To invoke the webservice I've tried the URLS:
Server:port/CoordinateSearch/coordinates/get/getByName/ and Server:port/coordinates/get/getByName/
Neither of which generate any log entries.
What am I missing... Have I missed some conf? - it seems very minimal. Based on the RESTEasy documentation here WildFly comes with RESTEasy imported and it will bootstrap based on any classes containing annotations ...So I can't see the issue.
Upvotes: 1
Views: 1055
Reputation: 11
I had a similar issue and the solution was to set the scope of resteasy dependencies to provided rather than compile.
Upvotes: 1
Reputation: 3138
As answered here, JAX-RS should normally be packaged in a .war
file.
Upvotes: 0