最新消息:关注【太平洋学习网】微信公众号,可以获取全套资料,【全套Java基础27天】【JavaEE就业视频4个月】【Android就业视频4个月】

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory错误解决

Javaweb 太平洋学习网 浏览 评论

今天在搭建ssm框架springmvc启动tomcat时,出现了“java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory”错误,先列举错误再解决,具体错误如下:

严重: StandardWrapper.Throwable

java.lang.NoClassDefFoundError: org/apache/commons/fileupload/FileItemFactory

at java.lang.Class.getDeclaredMethods0(Native Method)

at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)

at java.lang.Class.getDeclaredMethods(Class.java:1975)

at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:571)

at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:490)

at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:474)

at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.determineCandidateConstructors(AutowiredAnnotationBeanPostProcessor.java:241)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineConstructorsFromBeanPostProcessors(AbstractAutowireCapableBeanFactory.java:1057)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1030)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)

at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)

at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302)

at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)

at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298)

at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)

at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:762)

at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)

at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)

at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:663)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:629)

at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:677)

at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:548)

at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:489)

at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)

at javax.servlet.GenericServlet.init(GenericServlet.java:160)

at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5176)

at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5460)

at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)

at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)

at java.util.concurrent.FutureTask.run(FutureTask.java:266)

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: org.apache.commons.fileupload.FileItemFactory

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)

at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)

... 37 more


六月 20, 2018 11:00:27 下午 org.apache.catalina.core.StandardContext loadOnStartup

严重: Servlet  threw load() exception

解决方案:

这是因为我们的springmvc在配置启动的时候,有一个commons-fileupload的jar包没有依赖进来,我们只需要在我们的maven pom.xml文件中加入如下依赖,重启tomcat即可:

<dependency>
    <groupId>commons-fileupload</groupId>
    <artifactId>commons-fileupload</artifactId>
    <version>1.3.2</version>
</dependency>


来源网站:太平洋学习网,转载请注明出处:http://www.tpyyes.com/a/javaweb/637.html

与本文相关的文章

发表我的评论
取消评论

表情

您的回复是我们的动力!

  • 昵称 (必填)

网友最新评论