Maven Gatling 3.0.2 - NoSuchMethodError - scala

When I run "mvn clean gatling:test -Dgatling.simulationClass=package.SimpleSim", I get the following error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
at io.gatling.core.cli.CommandLineConstant.<init>(CommandLineConstant.scala:19)
at io.gatling.app.cli.CommandLineConstants$.<init>(CommandLineConstants.scala:22)
at io.gatling.app.cli.CommandLineConstants$.<clinit>(CommandLineConstants.scala)
at io.gatling.app.cli.ArgsParser$$anon$1.<init>(ArgsParser.scala:30)
at io.gatling.app.cli.ArgsParser.<init>(ArgsParser.scala:28)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:46)
at io.gatling.app.Gatling$.main(Gatling.scala:39)
at io.gatling.app.Gatling.main(Gatling.scala)
I tried removing a lot of dependencies with only Gatling Highchart and Gatling Plugin remaining. It stills throw the same error.
The funny thing is I copy many code from a working project and the project is still running properly now.
I am not sure why this is happening in the new project...
The pom:
<parent>
<artifactId>abc-pom</artifactId>
<groupId>com.abc.def</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<gatling.version>3.0.3</gatling.version>
<gatling-plugin.version>3.0.2</gatling-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>${gatling.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main</sourceDirectory>
<testSourceDirectory>src/test</testSourceDirectory>
<plugins>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>${gatling-plugin.version}</version>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<configFolder>${project.basedir}/src/test/resources/gatling_conf</configFolder>
<runMultipleSimulations>true</runMultipleSimulations>
<includes>
<simulationClass>package.SimpleSim</simulationClass>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
The script:
package package.scalability_test
import io.gatling.core.Predef._
import io.gatling.http.Predef._
import scala.concurrent.duration._
class SimpleSim extends Simulation {
val httpProtocolBuilder = http.baseUrl("http://www.google.com")
val scenarioBuilder = scenario("Get").exec(http("Get_Request")
.get("/"))
setUp(
scenarioBuilder.inject(constantUsersPerSec(1) during(60 seconds))
).protocols(httpProtocolBuilder)
}

The issue was actually due to the <parent></parent> tag. This is a project within a larger project. Somehow, inheriting the parent pom causes some conflicts which resulted in this issue.
My solution was to remove the <parent> tag. But, the correct solution could be to actually figure out which dependency is causing a conflict.

First check your all Scala version in your classpath mvn dependency:tree, then override with compatible Scala version with your Gatling version

Related

How to fix the error ClassNotFoundException when using jar-with-dependencies built on Maven?

I am working on a Scala Spark application to read data from a source db and load it into bigquery and I wrote below code for it.
object Marker extends App {
val ec = ExecutionContext.fromExecutorService(Executors.newFixedThreadPool(3)) // Spawning 3 threads for 3 active stages.
override def main(args: Array[String]): Unit = {
val conf = new SparkConf().set("spark.network.timeout", "12000s").set("spark.kryoSerializer.buffer.max", "512m")
conf.registerKryoClasses(Array(classOf[IntoBigquery]))
val spark = SparkSession.builder().appName("app").master("yarn").
config( "spark.serializer", "org.apache.spark.serializer.KryoSerializer").config(conf).getOrCreate()
spark.conf.set("temporaryGcsBucket", "bucket_location")
val ib = new IntoBigquery
if(ib.read_and_ingest(spark=spark, databasename=args(0), tablename=args(1), partitionColumn=args(2), numPartitions=args(3).toInt, upperBound=args(4).toInt)) println("Ingestion Successful!")
else println("Ingestion Failed!")
}
}
My main class is in the object Marker and is under the package: com.somename
This is my project structure:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.somename</groupId>
<artifactId>DeltaLoader</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.12.12</scala.version>
<maven.compiler.source>3.1</maven.compiler.source>
<maven.compiler.target>3.1</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.12</artifactId>
<version>2.4.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.12</artifactId>
<version>2.4.7</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>src/main/scala</sourceDirectory>
<testSourceDirectory>src/test/scala</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
<mainClass>com.somename.Marker</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>default-jar</id>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2-beta-5</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>com.somename.Marker</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I build the project, I see a warning in the console as below:
JAR will be empty - no content was marked for inclusion!
And after the build is completed, I see two jar files:
Default jar file
A fat jar with all the dependencies
I build create the jar in this way:
click on maven from the right vertical pane of IntelliJ -> click on m symbol and then run mvn package
When I copied the jar to my gcp bucket and submitted the jar file there, I see an error message:
21/03/09 11:04:38 WARN org.apache.spark.deploy.SparkSubmit$$anon$2: Failed to load com.somename.Marker.
java.lang.ClassNotFoundException: com.somename.Marker
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348
I also tried to submit the same code from my loca sdk (powershell) using the below command:
gcloud dataproc jobs submit spark --cluster=clustername --region=region_name --jar=gs://bucketlocation/jars/DeltaLoader-1.0-SNAPSHOT-jar-with-dependencies.jar --jars=gs://mssql-jdbc-9.2.0.jre8.jar,gs://spark-bigquery-latest_2.12.jar -- arg1 arg2 arg3 arg4 arg5
Faced the same exception as from the cloud console:
21/03/09 11:14:05 WARN org.apache.spark.deploy.SparkSubmit$$anon$2: Failed to load com.micron.Marker.
java.lang.ClassNotFoundException: com.micron.Marker
And also tried to submit the job directly from local:
spark-submit --master local[2] --deploy-mode client --driver-memory 1g --executor-memory 1g --executor-cores 2 --jars C:\Users\Downloads\mssql-jdbc-9.2.0.jre8.jar,C:\Users\Downloads\spark-bigquery-latest_2.12.jar --class com.somename.Marker C:\Users\IdeaProjects\DeltaLoader\target\DeltaLoader-1.0-SNAPSHOT-jar-with-dependencies.jar arg1 arg2 arg3 arg4 arg5
Even this failed with the same exception.
Is there anything wron with the way I am creating the jar file or any error inside the pom.xml file ?
Could anyone let me know where did I make the mistake ? Any help is much appreciated.

compilation error during gatling load test

I'm trying to write a simulation and i want to be able to run the simulation.
I get an error while trying to $mvn gatling:execute.
My pom has the following dependencies:
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-charts</artifactId>
<version>2.2.5</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-core</artifactId>
<version>2.2.5</version>
</dependency>
and the following plugins:
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<scalaVersion>2.12.3</scalaVersion>
</configuration>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>2.2.4</version>
<executions>
<execution>
<id>performanceTests</id>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<simulationClass>simulations.SimulationClass</simulationClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
This is the error that i came across:
12:50:36.313 [main][WARN ][ZincCompiler.scala:141] i.g.c.ZincCompiler$ -
Pruning sources from previous analysis, due to incompatible CompileSetup.
java.lang.ClassNotFoundException: io.gatling.app.Gatling
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:42)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Included dependency:
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
<version>2.2.5</version>
</dependency>
But now i get a new error:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at io.gatling.mojo.MainWithArgsInFile.runMain(MainWithArgsInFile.java:50)
at io.gatling.mojo.MainWithArgsInFile.main(MainWithArgsInFile.java:33)
Caused by: java.lang.NoSuchMethodError: scala.Product.$init$(Lscala/Product;)V
at com.github.mnogu.gatling.mqtt.protocol.MqttProtocolOptionPart.<init>(MqttProtocol.scala:124)
at com.github.mnogu.gatling.mqtt.protocol.MqttProtocol$.apply(MqttProtocol.scala:24)
at com.github.mnogu.gatling.mqtt.protocol.MqttProtocolBuilder$.apply(MqttProtocolBuilder.scala:13)
at com.github.mnogu.gatling.mqtt.Predef$.mqtt(Predef.scala:9)
at simulations.SimulationClass.<init>(SimulationClass.scala:10)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at java.lang.Class.newInstance(Class.java:442)
at io.gatling.app.Runner.run0(Runner.scala:79)
at io.gatling.app.Runner.run(Runner.scala:64)
at io.gatling.app.Gatling$.start(Gatling.scala:59)
at io.gatling.app.Gatling$.fromArgs(Gatling.scala:43)
at io.gatling.app.Gatling$.main(Gatling.scala:35)
at io.gatling.app.Gatling.main(Gatling.scala)
...
Any leads regarding this problem would be of great help.
Thank you
Your error says that you are missing following dependency,
<!-- https://mvnrepository.com/artifact/io.gatling/gatling-app -->
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
<version>2.2.5</version>
</dependency>
Updated
Your second error is mainly because the jar file that your code refers at runtime is not the same jar file that is used at compile time. So make sure that you are using the same jar while compiling and while running.
For that, you can delete the dependent jar files, maven clean your project and recompile and run the program.
Looks like the external jar i was using was compliant only with gatling core 2.2.3. Reverting the gatling core version to 2.2.3 and scala version to 2.11.8 solved the problem.
Here is how my pom now looks:
<dependency>
<groupId>io.gatling.highcharts</groupId>
<artifactId>gatling-charts-highcharts</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-core</artifactId>
<version>2.2.3</version>
</dependency>
<dependency>
<groupId>io.gatling</groupId>
<artifactId>gatling-app</artifactId>
<version>2.2.3</version>
</dependency>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
<configuration>
<scalaVersion>2.11.8</scalaVersion>
</configuration>
</plugin>
<plugin>
<groupId>io.gatling</groupId>
<artifactId>gatling-maven-plugin</artifactId>
<version>2.2.3</version>
<executions>
<execution>
<id>performanceTests</id>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<simulationClass>simulations.SimulationClass</simulationClass>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

