0

Getting following error when deploying to Tomcat container. Only thing which I have changed is that I have removed default ROOT.war in webapps, renamed by dxawebapp to ROOT.war as I wanted the conext root not to be the WAR name

type Exception report

message java.lang.LinkageError: loader constraint violation: when resolving method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/Views/Core/Page/GeneralPage_jsp, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type org/apache/tomcat/InstanceManager used in the signature

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 method "org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/Views/Core/Page/GeneralPage_jsp, and the class loader (instance of java/net/URLClassLoader) for the method's defining class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type org/apache/tomcat/InstanceManager used in the signature
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:349)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

MY POM

    <!-- Dependencies -->
<dependencies>
    <!-- SDL Digital Experience Accelerator -->
    <dependency>
        <groupId>com.sdl.dxa</groupId>
        <artifactId>dxa-common-api</artifactId>
    </dependency>
    <dependency>
        <groupId>com.sdl.dxa</groupId>
        <artifactId>dxa-common-impl</artifactId>
    </dependency>

    <dependency>
        <groupId>com.sdl.dxa</groupId>
        <artifactId>dxa-web8-provider</artifactId>
    </dependency>


    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>javax.servlet-api</artifactId>
    </dependency>

    <!-- Testing -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
    </dependency>
</dependencies>
1
  • Do you have a question there or just letting us know about you challenge? Also, what have you tried to resolve the issue? Commented Apr 27, 2017 at 16:04

1 Answer 1

1

Fixed this Issue by Excluding the Tomcat embedded Jars, so the issue was that tomcat embedded jars were included as a transitive dependency in

<artifactId>dxa-web8-provider</artifactId>

and when deploying to a tomcat container there was a classloader issue, where classloader was finding 2 versions of the same class.

Fixed this error by excluding the tomcat-embed-jasper jar.In your dependency section add the exclusion tag.

<dependency>
            <groupId>com.sdl.dxa</groupId>
            <artifactId>dxa-web8-provider</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.apache.tomcat.embed</groupId>
                    <artifactId>tomcat-embed-jasper</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.