I was able to run the same Struts 2 application in previous version of Eclipse.
But when I tried to run it in Mars.1, it is giving the below exception:
Nov 25, 2015 1:16:56 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [jsp] in context with path [/GoogleChart] threw exception [javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/codehaus/jackson/map/ObjectMapper] with root cause
java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1854)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1703)
My POM looks like this :
<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>
<groupId>AutoPlat</groupId>
<artifactId>AutoPlat</artifactId>
<version>0.0.5</version>
<name>AutoPlat</name>
<description>AutoPlat</description>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.16</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
</dependencies>
<dependencyManagement>
</dependencyManagement>
<packaging>war</packaging>
</project>
And, web.xml :
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0" metadata-complete="true">
<display-name>Welcome to Tomcat</display-name>
<description>
Welcome to Tomcat
</description>
<!-- <servlet>
<servlet-name>PieChartServlet</servlet-name>
<servlet-class>chart.PieChartServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PieChartServlet</servlet-name>
<url-pattern>/PieChartServlet</url-pattern>
</servlet-mapping> -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
<welcome-file>DashBoard.jsp</welcome-file>
</welcome-file-list>
</web-app>
What is the cause of this error ?
Caused by:
java.lang.ClassNotFoundException: org.codehaus.jackson.map.ObjectMapper
Jackson is missing in the classpath
I guess that the underline problem is that:
Maven
Now that Codehaus no longer serves up Maven repositories, you will need to change your configuration.
If your configuration is not updated and you slam our redirector, then you may be served invalid JAR files with status 200 to encourage you to update your configuration.
Making Maven Work
settings.xml
In ~/.m2/settings.xml you can update the URL to be used for specific repositories.
For example:
<repositories> <repository> <id>codehaus-mule-repo</id> <name>codehaus-mule-repo</name> <url> https://repository-master.mulesoft.org/nexus/content/groups/public/ </url> <layout>default</layout> </repository> </repositories>
Also note that that artifact has been migrated and evoluted a lot since 1.9.13, now it has reached 2.6.3:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>