Spring boot error in main method due to org.springframework.boot.SpringApplication not found

I followed the steps given over here https://www.javatpoint.com/spring-maven-project
My pom.xml
....
<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>com.sample</groupId>
<artifactId>spring-boot-simple</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
</parent>
<properties>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<start-class>com.sample.SpringBootSimpleApp</start-class>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
My application class
package com.sample;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
#SpringBootApplication
public class SpringBootSimpleApp {
public static void main(String[] args){
try{
Class.forName("com.sample.SpringBootSimpleApp");
SpringApplication.run(SpringBootSimpleApp.class, args);
}
catch(Exception e){
e.printStackTrace();
}
}
}
Buid is fine i am able to generate the jar files, by Eclipse RunAs -> Maven Build.. with goals clean install
When i use eclipse run as java application i get the following error
Exception in thread "main" java.lang.NoClassDefFoundError: org/springframework/boot/SpringApplication
at com.sample.SpringBootSimpleApp.main(SpringBootSimpleApp.java:18)
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
I am using eclipse neon.3, workspace configured with alternate jre - installed jdk 1.8, workspace compiler level at 1.8.
pls help in running the application class.
I'd guess that Maven has corrupted a jar file when it downloaded it. Try running mvn dependency:purge-local-repository and then rebuilding your application

