Quantcast

com.sun.jersey.api.container.ContainerException: Fatal issues found

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

com.sun.jersey.api.container.ContainerException: Fatal issues found

Bhatti, Shahzad

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.

 

 

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: com.sun.jersey.api.container.ContainerException: Fatal issues found

Paul Sandoz
Administrator
Hi,

     @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 {
     }

The above GET methods are in error because there is a method parameter  
that is not annotated and Jersey assumes that those correspond to  
request entities. Validation of the resource class is failing. GETs  
should not really have entities associated with the request so Jersey  
disallows it. The details should be in the logs should tell you why  
validation fails.

If you want to get access to the all query parameters do the following:

     @GET
     @Produces("application/xml")
     public WorkflowTaskResponse queryTasksByXml(
         @Context UriInfo ui,
         @DefaultValue("0") @QueryParam("page") int page) {
         MultivaluedMap<String, String> params =  
ui.getQueryParameters();
    }

Paul.

On Oct 31, 2008, at 7:50 PM, Bhatti, Shahzad wrote:

> 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.
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: com.sun.jersey.api.container.ContainerException: Fatal issues found

Bhatti, Shahzad
Thanks Paul, that should fix html based request but why is json method also failing for that query. I am using JSONObject for other GET requests and that's working.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Friday, October 31, 2008 12:06 PM
To: [hidden email]
Cc: Bhatti, Shahzad
Subject: Re: [Jersey] com.sun.jersey.api.container.ContainerException: Fatal issues found

Hi,

     @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 {
     }

The above GET methods are in error because there is a method parameter  
that is not annotated and Jersey assumes that those correspond to  
request entities. Validation of the resource class is failing. GETs  
should not really have entities associated with the request so Jersey  
disallows it. The details should be in the logs should tell you why  
validation fails.

If you want to get access to the all query parameters do the following:

     @GET
     @Produces("application/xml")
     public WorkflowTaskResponse queryTasksByXml(
         @Context UriInfo ui,
         @DefaultValue("0") @QueryParam("page") int page) {
         MultivaluedMap<String, String> params =  
ui.getQueryParameters();
    }

Paul.

On Oct 31, 2008, at 7:50 PM, Bhatti, Shahzad wrote:

> 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.
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: com.sun.jersey.api.container.ContainerException: Fatal issues found

Paul Sandoz
Administrator

On Oct 31, 2008, at 8:13 PM, Bhatti, Shahzad wrote:

> Thanks Paul, that should fix html based request but why is json  
> method also failing for that query.

Because there is a method parameter, JSONObject request.


> I am using JSONObject for other GET requests and that's working.

Are you sure? can you send me such working examples where JSONObject  
is being used as a non-annotated method parameter?

Any @GET annotated resource method with an non-annotated method  
parameter should fail.

Paul.

>
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Friday, October 31, 2008 12:06 PM
> To: [hidden email]
> Cc: Bhatti, Shahzad
> Subject: Re: [Jersey]  
> com.sun.jersey.api.container.ContainerException: Fatal issues found
>
> Hi,
>
>     @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 {
>     }
>
> The above GET methods are in error because there is a method parameter
> that is not annotated and Jersey assumes that those correspond to
> request entities. Validation of the resource class is failing. GETs
> should not really have entities associated with the request so Jersey
> disallows it. The details should be in the logs should tell you why
> validation fails.
>
> If you want to get access to the all query parameters do the  
> following:
>
>     @GET
>     @Produces("application/xml")
>     public WorkflowTaskResponse queryTasksByXml(
>         @Context UriInfo ui,
>         @DefaultValue("0") @QueryParam("page") int page) {
>         MultivaluedMap<String, String> params =
> ui.getQueryParameters();
>    }
>
> Paul.
>
> On Oct 31, 2008, at 7:50 PM, Bhatti, Shahzad wrote:
>
>> 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.
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: com.sun.jersey.api.container.ContainerException: Fatal issues found

Bhatti, Shahzad
Actually, the other method is using POST, e.g.
    @POST
    @Consumes("application/json")
    @Produces("application/json")
    @Path("{packageName}/{workflowName}")
    public Response createWorkflowByJson(
            @PathParam("packageName") String packageName,
            @PathParam("workflowName") String workflowName,
            @Context UriInfo uriInfo,
            JSONObject request) throws JSONException {
    }

And that works. Thanks.


-----Original Message-----
From: [hidden email] [mailto:[hidden email]]
Sent: Friday, October 31, 2008 12:23 PM
To: Bhatti, Shahzad
Cc: [hidden email]
Subject: Re: [Jersey] com.sun.jersey.api.container.ContainerException: Fatal issues found


On Oct 31, 2008, at 8:13 PM, Bhatti, Shahzad wrote:

> Thanks Paul, that should fix html based request but why is json  
> method also failing for that query.

Because there is a method parameter, JSONObject request.


> I am using JSONObject for other GET requests and that's working.

Are you sure? can you send me such working examples where JSONObject  
is being used as a non-annotated method parameter?

Any @GET annotated resource method with an non-annotated method  
parameter should fail.

Paul.

>
>
>
> -----Original Message-----
> From: [hidden email] [mailto:[hidden email]]
> Sent: Friday, October 31, 2008 12:06 PM
> To: [hidden email]
> Cc: Bhatti, Shahzad
> Subject: Re: [Jersey]  
> com.sun.jersey.api.container.ContainerException: Fatal issues found
>
> Hi,
>
>     @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 {
>     }
>
> The above GET methods are in error because there is a method parameter
> that is not annotated and Jersey assumes that those correspond to
> request entities. Validation of the resource class is failing. GETs
> should not really have entities associated with the request so Jersey
> disallows it. The details should be in the logs should tell you why
> validation fails.
>
> If you want to get access to the all query parameters do the  
> following:
>
>     @GET
>     @Produces("application/xml")
>     public WorkflowTaskResponse queryTasksByXml(
>         @Context UriInfo ui,
>         @DefaultValue("0") @QueryParam("page") int page) {
>         MultivaluedMap<String, String> params =
> ui.getQueryParameters();
>    }
>
> Paul.
>
> On Oct 31, 2008, at 7:50 PM, Bhatti, Shahzad wrote:
>
>> 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.
>>
>>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...