users@jersey.java.net

[Jersey] Re: Uploading file to web-service: The resource configuration is not modifiable in this context

From: Pavel Bucek <pavel.bucek_at_oracle.com>
Date: Wed, 09 Sep 2015 14:07:54 +0200

Hi,

please don't combine com.sun.jersey (1.x) and org glassfish.jersey (2.x)
jars in single application. Your configuration does not make much sense
and I would be very surprised if it is able to process any request.

Plus - you should be using same version of all Jersey related dependencies.

Regards,
Pavel

On 09/09/15 12:45, zmicerkashlach wrote:
> Hi,
>
> I'm implementing REST web-service using jersey.
>
> *Dependencies:*
> <dependency>
> <groupId>com.sun.jersey</groupId>
> <artifactId>jersey-server</artifactId>
> <version>1.9</version>
> </dependency>
> <dependency>
> <groupId>org.glassfish.jersey.media</groupId>
> <artifactId>jersey-media-multipart</artifactId>
> <version>2.21</version>
> <exclusions>
> <exclusion>
> <groupId>org.glassfish.jersey.core</groupId>
> <artifactId>jersey-common</artifactId>
> </exclusion>
> </exclusions>
> </dependency>
>
>
> *Webservice:*
>
> @POST
> @Path("/upload")
> @Consumes(MediaType.MULTIPART_FORM_DATA)
> @Produces(MediaType.APPLICATION_JSON)
> public Object upload(@FormDataParam("file") InputStream
> uploadedInputStream,
> @FormDataParam("file") FormDataContentDisposition fileDetail
> )
>
> *WebServiceConfig:*
> @ApplicationPath("/")
> public class ConWebServiceConfig extends Application {
> @Override
> public Set<Class&lt;?>> getClasses() {
> Set<Class&lt;?>> s = new HashSet<Class&lt;?>>();
> s.add(MultiPartFeature.class);
> s.add(ConWebService.class);
> return s;
> }
> }
>
> This gives me
> java.lang.IllegalStateException: The resource configuration is not
> modifiable in this context
> in Tomcat.
>
> What should I check to resolve it? Thanks.
>
>
>
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Uploading-file-to-web-service-The-resource-configuration-is-not-modifiable-in-this-context-tp7583422.html
> Sent from the Jersey mailing list archive at Nabble.com.