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

前端 未结 15 872
孤街浪徒
孤街浪徒 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:28

    Another possible reason for getting that exception is if you try passing in a form parameter using @FormParam with an HTTP Get (@GET). It should complain since you cannot pass data in the form body with an HTTP Get. An example of code that would throw this exception is...

    @GET
    @Path("test-get")
    @Consumes( MediaType.APPLICATION_FORM_URLENCODED )
     public String testGet(@FormParam("name1") String name1) {
    

提交回复
热议问题