目前还不知打哦是什么原因造成,可能跟tomcat版本为7过高有关,而我用的Spring版本可能不合适。我会后续改进,改好后会写出解决方案。如果有知道为什么的可以留言评论,谢谢大家。
详细的配置SpringMVC过程可以看我的配置SpringMVC的博客。
首先我们分析下,tomcat是在我配置SpringMVC的过程中导致tomcat无法启动的,而在这其中,我们修改的仅仅是所配项目的wub.xml发生了改变,而错误信息显示我们配置的项目在tomcat上发布了,但发布的项目中web.xml配置错误。我们要找到web.xml中的错误,其中最为简单是由于
另外要看好自己的classpath,有的默认classpath为web项目下的src,有的为WebContent下的Web-INF。
个人建议将Spring、hibernate等涉及Web的jar包放在Web-INF下的lib文件夹中,因为tomcat运行寻找jar包首先会看此位置的jar包,一些明明添加build path的jar包也许运行时仍提示找不到Class,也就是因为放在java Libraries下,而不是放在Web_INF下的lib中。
相关错误信息为:
信息: validateJarFile(E:\project\boce\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\SpringMvcTest\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 3.0, section 10.7.2. Offending class: javax/servlet/Servlet.class 八月 19, 2014 2:48:12 下午 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[/SpringMvcTest]] 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:799) 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: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[/SpringMvcTest]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 6 more Caused by: java.lang.IllegalArgumentException: Invalid/*.do in servlet mapping at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3279) at org.apache.catalina.core.StandardContext.addServletMapping(StandardContext.java:3254) at org.apache.catalina.deploy.WebXml.configureContext(WebXml.java:1361) at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1341) at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:873) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:371) 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:5355) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more 八月 19, 2014 2:48:12 下午 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:731) 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:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) 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:799) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 6 more 八月 19, 2014 2:48:12 下午 org.apache.catalina.startup.Catalina start 严重: The required Server component failed to start so Tomcat is unable to start. org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) 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 [StandardService[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:731) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 7 more Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 9 more 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.StandardEngine.startInternal(StandardEngine.java:300) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 11 more
分析上面的错误信息是由于在配置文件web.xml中出现的/*.do出现的问题。这个问题可以通过将/去掉来解决。这是关于配置时最简单的错误。
springmvc class>org.springframework.web.servlet.DispatcherServlet class>1 springmvc /*.do
改为:
springmvc class>org.springframework.web.servlet.DispatcherServlet class>1 springmvc *.do
//--------------------------------------------------------------------------
现对上述问题作出我个人的解决,如果有相似情况可以进行尝试。
相似情况无法启动时,有时候会报少包多包等错误,再此为了避免在配置SpringMVC过程中出现这种来回下载来回找Jar包的问题,给各位提供一个全面的针对SpringMVC框架的jar包。(本文所引用的jar包来自互联网,包括Spring的相关jar包,hobernate相关jar包,以及mysql数据库连接jar包)
下面是jar包详细目录:
下面是百度网盘分享SpringJar的文件,有需要进行SpringMVC架构的初学者可以使用。(因为初学者不知道该使用哪些jar包,自己很难调配)
链接: http://pan.baidu.com/s/1bnvmAsB 密码: h8ed
或访问:http://download.csdn.net/detail/lin6286878/7788057