سؤال

I created maven project "File->New->Other..->Maven->Maven Project"
I created controller + view, "Hello World" and everything worked well.
I foolishly decided to click RightClick(on project)->Maven->Update Project (tomcat was running).
On the project appeared "red exclamation" and "HelloWorld" doesnt work.

enter image description here

Screen after "my updating"

enter image description here

enter image description here

enter image description here

enter image description here

pom.xml

<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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mdosoft</groupId>
  <artifactId>Primer</artifactId>
  <packaging>war</packaging>
  <version>0.0.1-SNAPSHOT</version>
  <name>Primer Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.2.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
        <version>3.0.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>jstl</artifactId>
        <version>1.2</version>
        <scope>provided</scope>
    </dependency>
  </dependencies>
  <build>
    <finalName>Primer</finalName>
  </build>
</project>
هل كانت مفيدة؟

المحلول

Run mvn clean package ensure that all the jars are inside of lib folder. If it doesn't work change servlet api version to 2.5

نصائح أخرى

Can you provide pom.xml file, Check The Scope Of servlet api-3.0.1 depaendency,it must be provided

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top