Q:

Maven Dependency -- Throws load() exception

I am creating a new project in Java using Maven. I'll have to use Mongo and Hadoop. but when i use the following dependency and try to run the application by using tomcat:run I am getting Throws load() exception .
The dependency is
        <dependency>
            <groupId>org.mongodb</groupId>
            <artifactId>mongo-hadoop-core_1.0.2</artifactId>
            <version>1.0.0</version>
        </dependency>

and the error is :
SEVERE: Servlet /MongoRESTApi threw load() exception
java.lang.ClassCastException: org.apache.jasper.servlet.JspServlet cannot be cast to javax.servlet.Servlet
How can I solve this ?
Thanks in advance

A:

You are probably encountering the jar hell issue:

A developer or deployer of a Java application has accidentally made
  two different versions of a library available to the system.

The mongo-hadoop-core_1.0.2 dependency may have introduced further transitive dependencies; probably a second servlet-api which you need to exclude.
Finding the erroneous dependencies may be tedious, therefore I'd suggest you to include the JBoss Tattletale plugin in your build phase. Configure the multiplejars report and enable failOnWarn and failOnError. The generated report will list those classes which can be found in multiple jars. From this you'll see which dependencies should be excluded to escape from jar hell.

