1

These are the dependencies that I use in pom.xml (Maven). I don't under stand why I am getting

 javax.servlet.ServletException: java.lang.LinkageError 

when I try to run my project.

<dependencies>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-dojo-plugin</artifactId>
        <version>2.3.4.1</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts-taglib</artifactId>
        <version>1.3.10</version>

    </dependency>
    <dependency>
        <groupId>org.jasypt</groupId>
        <artifactId>jasypt-hibernate3</artifactId>
        <version>1.9.0</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.2.6.Final</version>
    </dependency>
    <dependency>
        <groupId>javax.transaction</groupId>
        <artifactId>jta</artifactId>
        <version>1.1</version>
    </dependency>
    <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-plugin</artifactId>
        <version>3.3.3</version>
    </dependency>
    <dependency>
        <groupId>org.quartz-scheduler</groupId>
        <artifactId>quartz</artifactId>
        <version>1.7.3</version>
    </dependency>
    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.21</version>
    </dependency>

    <dependency>
        <groupId>opensymphony</groupId>
        <artifactId>sitemesh</artifactId>
        <version>2.4.1</version>
    </dependency>
    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4</version>
    </dependency>
    <dependency>
        <groupId>org.apache.struts</groupId>
        <artifactId>struts2-json-plugin</artifactId>
        <version>2.3.8</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp</groupId>
        <artifactId>jsp-api</artifactId>
        <version>2.1</version>
    </dependency>
</dependencies>   

It was running on another PC. I just did a maven clean & then when to the project location on my harddrive,zipped it & when I imported the project from zip here at home this problem occurs. Please tell if you have any hint or clue. Thank you.

EDIT 1:

type Exception report

message 

description The server encountered an internal error () that prevented it from fulfilling this request.

exception 

javax.servlet.ServletException: 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/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/Index_jsp, 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 javax/el/ExpressionFactory used in the signature
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:343)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)


root cause 

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/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/Index_jsp, 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 javax/el/ExpressionFactory used in the signature
    org.apache.jsp.Index_jsp._jspInit(Index_jsp.java:26)
    org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49)
    org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
Amit Kumar
  • 2,685
  • 2
  • 37
  • 72
  • Can we see the full stacktrace? – nanofarad Oct 08 '13 at 16:47
  • I have edited my question please see it. Also I search for the same & got that it may be due to I included some jars twice,but which one I can't figure it out. – Amit Kumar Oct 08 '13 at 16:58
  • What version of your application server are you using? it looks like tomcat but what number? it looks like you are specifying the wrong jsp version. You should also specify the jsp-api as provided since isn't needed during a deploy. (App servers have their own jsp/jstl implementations you should use) – ctwomey Oct 08 '13 at 17:01
  • @ctwomey1 You appear to be somewhat experienced with this, can you provide an answer as mine fails for the OP and I am unable to figure out anything past there? – nanofarad Oct 08 '13 at 17:14

1 Answers1

2

Modify your jsp-api with the scope provided so Maven doesn't try to multiple-load it.

You likely included jars multiple times. The linkageErrors you see are from the same name class being loaded in two different ways by two different loaders on the same name. Make sure you don't include any extra jars.

Especially, javax.servlet.jsp.JspApplicationContext is provided by the server class loader and should not be added as a JAR due to the ensuing conflict. Same for javax.el.ExpressionFactory which may be provided by the jSP API.

ctwomey
  • 469
  • 6
  • 21
nanofarad
  • 40,330
  • 4
  • 86
  • 117