1

我终于能够构建我的项目,但是当我尝试访问战争时它出错了。我正在阅读 Anghel Leonard 的 Apress 书籍Pro Hibernate 和 MongoDB(在此处找到),但书中的示例不会产生任何结果。

pom.xml

  <?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>
    <packaging>war</packaging>

    <groupId>com.ogm</groupId>
    <artifactId>Maven_HOGM</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.hibernate.ogm</groupId>
            <artifactId>hibernate-ogm-core</artifactId>
            <version>4.0.0.Beta2</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate.ogm</groupId>
            <artifactId>hibernate-ogm-mongodb</artifactId>
            <version>4.0.0.Beta1</version>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.orbit</groupId>
            <artifactId>javax.servlet</artifactId>
            <version>3.0.0.v201112011016</version>
        </dependency>


    </dependencies>

    <build>
        <directory>c:\dev\Hibernate_OGM</directory>
        <defaultGoal>dependency:copy-dependencies</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <configuration>
                    <url>http://127.0.0.1:8080/manager</url>
                    <server>TomcatServer</server>
                    <path>/FileUpload</path>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

我打字

mvn tomcat:run

我收到这个错误

例外

javax.servlet.ServletException:java.lang.LinkageError:加载程序约束违规:加载程序(org/apache/jasper/servlet/JasperLoader 的实例)先前为名为“javax/servlet/http/HttpServletRequest”的不同类型启动加载 org。 apache.jasper.servlet.JspServlet.service(JspServlet.java:268) javax.servlet.http.HttpServlet.service(HttpServlet.java:717) 根本原因

java.lang.LinkageError:加载程序约束违规:加载程序(org/apache/jasper/servlet/JasperLoader 的实例)先前为名为“javax/servlet/http/HttpServletRequest”的不同类型启动加载 java.lang.Class.getDeclaredMethods0(本机方法)java.lang.Class.privateGetDeclaredMethods(Class.java:2521) java.lang.Class.getDeclaredMethods(Class.java:1845) org.apache.catalina.util.DefaultAnnotationProcessor.processAnnotations(DefaultAnnotationProcessor.java:226) org .apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:148) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java :313) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260) javax.servlet.http。HttpServlet.service(HttpServlet.java:717)

4

0 回答 0