【问题标题】:Linkage Error occured while executing the application in eclipse在eclipse中执行应用程序时发生链接错误
【发布时间】:2015-03-24 15:38:27
【问题描述】:

我用谷歌搜索了我遇到的问题,然后我应用了所有给定的解决方案,但不幸的是,我在执行我的应用程序时仍然遇到相同的错误(链接错误)。我还在下面发布了一些与问题相关的 pom.xml 部分

<dependency>
        <groupId>javax.el</groupId>
        <artifactId>el-api</artifactId>
        <version>2.2</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.2</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>el-impl</artifactId>
        <version>2.2</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.el</groupId>
        <artifactId>el-ri</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>

错误信息:

SEVERE: Critical error during deployment: 
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/catalina/loader/WebappClassLoader) of the current class, com/sun/faces/config/ConfigureListener, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature
at com.sun.faces.config.ConfigureListener.registerELResolverAndListenerWithJsp(ConfigureListener.java:673)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:230)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4600)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5097)
at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5092)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
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)

【问题讨论】:

    标签: java maven tomcat7 pom.xml


    【解决方案1】:

    你应该摆脱以下依赖:

    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>el-impl</artifactId>
        <version>2.2</version>
        <scope>runtime</scope>
    </dependency>
    

    这是 el 的 glassfish 实现。

    Tomcat 在lib 目录中带有el-api.jarjasper-el.jar(它自己的实现)。所以你根本不需要那种依赖。

    还有:

     <dependency>
        <groupId>com.sun.el</groupId>
        <artifactId>el-ri</artifactId>
        <version>1.0</version>
        <scope>provided</scope>
    </dependency>
    

    也不需要。未提供 sun 参考实现(如前所述,Tomcat 自带了自己的实现)。

    此外,Tomcat 不提供 JEE7。因此,具有以下依赖项(在提供的范围内)是错误的:

     <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    

    您应该删除这三个依赖项。第一个是异常的原因。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-17
      • 1970-01-01
      相关资源
      最近更新 更多