我正在创建一个maven项目,我是初学者......我遇到了这个错误。可以帮助解决这个问题,这是我的pom.xml& web.xml中

时间:2017-11-04 20:26:09

标签: java maven tomcat

http://maven.apache.org/maven-v4_0_0.xsd“>     4.0.0     com.project     Online_Medical_Reporting_System     战争     0.0.1-SNAPSHOT     Online_Medical_Reporting_System Maven Webapp     http://maven.apache.org                           JUnit的             JUnit的             3.8.1             测试                               org.hibernate.javax.persistence             冬眠,JPA-2.1-API             1.0.0.Final                                        org.hibernate作为             冬眠验证器             4.0.2.GA                               org.hibernate作为             休眠核心             3.3.2.GA                                        org.springframework             春天的AOP             4.1.6.RELEASE         

    <!-- The spring-webmvc module (also known as the Web-Servlet module) contains 
        Spring’s model-view-controller (MVC) and REST Web Services implementation 
        for web applications -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>

    <!-- The spring-web module provides basic web-oriented integration features 
        such as multipart file upload functionality and the initialization of the 
        IoC container using Servlet listeners and a web-oriented application context -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-web</artifactId>
        <version>4.1.6.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.2.4.RELEASE</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-tx</artifactId>
        <version>4.0.4.RELEASE</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>4.3.0.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-jdbc</artifactId>
        <version>4.3.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>
</dependencies>
<build>
    <finalName>Online_Medical_Reporting_System</finalName>
    <plugins>
        <plugin>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-maven-plugin</artifactId>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.2</version>
            <configuration>
                <verbose>true</verbose>
                <source>1.7</source>
                <target>1.7</target>
                <showWarnings>true</showWarnings>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <path>/</path>
                <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>

    </plugins>
</build>

  
    

块引用

  

http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd”     id =“WebApp_ID”version =“3.0”&gt;     Online_Medical_Reporting_System

<listener>
    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>
<servlet>
    <servlet-name>spring</servlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
    <servlet-name>spring</servlet-name>
    <url-pattern>/</url-pattern>
</servlet-mapping>

1 个答案:

答案 0 :(得分:-1)

您正在混合使用Spring依赖项的版本,除非您有特殊原因,否则您永远不应该这样做。

请参阅此博客文章,详细说明了如何以及为什么不应该这样做,它的春季启动相关,但想法完全相同https://spring.io/blog/2016/04/13/overriding-dependency-versions-with-spring-boot

此处显示的快速示例http://www.baeldung.com/spring-maven-bom

<dependencyManagement>

<dependency>
   <groupId>org.springframework</groupId>
   <artifactId>spring-framework-bom</artifactId>
   <version>4.3.12.RELEASE</version>
   <type>pom</type>
   <scope>import</scope>
</dependency>

</dependencyManagement>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-webmvc</artifactId>
</dependency>

<!-- The spring-web module provides basic web-oriented integration features 
    such as multipart file upload functionality and the initialization of the 
    IoC container using Servlet listeners and a web-oriented application context -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/spring-tx -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-beans -->
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-beans</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
    <groupId>log4j</groupId>
    <artifactId>log4j</artifactId>
    <version>1.2.17</version>
</dependency>

依赖关系通过BOM导入进行控制。另外,我相信你所定义的很多内容都是可传递的,例如:不应该定义contextbeans等。我会检查您的依赖关系层次结构并展平已定义的依赖关系。