eclipse中基于maven构建的web项目pom.xml中指定的jar包无法发布到tomcat中

eclipse运行maven web项目报错:

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 信息: Starting Servlet Engine: Apache Tomcat/``7.0``.``57 一月 ``07``, ``2015 11``:``50``:``44 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/minisns]] ``at java.util.concurrent.FutureTask.report(FutureTask.java:``122``) ``at java.util.concurrent.FutureTask.get(FutureTask.java:``188``) ``at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:``1123``) ``at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:``816``) ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``150``) ``at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:``1575``) ``at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:``1565``) ``at java.util.concurrent.FutureTask.run(FutureTask.java:``262``) ``at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:``1145``) ``at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:``615``) ``at java.lang.Thread.run(Thread.java:``744``) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/minisns]] ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``154``) ``... ``6 more Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContext ``at java.lang.Class.getDeclaredFields0(Native Method) ``at java.lang.Class.privateGetDeclaredFields(Class.java:``2397``) ``at java.lang.Class.getDeclaredFields(Class.java:``1806``) ``at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:``106``) ``at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:``270``) ``at org.apache.catalina.startup.WebAnnotationSet.loadApplicationServletAnnotations(WebAnnotationSet.java:``139``) ``at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:``65``) ``at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:``415``) ``at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:``892``) ``at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:``386``) ``at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:``117``) ``at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:``90``) ``at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:``5380``) ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``150``) ``... ``6 more Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext ``at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:``1720``) ``at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:``1571``) ``... ``20 more 一月 ``07``, ``2015 11``:``50``:``44 下午 org.apache.catalina.core.ContainerBase startInternal 严重: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] ``at java.util.concurrent.FutureTask.report(FutureTask.java:``122``) ``at java.util.concurrent.FutureTask.get(FutureTask.java:``188``) ``at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:``1123``) ``at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:``300``) ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``150``) ``at org.apache.catalina.core.StandardService.startInternal(StandardService.java:``443``) ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``150``) ``at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:``739``) ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``150``) ``at org.apache.catalina.startup.Catalina.start(Catalina.java:``689``) ``at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ``at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:``57``) ``at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:``43``) ``at java.lang.reflect.Method.invoke(Method.java:``606``) ``at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:``321``) ``at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:``455``) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]] ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``154``) ``at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:``1575``) ``at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:``1565``) ``at java.util.concurrent.FutureTask.run(FutureTask.java:``262``) ``at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:``1145``) ``at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:``615``) ``at java.lang.Thread.run(Thread.java:``744``) Caused by: org.apache.catalina.LifecycleException: A child container failed during start ``at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:``1131``) ``at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:``816``) ``at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:``150``) ``... ``6 more |

原因是:tomcat对应项目的lib目录中没有pom.xml中指定的jar,但是有通过普通方法导入的jar包,解决方法如下:

1, 右键项目,选择 Properties ,然后选中 Deployment Assembly :

  1. 点击 Add...

然后选中: Java Build Path Entries ,在点击 Next>

选中 Maven Dependencies ,然后 Finish , Ok 搞定。

相关推荐
dal118网工任子仪4 分钟前
94,【2】buuctf web [安洵杯 2019]easy_serialize_php
android·前端·php
大模型铲屎官34 分钟前
HTML5 技术深度解读:本地存储与地理定位的最佳实践
前端·html·html5·本地存储·localstorage·地理定位·geolocation api
一 乐1 小时前
基于vue船运物流管理系统设计与实现(源码+数据库+文档)
前端·javascript·数据库·vue.js·spring boot·后端·船运系统
m0_528723811 小时前
在React中使用redux
前端·javascript·react.js
傻小胖2 小时前
vue3中customRef的用法以及使用场景
前端·javascript·vue.js
谦谦橘子2 小时前
手把手教你实现一个富文本
前端·javascript
Future_yzx2 小时前
Java Web的发展史与SpringMVC入门学习(SpringMVC框架入门案例)
java·前端·学习
star010-2 小时前
【视频+图文详解】HTML基础4-html标签的基本使用
前端·windows·经验分享·网络安全·html·html5
engchina2 小时前
CSS Display属性完全指南
前端·css
engchina2 小时前
详解CSS `clear` 属性及其各个选项
前端·css·css3