1

I'm studying tutorial about spring mvc. i have a problem in this step : https://github.com/in28minutes/SpringMvcStepByStep/blob/master/Step11.md

i already copy paste the same code from the link(1st time typing according to the video but always get this error. already tried deployment assembly but none displayed or other things. could anyone help me why i got this eror? i'm using eclipse oxygen

Jun 27, 2018 9:19:22 PM org.apache.catalina.startup.ContextConfig getServletContainerInitializer
SEVERE: The ServletContentInitializer [org.springframework.web.SpringServletContainerInitializer] could not be created
java.lang.ClassNotFoundException: org.springframework.web.SpringServletContainerInitializer
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1702)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at org.apache.catalina.startup.ContextConfig.getServletContainerInitializer(ContextConfig.java:1668)
    at org.apache.catalina.startup.ContextConfig.getServletContainerInitializers(ContextConfig.java:1652)
    at org.apache.catalina.startup.ContextConfig.processServletContainerInitializers(ContextConfig.java:1562)
    at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1270)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:376)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5322)
    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(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)
3
  • For sample structure also look at stackoverflow.com/questions/20711056/… Commented Jun 27, 2018 at 14:46
  • ah thanks i could run the program but still have same error. the app works fine though Commented Jun 29, 2018 at 2:14
  • i tried to delete my springframework repository at local user and all the problems solved. Commented Jun 29, 2018 at 2:19

1 Answer 1

1

Your pom.xml should be at least like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>your-project</groupId>
    <artifactId>your-project</artifactId>
    <version>1.0-SNAPSHOT</version>
    <properties>
        <maven.compiler.target>1.9</maven.compiler.target>
        <maven.compiler.source>1.9</maven.compiler.source>
    </properties>

    <dependecies>
    <!-- Spring -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${org.springframework-version}</version>
    </dependency>
  </dependencies>
</project>

Replace ${org.springframework-version} with your version of Spring, if you need. ALso update the Java version if you know it's not 1.9. Your pom.xml has to include the entire xml with <dependencies> section having at least spring-webmvc. Then run and verify Maven builds everything. Your project has missing dependencies. Verify your versions are set appropriately.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.