1

I have been working on trying to solve this error for about 3 hours. I have had to re-create this project about 6 times just to get to this point. I am following along the Spring tutorials over at caveofprogramming.com and cannot make it past this step.

Here is the error:

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 Sorry for formatting, the site doesnt want me to format it correctly:

<?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>

offers-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>

Nothing I have tried is getting me anywhere near working. Here is an album of pictures of the Deployment assembly, the dependencies I have and the class it says it cant find inside the dependencies.

  • Those tutorials seem to be severely out of date. Unless you have a specific compelling need to go with a legacy setup, use Spring Boot, and you can autogenerate a complete working project at https://start.spring.io (wizards are available in IntelliJ and STS). – chrylis -cautiouslyoptimistic- Apr 26 '17 at 02:16
  • @chrylis I am trying to build a Hibernate project, and this tutorial series takes a step by step approach to building a web MVC app using MySQL then eventually leads to replacing all the SQL functionality with Hibernate. I wanted to use these to learn how to get to the end goal of a Hibernate project. – The_fatness Apr 26 '17 at 02:25
  • Yes, but it's step-by-step *with completely outdated technology*. You can go to Spring Initializr, check "Web" and "Data JPA", and you're done. You don't even have to write JPA/Hibernate queries; Spring will do it for you. – chrylis -cautiouslyoptimistic- Apr 26 '17 at 02:46
  • That does seem semi-useful however, it doesn't provide the information needed to link to a local server or any information regarding the queries. I didn't realize the tutorials were so outdated, they are highly recommended on Reddit in the subs dedicated to learning. Everything worked up until the tomcat/web app stuff. – The_fatness Apr 26 '17 at 04:40

1 Answers1

1

after some searvh I found that issue related to spring framework 4.1.9.RELEASE After updating to 4.0.5.RELEASE Issue resolved

Fady Saad
  • 1,169
  • 8
  • 13
  • Then see this [answer](http://stackoverflow.com/questions/11227395/java-lang-classnotfoundexception-org-springframework-web-servlet-dispatcherserv) – Fady Saad Apr 26 '17 at 02:12
  • If you look at the pictures posted in the OP, it shows that this was already done as well and doesn't work. – The_fatness Apr 26 '17 at 02:14