java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonFactory
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/30367045/
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
java.lang.NoClassDefFoundError: com/fasterxml/Hymanson/core/JsonFactory
提问by VVB
I am working on YouTube broadcast
sample examples. I have created a sample Java Project
& added required jars. But, when I try to run the project it throws exception.
我正在研究YouTube broadcast
示例示例。我创建了一个示例Java Project
并添加了所需的罐子。但是,当我尝试运行该项目时,它会引发异常。
Exception :
例外 :
Throwable: com/fasterxml/Hymanson/core/JsonFactory
java.lang.NoClassDefFoundError: com/fasterxml/Hymanson/core/JsonFactory
at com.google.api.client.json.Hymanson2.HymansonFactory.<init>(HymansonFactory.java:44)
at com.google.api.services.samples.youtube.cmdline.live.Auth.<clinit>(Auth.java:35)
at com.google.api.services.samples.youtube.cmdline.live.CreateBroadcast.main(CreateBroadcast.java:55)
Caused by: java.lang.ClassNotFoundException: com.fasterxml.Hymanson.core.JsonFactory
at java.net.URLClassLoader.run(URLClassLoader.java:366)
at java.net.URLClassLoader.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 3 more
I downloaded the project from this GitHub repository.
我从这个 GitHub 存储库下载了该项目。
采纳答案by shruti1810
Add the following dependency to your pom.xml
将以下依赖项添加到您的 pom.xml
<dependency>
<groupId>com.fasterxml.Hymanson.core</groupId>
<artifactId>Hymanson-core</artifactId>
<version>2.5.2</version>
</dependency>
回答by Kartheek
You have to add one jar : Hymanson-annotations-2.1.2.jar
You can download it from hereand add it to the class path
If you are using the gradle then add the following dependency.
您必须添加一个 jar :Hymanson-annotations-2.1.2.jar
您可以从这里下载它并将其添加到类路径如果您使用的是 gradle 则添加以下依赖项。
compile 'com.fasterxml.Hymanson.jaxrs:Hymanson-jaxrs-json-provider:2.5.2'
回答by Emmanuel Douaud
The requested jar is probably not Hymanson-annotations-x.y.z.jar but Hymanson-core-x.y.z.jar which could be found here: http://www.java2s.com/Code/Jar/j/DownloadHymansoncore220rc1jar.htm
请求的 jar 可能不是 Hymanson- annotations-xyzjar 而是 Hymanson- core-xyzjar,可以在这里找到:http: //www.java2s.com/Code/Jar/j/DownloadHymansoncore220rc1jar.htm
回答by Cec
As of Hymanson 2.7.4 (or earlier maybe), the class is in jacskon-jaxrs-base.jar, which is contained in Hymanson-jaxrs-json-provider
从 Hymanson 2.7.4(或更早版本)开始,该类位于Hymanson-jaxrs-json-provider中的 jacskon-jaxrs-base.jar 中
回答by asifaftab87
Because of old version I got this error. Then I changed to this version n error gone Using maven my pom.xml
由于旧版本,我收到此错误。然后我改成这个版本 n 错误消失了 Using maven my pom.xml
<properties>
...
<Hymanson.version>2.5.2</Hymanson.version>
</properties>
<dependencies>
...
<dependency>
<groupId>com.fasterxml.Hymanson.core</groupId>
<artifactId>Hymanson-core</artifactId>
<version>${Hymanson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.Hymanson.core</groupId>
<artifactId>Hymanson-databind</artifactId>
<version>${Hymanson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.Hymanson.core</groupId>
<artifactId>Hymanson-annotations</artifactId>
<version>${Hymanson.version}</version>
</dependency>
</dependencies>
my old version was '2.2.3'
我的旧版本是“2.2.3”
回答by Arpan Saini
Solved the problem by upgrading the dependency to below version
通过将依赖项升级到以下版本解决了问题
<dependency>
<groupId>com.fasterxml.Hymanson.core</groupId>
<artifactId>Hymanson-core</artifactId>
<version>2.9.8</version>
</dependency>