Vote count:
0
I want to configurate the json mapper of jboss, so i find this code and is seem good
@Provider
@Consumes({MediaType.APPLICATION_JSON})
@Produces({MediaType.APPLICATION_JSON})
public class JacksonConfigurator extends ResteasyJacksonProvider {
private static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZ";
@Inject
private static Logger log;
public JacksonConfigurator() {
super();
log.info("configuring date handling");
ObjectMapper mapper = _mapperConfig.getConfiguredMapper();
configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false);
configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
/*
SerializationConfig serConfig = mapper.getSerializationConfig();
serConfig.setDateFormat(new SimpleDateFormat(DATE_FORMAT));
serConfig.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
DeserializationConfig deserializationConfig = mapper.getDeserializationConfig();
deserializationConfig.setDateFormat(new SimpleDateFormat(DATE_FORMAT));*/
}
}
I can compile and deploy the project, but wen i try to make a call i get this:
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/core-rest-api].[fonctionnel.rs.RestApplication]] (http-/0.0.0.0:8001-1) JBWEB000235: Allocate exception for servlet fonctionnel.rs.RestApplication: java.lang.ClassNotFoundException: org.codehaus.jackson.jaxrs.JacksonJsonProvider from [Module "core-ear-1.0.0-SNAPSHOT.core-rest-api-1.0.0-SNAPSHOT.war:main" from Service Module Loader]
I tryed to change the pom.xml from
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<scope>provided</scope>
</dependency>
to
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
</dependency>
And i get the error
ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/core-rest-api].[fonctionnel.rs.RestApplication]] (http-/0.0.0.0:8001-1) JBWEB000235: Allocate exception for servlet fonctionnel.rs.RestApplication: java.lang.LinkageError: loader constraint violation: when resolving overridden method "fonctionnel.rs.JacksonConfigurator$Proxy$_$$_WeldClientProxy.configure(Lorg/codehaus/jackson/JsonGenerator$Feature;Z)Lorg/codehaus/jackson/jaxrs/JacksonJsonProvider;" the class loader (instance of org/jboss/modules/ModuleClassLoader) of the current class, fonctionnel/rs/JacksonConfigurator$Proxy$_$$_WeldClientProxy, and its superclass loader (instance of org/jboss/modules/ModuleClassLoader), have different Class objects for the type _$$_WeldClientProxy used in the signature
So any know how to do this? How to config the jackson mapper in jboss 6.2 EAP or how to fix the problem?
asked 1 min ago
Configuration de mapper in Jboss 6.2 AEP
Aucun commentaire:
Enregistrer un commentaire