users@jersey.java.net

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

From: Dzmitry Kashlach <dzmitry.kashlach_at_blazemeter.com>
Date: Sun, 13 Sep 2015 17:35:56 +0300

> Why do you exclude jersey-common?
It was unsuccesfull try to get rid of "The resource configuration is not
modifiable in this context"

> You might want to check out prepared and tested example from Jersey
workspace [1];
Yes, I've already done it.
But on requesting

curl -X POST -F "part=@/home/zmicer/Documents/backup-config.xml"
http://localhost:8080/multipart-webapp-1.0/form/part-file-name

I receive "The requested resource is not available."
I'm absolutely sure, that "http://localhost:8080/multipart-webapp-1.0" is
correct URL.
What could I miss?

Here is my project at GITHUB.
https://github.com/dzmitrykashlach/webservice





On Wed, Sep 9, 2015 at 4:17 PM, Pavel Bucek <pavel.bucek_at_oracle.com> wrote:

> Why do you exclude jersey-common?
>
> You might want to check out prepared and tested example from Jersey
> workspace [1]; that is something which already works, you can deploy it and
> modify - it should be more straightforward than creating something from
> scratch.
>
> Also, if you want help with your existing project, please share it
> somewhere (github?), it's hard to guess what's wrong when we don't have
> full context.
>
> Regards,
> Pavel
>
>
> [1] https://github.com/jersey/jersey/tree/2.21/examples/multipart-webapp
>
> On 09/09/15 15:00, zmicerkashlach wrote:
>
> Thanks for quick reply.
> Sorry, I've forgotten one more dependency:
>
> <dependency>
> <groupId>org.glassfish.jersey.bundles</groupId>
> <artifactId>jaxrs-ri</artifactId>
> <version>2.21</version></dependency>
>
> > I would be very surprised if it is able to process any request.
>
> My initial configuration worked for GET,DELETE and POST(w\o body) requests. Only POST requests with multi-part body are failed.
>
> After changing
>
> *com.sun.jersey:jersey-server-1.9* to *org.glassfish.jersey.core:jersey-server-2.21* I'm still getting "The resource configuration is not modifiable in this context"
>
> I'm dealing with jersey at first time, so, I guess, I've mismatched something.
>
>
> On Wed, Sep 9, 2015 at 3:06 PM, Pavel Bucek-2 [via Jersey] <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=7583424&i=0>> wrote:
>
>> 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.
>>
>>
>> ------------------------------
>> If you reply to this email, your message will be added to the discussion
>> below:
>>
>> http://jersey.576304.n2.nabble.com/Uploading-file-to-web-service-The-resource-configuration-is-not-modifiable-in-this-context-tp7583422p7583423.html
>> To unsubscribe from Uploading file to web-service: The resource
>> configuration is not modifiable in this context, click here.
>> NAML
>> <http://jersey.576304.n2.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
>
> --
>
> Thanks,
> Dzmitry Kashlach
>
> Blazemeter LTD <http://blazemeter.com/>: Load Testing Cloud | Software
> Developer <http://lnkd.in/5W8s8k>
>
> Tel. +375291142462
> Skype: dmitry.kashlach
>
>
> ------------------------------
> View this message in context: Re: Uploading file to web-service: The
> resource configuration is not modifiable in this context
> <http://jersey.576304.n2.nabble.com/Uploading-file-to-web-service-The-resource-configuration-is-not-modifiable-in-this-context-tp7583422p7583424.html>
> Sent from the Jersey mailing list archive
> <http://jersey.576304.n2.nabble.com/> at Nabble.com.
>
>
>


-- 
Thanks,
   Dzmitry Kashlach
Blazemeter LTD <http://blazemeter.com/>: Load Testing Cloud | Software
Developer <http://lnkd.in/5W8s8k>
Tel. +375291142462
Skype: dmitry.kashlach