tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Romain Manni-Bucau <rmannibu...@gmail.com>
Subject Re: Tomee 1.7.4 tries to parse a binary multipart as json
Date Wed, 28 Dec 2016 16:01:16 GMT
2016-12-28 16:56 GMT+01:00 Kirys <kirys@neoteroi.org>:

> On 28/12/2016 16:17, Romain Manni-Bucau wrote:
>
>> johnzon declares
>>
>> @Produces("application/json")
>> @Consumes("application/json")
>>
>>
>> so it shouldnt match the content-type of your request
>>
>>
>> this is what is weird
>>
>>
>> a workaround is to configure it in openejb-jar.xml/resources.xml and
>> add to ignorable types MultipartBody
>>
>
> Ok tried but i miss some dependacies
> java.lang.NoClassDefFoundError: javax/json/spi/JsonProvider
>
>
see comment in your pom


>
> this is what it is currently into my resources.xml:
>     <Service id="gasceJSProvider" class-name="org.apache.johnzon
> .jaxrs.ConfigurableJohnzonProvider">
>         # 1M
>         maxSize = 1048576
>         bufferSize = 1048576
>
>         # ordered attributes
>         attributeOrder = $order
>
>         accessModeName = field
>         supportHiddenAccess = true
>         doCloseOnStreams = false
>         version = 2
>         skipNull = true
>         skipEmptyArray = false
>         pretty=true
>
>
>         # Additional types to ignore
>         ignores = org.apache.cxf.jaxrs.ext.multipart.MultipartBody,
> javax.ws.rs.core.StreamingOutput
>     </Service>
>
>     <pojo-deployment class-name="com.gasce.portal.mvc.GasceWebApp">
>         <properties>
>             cxf.jaxrs.providers = com.gasce.portal.app.BinaryProvider,
> org.apache.cxf.jaxrs.provider.MultipartProvider,
> org.apache.openejb.server.cxf.rs.EJBAccessExceptionMapper,
> org.apache.cxf.jaxrs.provider.BinaryDataProvider,
> org.apache.cxf.jaxrs.provider.DataSourceProvider, gasceJSProvider
>
>             # this one is not mandatory but recommanded
>             cxf.jaxrs.skip-provider-scanning = true
>         </properties>
>     </pojo-deployment>
>
>
you dont need the cxf ones I think, they should be there by default


>
> pom dependencies
>
>

remove geronimo-json_1.0_spec or javax.json-api (I'd recommand to remove
the javax one since we tested the geronimo one extensively with johnzon)

both are the "same" and can lead to the classcast error


>         <dependency>
>             <groupId>org.apache.geronimo.specs</groupId>
> <artifactId>geronimo-json_1.0_spec</artifactId>
>             <version>1.0-alpha-1</version>
>         </dependency>
>         <dependency>
>             <groupId>javax.json</groupId>
>             <artifactId>javax.json-api</artifactId>
>             <version>1.0</version>
>         </dependency>
>
>         <dependency>
>             <groupId>org.glassfish</groupId>
>             <artifactId>javax.json</artifactId>
>             <version>1.0.4</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.johnzon</groupId>
>             <artifactId>johnzon-core</artifactId>
>             <version>${johnzon.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.johnzon</groupId>
>             <artifactId>johnzon-mapper</artifactId>
>             <version>${johnzon.version}</version>
>         </dependency>
>         <dependency>
>             <groupId>org.apache.johnzon</groupId>
>             <artifactId>johnzon-jaxrs</artifactId>
>             <version>${johnzon.version}</version>
>         </dependency>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message