在idea中出现 错误Servlet.init() for servlet springmvc threw exception


就是这个错误让我耗费了很多脑力人力。。。

在网上查是的解决方法:

1.更换jdk为1.7或者1.7以下版本  对我没用

2.更换Spring版本4.0以上  对我没用

3.亲测有用的方法,更换你的pom.xml,我使用idea软件。

把我自己的pom全部换。。。下面是我的pom

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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0modelVersion>
    <packaging>warpackaging>

    <name>SpringMVCname>
    <groupId>cn.SpringMVCgroupId>
    <artifactId>SpringMVCartifactId>
    <version>1.0-SNAPSHOTversion>
    <url>http://maven.apache.orgurl>

    <dependencies>
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>3.8.1version>
            <scope>testscope>
        dependency>
        
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-webmvcartifactId>
            <version>4.3.7.RELEASEversion>
        dependency>
        
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-beansartifactId>
            <version>4.2.3.RELEASEversion>
        dependency>
        
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-contextartifactId>
            <version>4.2.0.RELEASEversion>
        dependency>
        <dependency>
            <groupId>junitgroupId>
            <artifactId>junitartifactId>
            <version>4.12version>
        dependency>
        
        <dependency>
            <groupId>org.aspectjgroupId>
            <artifactId>aspectjweaverartifactId>
            <version>1.8.7version>
        dependency>

        
        <dependency>
            <groupId>org.springframeworkgroupId>
            <artifactId>spring-webartifactId>
            <version>4.3.7.RELEASEversion>
        dependency>
        
        <dependency>
            <groupId>javaeegroupId>
            <artifactId>javaee-apiartifactId>
            <version>5version>
        dependency>
    dependencies>
    <build>
        <resources>
            <resource>
                <directory>src/main/javadirectory>
                <includes>
                    <include>**/*.xmlinclude>
                includes>
            resource>
        resources>
    build>
project>

你可能感兴趣的:(Java)