Topic
8 replies Latest Post - ‏2013-08-21T11:37:35Z by jp97
jp97
jp97
5 Posts
ACCEPTED ANSWER

Pinned topic Liberty 8.5.5 wink problem with multipart

‏2013-08-15T15:54:13Z |

If I deploy the same war file on was 8.5 the multipart code works.  On Liberty 8.5.5 I get the following error:

[8/15/13 11:45:31:182 EDT] 00000022 org.apache.wink.server.internal.RequestProcessor             I The following error occurred during the invocation of the handlers chain: WebApplicationException (415 - Unsupported Media Type) with message 'null' while processing PUT request sent to http://10.3.152.156:9081/ic-v1.6/rest/multipart/item

Here is a code snippet.

@Path("/multipart")
public class MultipartItemResource {
    private static final String COMPONENT_ID = MultipartItemResource.class.getSimpleName();

    @PUT
    @Consumes(MediaType.MULTIPART_FORM_DATA)
    @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
    public Response putMultipart(BufferedInMultiPart bimp) throws Exception {
        return Response.status(HttpStatus.CREATED.getCode()).build();
    }
}

The only difference is on was 8.5 my maven dependency is this:

        <dependency>
            <groupId>org.apache.wink</groupId>
            <artifactId>wink-server</artifactId>
            <version>1.1.1-incubating</version>
            <scope>provided</scope>
        </dependency>

and on Liberty 8.5.5 I remove the provided.

 

Any ideas on how to make this work?

  • Eric.Kou
    Eric.Kou
    4 Posts
    ACCEPTED ANSWER

    Re: Liberty 8.5.5 wink problem with multipart

    ‏2013-08-20T07:47:21Z  in response to jp97
    Is this Maven dependency from your app's pom.xml?
    Do you have Wink binary files integrated in your app?
     
    • jp97
      jp97
      5 Posts
      ACCEPTED ANSWER

      Re: Liberty 8.5.5 wink problem with multipart

      ‏2013-08-20T13:38:56Z  in response to Eric.Kou

      Yes, it is in my apps pom.xml.

      No, unless I misunderstand the question.

  • VB3C_Wendy_Raschke
    VB3C_Wendy_Raschke
    14 Posts
    ACCEPTED ANSWER

    Re: Liberty 8.5.5 wink problem with multipart

    ‏2013-08-20T14:33:37Z  in response to jp97

    The request URI contains "multipart/item" and I don't see "item" as a path in your resource class or in the subresource putMultipart()--I'm just going to assume that putMultipart() is the matching method.

     

    What does your request's Content-Type header look like? Is its value "multipart/form-data"? Assuming that the method you show is the matching one, then the lack of that header or the lack of that value for the header (if it's there) is the only reason why I can think that the particular error is occurring.

    • jp97
      jp97
      5 Posts
      ACCEPTED ANSWER

      Re: Liberty 8.5.5 wink problem with multipart

      ‏2013-08-20T14:41:49Z  in response to VB3C_Wendy_Raschke

      It matches what I have in the real code.  I must of deleted the word "item" when copying it into this post.

      Its multipart/form-data and has boundary in it.

      Using the same war file on WAS 8.5 works with the same rest client posting the message.

      • VB3C_Wendy_Raschke
        VB3C_Wendy_Raschke
        14 Posts
        ACCEPTED ANSWER

        Re: Liberty 8.5.5 wink problem with multipart

        ‏2013-08-20T14:49:39Z  in response to jp97

        So you say it works on *traditional WebSphere, but not on Liberty? Is there any way you can enable trace for org.apache.wink.*=all:com.ibm.ws.jaxrs.*=all:com.ibm.websphere.jaxrs.*=all, make the failing request, and then attach the resulting trace?

        • jp97
          jp97
          5 Posts
          ACCEPTED ANSWER

          Re: Liberty 8.5.5 wink problem with multipart

          ‏2013-08-20T17:05:47Z  in response to VB3C_Wendy_Raschke

          Yes, it works on websphere, but not liberty.

           

          Here is the trace from startup, send one request, then shutdown.

          Attachments

        • This reply was deleted by jp97 2013-08-20T17:37:45Z.
  • Eric.Kou
    Eric.Kou
    4 Posts
    ACCEPTED ANSWER

    Re: Liberty 8.5.5 wink problem with multipart

    ‏2013-08-21T07:50:24Z  in response to jp97

    Here is my guess, the Multipart function you used is third party API provided by Wink. On Liberty it controls visibility of third-party API to your application, by default it is invisible.

    You might need to configure apiTypeVisibility in your server.xml to enable it. Below is one example for you. Note the apiTypeVisibility attribute has "third-party" in the list. Replace the WAR file to your own application name. If you are using drop-in folder, please move the app to folder "apps" first.

    ===========

    <server description="new server">

    <!-- Enable features -->
    <featureManager>
    <feature>jsp-2.2</feature>
    <feature>jaxrs-1.1</feature>
    </featureManager>

    <httpEndpoint id="defaultHttpEndpoint"
    host="localhost"
    httpPort="9080"
    httpsPort="9443" />

    <application id="demors" name="demors" type="war" location="demors.war" >
    <classloader apiTypeVisibility="spec, ibm-api, third-party"/>
    </application>
    </server>

     

     

    • jp97
      jp97
      5 Posts
      ACCEPTED ANSWER

      Re: Liberty 8.5.5 wink problem with multipart

      ‏2013-08-21T11:37:35Z  in response to Eric.Kou

      That is what it was.  Adding that one line fixed it.  Thank you so much!