Activate JaxbAnnotationModule on Wildfly

2019-04-28 04:34发布

问题:

I am trying to setup a REST service on Wildfly 8 that returns JSON with customized enum Values. I know that Wildfy uses Jackson 2.3 for the serialisation. I also know that when registering the JaxbAnnotationModule with the Jackson ObjectMapper the serializer produces the correct result. The question is, how do i configure my Wildfly Instance or my web-project to use this module.

OK, to make this more clear, a simple example.

First, this works properly and generates the result I need.

@XmlEnum
public enum TestEnum
    @XmlEnumValue("2")
    TWO; 
}

public class Test {
    public static void main(String[] args) {

    ObjectMapper mapper = new ObjectMapper();
    JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
    mapper.registerModule(jaxbModule);
    try {
        mapper.writeValue(System.out, TestEnum.TWO);
    } catch (Exception e) {
    }
}

This Produces the correct output: "2"

Now, to my problem service

@Path("test")
@RequestScoped
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class TestRestService {

    @GET
    @Path("/json")
    @Produces({MediaType.APPLICATION_JSON})
    public TestEnum testJson() {
        return TestEnum.TWO;
    }
}

This returns "TWO" which is not what i intended.

I did not configure anything within the "jboss-deployment-structure.xml" nor the "web.xml".

I am not using maven so any pom.xml solutions won't work for me besides pointing me in the direction.

I read the documentation here but could not find the option to enable the JaxbAnnotationModule.

Any possibility to customize the enum value that works for JSON and XML would be apreciated.

----- UPDATE -----

In theory, the solution was already posted here

If I use that solution try to use the Jackson Mapper with the JaxbAnnotationModule it should create the correct output.

@Provider
@Produces(MediaType.APPLICATION_JSON)
public class JacksonMapper implements MessageBodyWriter<Object> {

  ObjectMapper mapper;

  @PostConstruct
     void init() {
    mapper = new ObjectMapper();
    JaxbAnnotationModule jaxbModule = new JaxbAnnotationModule();
    // this is what is causing the current problem
    mapper.registerModule(jaxbModule);
  }

  @Override
  public boolean isWriteable(Class<?> aClass, Type type,
      Annotation[] annotations, MediaType mediaType) {
    return true;
  }

  @Override
  public long getSize(Object object, Class<?> aClass, Type type,
      Annotation[] annotations, MediaType mediaType) {
    return 0;
  }

  @Override
  public void writeTo(Object object, Class<?> aClass, Type type,
      Annotation[] annotations, MediaType mediaType,
      MultivaluedMap<String, Object> stringObjectMultivaluedMap,
      OutputStream outputStream) throws IOException,
      WebApplicationException {
    mapper.writeValue(outputStream, object);
  }

}

In my jboss-deployment-structure.xml i activate the necessary modules (or so i would think)

<dependencies>
  <module name="org.jboss.resteasy.resteasy-jackson2-provider" services="import" />
  <module name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" />
</dependencies>

when calling my test method i get a ClassNotFound exception on javax.xml.bind.annotation.XmlElement which should have been included by including "com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider" since this is depending on "javax.ws.rs.api" which is then including "javax.xml.bind.api" which contains the missing class.

If i do not register the created jaxbModule to the mapper, all works fine except that the annotation @XmlEnumValue is ignored. I get the same output as without the changes.

Any Suggestions?

10:30:10,958 INFO  [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found TestRest.war in deployment directory. To trigger deployment create a file called TestRest.war.dodeploy
10:30:11,012 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "TestRest.war" (runtime-name: "TestRest.war")
10:30:12,464 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016002: Processing weld deployment TestRest.war
10:30:12,648 INFO  [org.hibernate.validator.internal.util.Version] (MSC service thread 1-5) HV000001: Hibernate Validator 5.0.2.Final
10:30:12,906 INFO  [org.jboss.weld.deployer] (MSC service thread 1-6) JBAS016005: Starting Services for CDI deployment: TestRest.war
10:30:12,948 INFO  [org.jboss.weld.Version] (MSC service thread 1-6) WELD-000900: 2.1.1 (Final)
10:30:13,004 INFO  [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016008: Starting weld service for deployment TestRest.war
10:30:14,832 INFO  [org.jboss.resteasy.spi.ResteasyDeployment] (MSC service thread 1-2) Deploying javax.ws.rs.core.Application: class com.test.rest.JaxRsActivator$Proxy$_$$_WeldClientProxy
10:30:14,923 INFO  [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017534: Register web context: /TestRest
10:30:15,028 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "TestRest.war" (runtime-name : "TestRest.war")
10:30:55,359 WARN  [org.jboss.resteasy.core.ExceptionHandler] (default task-1) Unknown exception while executing GET /test/json: org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke private void com.test.utility.JacksonMapper.init() on com.test.utility.JacksonMapper@65a4c446
   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:91) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:72) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:95) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.injection.producer.BeanInjectionTarget.postConstruct(BeanInjectionTarget.java:63) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.resteasy.cdi.JaxrsInjectionTarget.postConstruct(JaxrsInjectionTarget.java:59) [resteasy-cdi-3.0.6.Final.jar:]
   at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:153) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:94) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:98) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:78) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at com.test.utility.JacksonMapper$Proxy$_$$_WeldClientProxy.isWriteable(Unknown Source) [classes:]
   at org.jboss.resteasy.spi.ResteasyProviderFactory.resolveMessageBodyWriter(ResteasyProviderFactory.java:2118) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.spi.ResteasyProviderFactory.getMessageBodyWriter(ResteasyProviderFactory.java:2096) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:62) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.6.Final.jar:]
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
   at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:87) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70)
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
   at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]
   at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]
   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:89) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   ... 43 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
   at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:111) [jackson-module-jaxb-annotations-2.2.3.jar:]
   at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:98) [jackson-module-jaxb-annotations-2.2.3.jar:]
   at com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.setupModule(JaxbAnnotationModule.java:57) [jackson-module-jaxb-annotations-2.2.3.jar:]
   at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:524) [jackson-databind-2.2.3.jar:]
   at com.test.utility.JacksonMapper.init(JacksonMapper.java:29) [classes:]
   ... 48 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlElement from [Module "com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider:main" from local module loader @722b302 (finder: local module finder @77164bf6 (roots: C:\jboss\wildfly-8.0.0.CR1\modules,C:\jboss\wildfly-8.0.0.CR1\modules\system\layers\base))]
   at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
   ... 53 more

