Hello,

no matter how hard I try I just cannot get TomEE to use Jackson instead of
Johnzon. Want to use Jersey with Jackson

I tried to:
 - Set the providers "cxf.jaxrs.providers" in openejb-jar.xml 
  ( log entry: org.apache.openejb.server.rest.RESTService.deployApplication
Registered JAX-RS Configuration: ...)
 - Extend Jackson provider as

@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class OurJsonProvider
        extends com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider {}

I have pom dependencies:
    <dependency>
            <groupId>com.fasterxml.jackson.jaxrs</groupId>
            <artifactId>jackson-jaxrs-json-provider</artifactId>
            <version>2.9.0</version>
     </dependency>

     <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
            <version>2.26-b09</version>
      </dependency>

etc.

Yet whenever I try to serialize object I get

Caused by: org.hibernate.LazyInitializationException: failed to lazily
initialize a collection of role: ..., could not initialize proxy - no
Session
        at
org.hibernate.collection.internal.AbstractPersistentCollection.throwLazyInitializationException(AbstractPersistentCollection.java:582)
        at
org.hibernate.collection.internal.AbstractPersistentCollection.withTemporarySessionIfNeeded(AbstractPersistentCollection.java:201)
        at
org.hibernate.collection.internal.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:561)
        at
org.hibernate.collection.internal.AbstractPersistentCollection.read(AbstractPersistentCollection.java:132)
        at
org.hibernate.collection.internal.PersistentBag.iterator(PersistentBag.java:277)
        at
org.apache.*johnzon*.mapper.MappingGeneratorImpl.writeValue(MappingGeneratorImpl.java:315)

and a lot more johnzon stacktracke lines...

Obviously because I have my properties annotated with Jackson and the object
is serialized with Johnzon instead and it's ignoring my annotations.

What am I doing wrong?

Thank you



--
View this message in context: 
http://tomee-openejb.979440.n4.nabble.com/Cannot-get-TomEE-to-use-Jackson-tp4682409.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Reply via email to