Compiling Scala Using Maven

I want to create a hello world application using maven.
here is my pom.xml:
<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>ColossusPlay</groupId>
<artifactId>ColossusPlay</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.tumblr</groupId>
<artifactId>colossus-metrics_2.10</artifactId>
<version>0.8.1-RC1</version>
</dependency>
</dependencies>
</project>
and here is my scala code:
object Main extends App{
println( "Helo World" )
}
when I run
mvn package
it generates a jar file in the target directory. Then what I want to be able to do is run that jar file using
scala target/ColossusPlay-0.0.1-SNAPSHOT.jar
However I get NullPointer Exception like this:
java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:348)
at scala.reflect.internal.util.ScalaClassLoader$$anonfun$tryClass$1.apply(ScalaClassLoader.scala:43)
at scala.reflect.internal.util.ScalaClassLoader$$anonfun$tryClass$1.apply(ScalaClassLoader.scala:43)
at scala.util.control.Exception$Catch$$anonfun$opt$1.apply(Exception.scala:119)
at scala.util.control.Exception$Catch$$anonfun$opt$1.apply(Exception.scala:119)
at scala.util.control.Exception$Catch.apply(Exception.scala:103)
at scala.util.control.Exception$Catch.opt(Exception.scala:119)
at scala.reflect.internal.util.ScalaClassLoader$class.tryClass(ScalaClassLoader.scala:42)
at scala.reflect.internal.util.ScalaClassLoader$class.tryToInitializeClass(ScalaClassLoader.scala:39)
at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.tryToInitializeClass(ScalaClassLoader.scala:101)
at scala.reflect.internal.util.ScalaClassLoader$class.run(ScalaClassLoader.scala:63)
at scala.reflect.internal.util.ScalaClassLoader$URLClassLoader.run(ScalaClassLoader.scala:101)
at scala.tools.nsc.CommonRunner$class.run(ObjectRunner.scala:22)
at scala.tools.nsc.JarRunner$.run(MainGenericRunner.scala:13)
at scala.tools.nsc.CommonRunner$class.runAndCatch(ObjectRunner.scala:29)
at scala.tools.nsc.JarRunner$.runJar(MainGenericRunner.scala:25)
at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:69)
at scala.tools.nsc.MainGenericRunner.run$1(MainGenericRunner.scala:87)
at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:98)
at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:103)
at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)
What am I missing?
Update:
The problem appears to be that the maven build does not see the source files. I tried to force it to have a build error writing nonesense to the source file but the mvn package still says build success. Additionaly when I examine the jar file, there isn't any class files inside. How can I make the maven see the source files.
You have to add a scale compiler plugin such sbt-compiler plugin
SBT compiler plugin
Example pom
<plugin>
<groupId>com.google.code.sbt-compiler-maven-plugin</groupId>
<artifactId>sbt-compiler-maven-plugin</artifactId>
<version>1.0.0-beta9</version>
<executions>
<execution>
<id>default-sbt-compile</id>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
Using maven with scala in specific use case ( profiles, complex deployments, deep hierarchy ) is even better than pure sbt , but at the beginning is a bit tricky.

Struts2-Maven in eclipse IDE

I have imported this Struts2-maven project in to my Eclipse.
here is my pom.xml for Struts2
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>manning</groupId>
<artifactId>Form_Tags_Struts2_Mvn</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>Form_Tags_Struts2_Mvn</name>
<build>
<finalName>Form_Tags_Struts2_Mvn</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun</groupId>
<artifactId>tools</artifactId>
<version>1.7.0_05</version>
<scope>system</scope>
<systemPath>/usr/lib/jvm/jdk1.7.0_05/lib/tools.jar</systemPath>
</dependency>
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>2.3.1.2</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
But when am try to run it shows an exception.
Here is my Exception:
SEVERE: Exception starting filter struts2
java.lang.ClassNotFoundException: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:532)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:514)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:133)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:256)
at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:382)
at org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:103)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4650)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5306)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
Can any one please help me? actually what happens ?
Try checking your deployment dependency of your project (Properties > Deployment Assembly) and check if Maven Dependencies are included. If you try to add them using Add > Java Build path entries and then select your maven thing.
Hope that helps :)