码迷,mamicode.com
首页 > 编程语言 > 详细

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException 报错

时间:2019-08-22 01:10:55      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:man   main   http   splay   llb   declared   nal   tca   start   

在测试testSave方法是报错

技术图片

 

具体报错如下:

技术图片
 1 java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException
 2 
 3     at java.lang.Class.getDeclaredMethods0(Native Method)
 4     at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
 5     at java.lang.Class.getDeclaredMethods(Class.java:1975)
 6     at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:609)
 7     at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:521)
 8     at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:507)
 9     at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)
10     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1069)
11     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1042)
12     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)
13     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
14     at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
15     at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
16     at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
17     at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
18     at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)
19     at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
20     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
21     at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:125)
22     at org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:60)
23     at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.delegateLoading(AbstractDelegatingSmartContextLoader.java:109)
24     at org.springframework.test.context.support.AbstractDelegatingSmartContextLoader.loadContext(AbstractDelegatingSmartContextLoader.java:261)
25     at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContextInternal(DefaultCacheAwareContextLoaderDelegate.java:98)
26     at org.springframework.test.context.cache.DefaultCacheAwareContextLoaderDelegate.loadContext(DefaultCacheAwareContextLoaderDelegate.java:116)
27     at org.springframework.test.context.support.DefaultTestContext.getApplicationContext(DefaultTestContext.java:83)
28     at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:117)
29     at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:83)
30     at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:228)
31     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:230)
32     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:289)
33     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
34     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:291)
35     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:249)
36     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89)
37     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
38     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
39     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
40     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
41     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
42     at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
43     at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
44     at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
45     at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193)
46     at org.junit.runner.JUnitCore.run(JUnitCore.java:160)
47     at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
48     at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
49     at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
50     at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
51 Caused by: java.lang.ClassNotFoundException: com.fasterxml.jackson.core.JsonProcessingException
52     at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
53     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
54     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
55     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
56     ... 48 more
View Code

 

解决过程:

1、添加json依赖

技术图片

2、又报错了java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

再添加依赖  

commons-fileupload

技术图片

 

问题解决了。

题外话:
测试是通过了,返回现实成功了,但在sqlyog中查不到数据,在命令提示符那里是可以查到的,这应该是sqlyog的bug吧。

技术图片

技术图片

 

java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException 报错

标签:man   main   http   splay   llb   declared   nal   tca   start   

原文地址:https://www.cnblogs.com/iidyllic/p/11392046.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!