我一直在努力尝试解决此错误大约3个小时。为了达到这一点,我不得不重新创建这个项目大约6次。我正在关注caveofprogramming.com上的Spring教程,并且无法通过这一步。
这是错误:
SEVERE: Failed to detect ServletContainerInitializers for context with name [/springagain] java.io.IOException: java.lang.ClassNotFoundException: org.springframework.web.SpringServletContainerInitializer
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:200)
at org.apache.catalina.startup.WebappServiceLoader.load(WebappServiceLoader.java:158)
at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1579)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1280)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:888)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:388)
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:5522)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source) Caused by: java.lang.ClassNotFoundException: org.springframework.web.SpringServletContainerInitializer
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1892)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1735)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at org.apache.catalina.startup.WebappServiceLoader.loadServices(WebappServiceLoader.java:197)
... 15 more
web.xml很抱歉格式化,网站不希望我正确格式化:
<?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>springagain</display-name> <welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list> <servlet>
<description></description>
<display-name>offers</display-name>
<servlet-name>offers</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping>
<servlet-name>offers</servlet-name>
<url-pattern>/</url-pattern> </servlet-mapping> </web-app>
优惠-servlet.xml中:
<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> </beans>
我没有尝试过让我在任何地方工作。 Here是部署程序集的图片专辑,我拥有的依赖项以及它在依赖项中找不到的类。
答案 0 :(得分:1)