Restcomm jain-slee jackson NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper

164 views Asked by At

Im writing an IDR sender java application using restcomm jain-slee

Im using json decoding as bellow in order to decode the incoming http post request json data.

String postBody = getContentFromStream(event.getRequest().getInputStream());
ObjectMapper objectMapper = new ObjectMapper();

Im using fasterxml jackson for this purpose.

import com.fasterxml.jackson.databind.ObjectMapper;

And I'm deploying this in a WildFly Docker container. When trying to decode the jason I get this error. java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper

10:08:49,405 ERROR [org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl] (SLEE-EventRouterExecutor-6-thread-1) Caught throwable while routing EventContext[event type id = EventTypeID[name=net.java.slee.resource.http.events.incoming.request.POST,vendor=net.java.slee,version=1.0] , event = org.restcomm.slee.resource.http.events.HttpServletRequestEventImpl[id=13ec6b6e:171f3c2265a:-7ffc] , local ac = RA:HttpServletRA:ea25a320-102d-491c-a829-48c8c2554a3e , address = null , serviceID = null]: java.lang.NoClassDefFoundError: com/fasterxml/jackson/databind/ObjectMapper
    at lk.dialog.pd.idrsend.IdrSendSbb.onHttpPostRequest(IdrSendSbb.java:362)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.mobicents.slee.runtime.sbbentity.SbbEntityImpl.invokeEventHandler(SbbEntityImpl.java:480)
    at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.routeQueuedEvent(EventRoutingTaskImpl.java:378)
    at org.mobicents.slee.runtime.eventrouter.routingtask.EventRoutingTaskImpl.run(EventRoutingTaskImpl.java:125)
    at org.mobicents.slee.runtime.eventrouter.EventRouterExecutorImpl$EventRoutingTaskStatsCollector.run(EventRouterExecutorImpl.java:72)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
 Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.databind.ObjectMapper
    at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
    at org.mobicents.slee.container.component.deployment.classloading.URLClassLoaderDomainImpl.findClassLocallyLocked(URLClassLoaderDomainImpl.java:272)
    at org.mobicents.slee.container.component.deployment.classloading.URLClassLoaderDomainImpl.findClass(URLClassLoaderDomainImpl.java:242)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at org.mobicents.slee.container.component.deployment.classloading.URLClassLoaderDomainImpl.loadClass(URLClassLoaderDomainImpl.java:206)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 12 more

I have added to the jboss-deployment-structure also

<?xml version="1.0" encoding="UTF-8"?>  
<jboss-deployment-structure>  
<deployment>  
     <dependencies>  
          <module name="com.fasterxml.jackson.databind" export="true" />  
    </dependencies>  
</deployment>  

And also jar is available at

/opt/modules/system/layers/base/com/fasterxml/jackson/core/jackson-databind/main

I still haven't got a possible solution. Need some help.

PS : I also added the dependency

    <dependency>
        <groupId>org.jboss.resteasy</groupId>
        <artifactId>resteasy-jackson2-provider</artifactId>
        <version>3.0.8.Final</version>
        <scope>provided</scope>
    </dependency>
1

There are 1 answers

0
Tharaka Devinda On

Add the following lines at the end of WILDFLY_DIR/modules/system/layers/base/org/restcomm/slee/container/lib/main/module.xml

<module export="true" xmlns="urn:jboss:module:1.3" name="com.fasterxml.jackson.core.jackson-core"/>
<module export="true" xmlns="urn:jboss:module:1.3" name="com.fasterxml.jackson.core.jackson-annotations"/>
<module export="true" xmlns="urn:jboss:module:1.3" name="com.fasterxml.jackson.core.jackson-databind"/>

Got the reference from here which has another problem solved.