java.lang.ClassNotFoundException: org.codehaus.jackson.map.JsonSerializableWithType

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19001719/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-12 13:15:48  来源:igfitidea点击:

java.lang.ClassNotFoundException: org.codehaus.Hymanson.map.JsonSerializableWithType

javajsongoogle-app-enginejerseyHymanson

提问by code511788465541441

I got Hymanson 2.2.3 in my buildpath but i still get this error. anyone know why?

我的构建路径中有 Hymanson 2.2.3,但我仍然收到此错误。有谁知道为什么?

enter image description here

在此处输入图片说明

com.sun.jersey.core.spi.component.ProviderFactory __getComponentProvider: The provider class, class com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider, could not be instantiated. Processing will continue but the class will not be utilized
java.lang.SecurityException: Unable to get members for class com.sun.jersey.json.impl.provider.entity.JSONWithPaddingProvider
    at com.google.appengine.runtime.Request.process-244548b7ddf4520b(Request.java)
    at java.lang.Class.getDeclaredMethods(Class.java:256)
    at com.sun.jersey.core.reflection.MethodList.getAllDeclaredMethods(MethodList.java:70)
    at com.sun.jersey.core.reflection.MethodList.<init>(MethodList.java:64)
    at com.sun.jersey.core.spi.component.ComponentConstructor.getPostConstructMethods(ComponentConstructor.java:131)
    at com.sun.jersey.core.spi.component.ComponentConstructor.<init>(ComponentConstructor.java:123)
    at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:165)
    at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:137)
    at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:256)
    at com.sun.jersey.core.spi.component.ProviderServices.getServices(ProviderServices.java:160)
    at com.sun.jersey.core.spi.factory.MessageBodyFactory.initWriters(MessageBodyFactory.java:207)
    at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:163)
    at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1277)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.access0(WebApplicationImpl.java:169)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.f(WebApplicationImpl.java:775)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.f(WebApplicationImpl.java:771)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:771)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:766)
    at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:488)
    at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
    at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:609)
    at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:210)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
    at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
    at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685)
    at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
    at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250)
    at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
    at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467)
    at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:435)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:442)
    at com.google.tracing.CurrentContext.runInContext(CurrentContext.java:186)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:306)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:298)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:439)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    ... 41 more
Caused by: java.lang.NoClassDefFoundError: org/codehaus/Hymanson/map/JsonSerializableWithType
    at com.google.appengine.runtime.Request.process-244548b7ddf4520b(Request.java)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:794)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
    at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source)
    ... 43 more
Caused by: java.lang.ClassNotFoundException: org.codehaus.Hymanson.map.JsonSerializableWithType
    at com.google.appengine.runtime.Request.process-244548b7ddf4520b(Request.java)
    ... 41 more

采纳答案by M. Abbas

You need to add Hymanson-mapper-aslin your classpath.

您需要添加Hymanson-mapper-asl到您的类路径中。

You can find it here

你可以在这里找到

回答by StaxMan

Exception indicates that some other library or framework is using Hymanson 1.x, and requires 1.x jars. You are using Hymanson 2.x, classes of which live in com.fasterxml.Hymansonpackage; but as per exception, ones in org.codehaus.Hymansonare needed.

异常表示某些其他库或框架正在使用 Hymanson 1.x,并且需要 1.x jar。您正在使用 Hymanson 2.x,其中的类存在于com.fasterxml.Hymanson包中;但作为例外,org.codehaus.Hymanson需要in 。

回答by jonghyun oh

Even if you set up build path, you have to add classpath during runtime. Check up deployment assembly in eclipse

即使您设置了构建路径,您也必须在运行时添加类路径。在 Eclipse 中检查部署程序集

Deployment Assembly

部署组装