I am trying to use jersey framework to build REST services, but I am getting
com.sun.jersey.api.container.ContainerException: Fatal issues found at class com.amazon.jasper.service.impl.WorkflowServiceImpl. See logs for more details.
at com.sun.jersey.impl.application.WebApplicationImpl.newResourceClass(WebApplicationImpl.java:290)
at com.sun.jersey.impl.application.WebApplicationImpl.getResourceClass(WebApplicationImpl.java:263)
at com.sun.jersey.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:827)
at com.sun.jersey.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:671)
at com.sun.jersey.spi.spring.container.servlet.SpringServlet.initiate(SpringServlet.java:66)
at com.sun.jersey.spi.container.servlet.ServletContainer.load(ServletContainer.java:538)
at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:197)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:966)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3956)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4230)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1217)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:293)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1306)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1570)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1579)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1559)
at java.lang.Thread.run(Thread.java:619)
Here is partial implementation of my service:
@Path("/workflows")
@Autowire
public class WorkflowServiceImpl implements WorkflowService {
@POST
@Produces("text/xml")
@Path("{packageName}/{workflowName}")
public Response createWorkflowByHttp(
@PathParam("packageName") String packageName,
@PathParam("workflowName") String workflowName,
@Context UriInfo uriInfo,
MultivaluedMap<String, String> params) {
}
@GET
@Produces("application/xml")
@Path("{workflowInstanceId}")
public WorkflowStatusResource getWorkflowStatusByXml(
@PathParam("workflowInstanceId") String workflowInstanceId) {
}
@GET
@Consumes("application/json")
@Produces("application/json")
@Path("{workflowInstanceId}")
public JSONObject getWorkflowStatusByJson(
@PathParam("workflowInstanceId") String workflowInstanceId) throws JSONException {
}
@GET
@Produces("application/xml")
@Path("{workflowInstanceId}/{taskId}")
public WorkflowTaskResource getTaskInstanceByXml(
@PathParam("workflowInstanceId") String workflowInstanceId,
@PathParam("taskId") String taskId) {
}
@GET
@Consumes("application/json")
@Produces("application/json")
@Path("{workflowInstanceId}/{taskId}")
public JSONObject getTaskInstanceByJson(
@PathParam("workflowInstanceId") String workflowInstanceId,
@PathParam("taskId") String taskId) throws JSONException {
}
@GET
@Produces("application/xml")
public WorkflowTaskResponse queryTasksByXml(
MultivaluedMap<String, String> params,
@DefaultValue("0") @QueryParam("page") int page) {
}
@GET
@Consumes("application/json")
@Produces("application/json")
public JSONObject queryTasksByJson(
JSONObject request,
@DefaultValue("0") @QueryParam("page") int page) throws JSONException {
}
...
I found that last two methods were causing this problem, e.g. when I commented annotations for those methods I don't see the error. I am trying to use GET in six flavors, i.e.
- GET /workflows/id using text/*
- GET /workflow/id using application/json
- GET /workflow/id/tasked using text/*
- GET /workflow/id/tasked using application/json
- GET /workflows?p1=v1&p2=v2 using text/*
- GET /workflows?p1=v1&p2=v2 using application/json
In all these cases I am using combination of content-type and URI to distinguish between these requests, but the last two requests are creating problems. Can anyone help with this. Thanks.