我正在使用 restcomm jain-slee 编写一个 IDR 发送者 java 应用程序
我使用如下的 json 解码来解码传入的 http post 请求 json 数据。
String postBody = getContentFromStream(event.getRequest().getInputStream());
ObjectMapper objectMapper = new ObjectMapper();
我为此目的使用了fastxml jackson。
import com.fasterxml.jackson.databind.ObjectMapper;
我将其部署在 WildFly Docker 容器中。尝试解码 jason 时出现此错误。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
我也添加到了 jboss-deployment-structure
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<module name="com.fasterxml.jackson.databind" export="true" />
</dependencies>
</deployment>
罐子也可以在
/opt/modules/system/layers/base/com/fasterxml/jackson/core/jackson-databind/main
我还没有一个可能的解决方案。需要一些帮助。
PS:我还添加了依赖项
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>resteasy-jackson2-provider</artifactId>
<version>3.0.8.Final</version>
<scope>provided</scope>
</dependency>