-
15. Re: Easy way to implement Jackson in Jboss AS7
jacktrades Sep 12, 2012 6:10 PM (in response to rcd) -
16. Re: Easy way to implement Jackson in Jboss AS7
rcd Sep 12, 2012 9:28 PM (in response to jacktrades)I didn't use any archetypes when Mavenizing my projects. Just right-click on each project and do Configure -> Convert to Maven Project.
-
17. Re: Easy way to implement Jackson in Jboss AS7
jacktrades Sep 13, 2012 10:22 AM (in response to rcd)So I should add this to pom.xml in WAR project?
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson-provider</artifactId>
<scope>provided</scope>
<version>2.3.2.Final</version>
</dependency>
right?
-
18. Re: Easy way to implement Jackson in Jboss AS7
rcd Sep 13, 2012 10:37 AM (in response to jacktrades)Correct.
-
19. Re: Easy way to implement Jackson in Jboss AS7
jacktrades Sep 13, 2012 10:50 AM (in response to rcd)How can I convince my self that is jackson marshalling JSON?
I just did that, is deploying correctly, but JSON output is the same.
-
20. Re: Easy way to implement Jackson in Jboss AS7
rcd Sep 13, 2012 11:19 AM (in response to jacktrades)Make sure you have the RESTEasy Jackson module in your MANIFEST.MF or in jboss-deployment-structure.xml. I'm not sure how you would check that Jackson is marshalling your POJOs. In my projects, using Jackson 2.x and the Jackson JAX-RS integration, I provide Jackson with a specially configured ObjectMapper instance, and I know Jackson is being used for marshalling/unmarshalling because of some configuration options I've set that affect the output.
-
21. Re: Easy way to implement Jackson in Jboss AS7
jacktrades Sep 13, 2012 11:59 AM (in response to rcd)JSON Format is still the same, so most probably that it's using default configuration.
Maven automatically generated this for manifest.mf:
Manifest-Version: 1.0
Built-By: john
Build-Jdk: 1.7.0_04
Created-By: Maven Integration for Eclipse
Dependencies: org.jboss.resteasy.resteasy-jackson-provider
Jboss showed these warnings:
12:56:09,388 WARN [org.jboss.as.dependency.private] (MSC service thread 1-6) JBAS018567: Deployment "deployment.truckcompany.ear.ear.truckcompany.web-0.0.1-SNAPSHOT.war" is using a private module ("org.jboss.resteasy.resteasy-jackson-provider:main") which may be changed or removed in future versions without notice.
12:56:09,391 WARN [org.jboss.as.dependency.private] (MSC service thread 1-6) JBAS018567: Deployment "deployment.truckcompany.ear.ear.truckcompany.web-0.0.1-SNAPSHOT.war" is using a private module ("org.jboss.resteasy.resteasy-jackson-provider:main") which may be changed or removed in future versions without notice.
12:56:09,394 WARN [org.jboss.as.dependency.private] (MSC service thread 1-1) JBAS018567: Deployment "deployment.truckcompany.ear.ear" is using a private module ("org.jboss.resteasy.resteasy-jackson-provider:main") which may be changed or removed in future versions without notice.
12:56:09,394 WARN [org.jboss.as.dependency.private] (MSC service thread 1-3) JBAS018567: Deployment "deployment.truckcompany.ear.ear.truckcompany.ejb-0.0.1-SNAPSHOT.jar" is using a private module ("org.jboss.resteasy.resteasy-jackson-provider:main") which may be changed or removed in future versions without notice.
-
22. Re: Easy way to implement Jackson in Jboss AS7
rcd Sep 13, 2012 12:21 PM (in response to jacktrades)That looks right to me. The warnings are just telling you that the RESTEasy Jackson provider is a private dependency and that it may be changed or removed without warning in future versions of JBoss. I think it's unlikely it would be removed completely, but I find it more likely that the RESTEasy developers might update their Jackson provider to use Jackson 2.x, which might cause headaches for you later on. This is why I prefer to bundle any non-public dependencies with my EARs, so I have control over the versions of libraries I depend on.
-
23. Re: Easy way to implement Jackson in Jboss AS7
jensaug Jan 9, 2013 10:49 AM (in response to rcd)Hello Rich,
Could you pls provide your full pom.xml, showing how to make AS7 produce JSON with jackson-jaxrs-json-provider and Jackson 2.x?
thanks,
Jens
-
24. Re: Easy way to implement Jackson in Jboss AS7
rcd Jan 9, 2013 5:06 PM (in response to jensaug)Jens,
These are the artifacts I have in my POM, with the version.jackson property defined as 2.1.1.
{code}
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-joda</artifactId>
<version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.jaxrs</groupId>
<artifactId>jackson-jaxrs-json-provider</artifactId>
<version>${version.jackson}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-afterburner</artifactId>
<version>${version.jackson}</version>
</dependency>
{code}
Note that if you're using the RESTEasy implementation of JAX-RS that ships with AS7, you also need to disable the Jackson 1.x provider that comes with it. I did this by creating a jboss-deployment-structure.xml in my EAR's /META-INF with this content:
{code}
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.1">
<sub-deployment name="web-service.war">
<exclusions>
<module name="org.jboss.resteasy.resteasy-jackson-provider"/>
</exclusions>
</sub-deployment>
</jboss-deployment-structure>
{code}
-
25. Re: Easy way to implement Jackson in Jboss AS7
jensaug Jan 9, 2013 6:11 PM (in response to rcd)Thanks alot for your quick response!
I was just composing a response to myselft since I just got it to work (doing /almost/ the same, though without the afterburner dep and using <deployment> element instead of <sub-deployment>).
Still - thanks. Cyclic dependencies in domain now handled....
cheers,
Jens