Why would “java.lang.IllegalStateException: The resource configuration is not modifiable in this context.” appear deploying Jersey app?

前端 未结 15 873
孤街浪徒
孤街浪徒 2020-11-30 15:06

I have created an app implementing REST services locally using:

Eclipse Indigo Jersey 2.4 Tomcat 7.0.47

When running locally using Eclipse, the services work

15条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-30 15:40

    In my case it was just a missing @PathParam("id") for the 'int id' declaration. Wrong code:

    @POST
    @Path("{id}/messages")
    public Response returnMessages(int id, Message[] msgs) {
    

    Corrected code:

    @POST
    @Path("{id}/messages")
    public Response returnMessages(@PathParam("id") int id, Message[] msgs) {
    

提交回复
热议问题