10:30:55,371 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /TestRest/test/json: org.jboss.resteasy.spi.UnhandledException: org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke private void com.test.utility.JacksonMapper.init() on com.test.utility.JacksonMapper@65a4c446
   at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:247) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:149) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:432) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:376) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.6.Final.jar:]
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
   at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:87) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:70)
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:67) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:70) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.Connectors.executeRootHandler(Connectors.java:164) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:654) [undertow-core-1.0.0.Beta30.jar:1.0.0.Beta30]
   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_04]
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_04]
   at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_04]
Caused by: org.jboss.weld.exceptions.WeldException: WELD-000049: Unable to invoke private void com.test.utility.JacksonMapper.init() on com.test.utility.JacksonMapper@65a4c446
   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:91) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.postConstruct(DefaultLifecycleCallbackInvoker.java:72) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.injection.producer.BasicInjectionTarget.postConstruct(BasicInjectionTarget.java:95) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.injection.producer.BeanInjectionTarget.postConstruct(BeanInjectionTarget.java:63) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.resteasy.cdi.JaxrsInjectionTarget.postConstruct(JaxrsInjectionTarget.java:59) [resteasy-cdi-3.0.6.Final.jar:]
   at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:153) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:94) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:98) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:78) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   at com.test.utility.JacksonMapper$Proxy$_$$_WeldClientProxy.isWriteable(Unknown Source) [classes:]
   at org.jboss.resteasy.spi.ResteasyProviderFactory.resolveMessageBodyWriter(ResteasyProviderFactory.java:2118) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.spi.ResteasyProviderFactory.getMessageBodyWriter(ResteasyProviderFactory.java:2096) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.ServerResponseWriter.writeNomapResponse(ServerResponseWriter.java:62) [resteasy-jaxrs-3.0.6.Final.jar:]
   at org.jboss.resteasy.core.SynchronousDispatcher.writeResponse(SynchronousDispatcher.java:427) [resteasy-jaxrs-3.0.6.Final.jar:]
   ... 30 more
Caused by: java.lang.reflect.InvocationTargetException
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_04]
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_04]
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_04]
   at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_04]
   at org.jboss.weld.injection.producer.DefaultLifecycleCallbackInvoker.invokeMethods(DefaultLifecycleCallbackInvoker.java:89) [weld-core-impl-2.1.1.Final.jar:2013-12-03 09:59]
   ... 43 more
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlElement
   at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:111) [jackson-module-jaxb-annotations-2.2.3.jar:]
   at com.fasterxml.jackson.module.jaxb.JaxbAnnotationIntrospector.<init>(JaxbAnnotationIntrospector.java:98) [jackson-module-jaxb-annotations-2.2.3.jar:]
   at com.fasterxml.jackson.module.jaxb.JaxbAnnotationModule.setupModule(JaxbAnnotationModule.java:57) [jackson-module-jaxb-annotations-2.2.3.jar:]
   at com.fasterxml.jackson.databind.ObjectMapper.registerModule(ObjectMapper.java:524) [jackson-databind-2.2.3.jar:]
   at com.test.utility.JacksonMapper.init(JacksonMapper.java:29) [classes:]
   ... 48 more
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.annotation.XmlElement from [Module "com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider:main" from local module loader @722b302 (finder: local module finder @77164bf6 (roots: C:\jboss\wildfly-8.0.0.CR1\modules,C:\jboss\wildfly-8.0.0.CR1\modules\system\layers\base))]
   at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:197) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:443) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:431) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:373) [jboss-modules.jar:1.3.0.Final]
   at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:118) [jboss-modules.jar:1.3.0.Final]
   ... 53 more

回答1:

OP posted his solution:

It turns out that the the module description hast to be updated manually as described here even though the class should have been referenced.

SOLUTION: Update the file: wildfly-8.0.0.CR1\modules\system\layers\base\com\fasterxml\jackson\jaxrs\jackson-jaxrs-json-provider\main\module.xml

<module xmlns="urn:jboss:module:1.1" name="com.fasterxml.jackson.jaxrs.jackson-jaxrs-json-provider">
     <resources>
        <resource-root path="jackson-jaxrs-json-provider-2.2.3.jar"/>
        <resource-root path="jackson-jaxrs-base-2.2.3.jar"/>
        <resource-root path="jackson-module-jaxb-annotations-2.2.3.jar"/>
    </resources>

    <dependencies>
        <module name="javax.api"/>
        <module name="javax.ws.rs.api"/>
        <!-- Add this line -->
        <module name="javax.xml.bind.api" />

        <module name="com.fasterxml.jackson.core.jackson-annotations"/>
        <module name="com.fasterxml.jackson.core.jackson-core"/>
        <module name="com.fasterxml.jackson.core.jackson-databind"/>
    </dependencies>
</module>