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

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

    In my case, I had a Jersey POST resource for file uploads. The resource specified the parameter: @FormDataParam("file") InputStream file

    and consumed MediaType.MULTIPART_FORM_DATA.

    To fix the issue, I had to add the following to the Jersey REST configuration in my web.xml file:

    
        jersey.config.server.provider.classnames
        org.glassfish.jersey.media.multipart.MultiPartFeature
    
    

提交回复
热议问题