Exception in thread "main" java.lang.IllegalAccessError: in storm topology - apache-storm

I am getting IllegalAccesserror when I was running my storm topology to read the Kafka topic and write the data to Hive table: Error details are below:
Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.apache.logging.log4j.core.lookup.MapLookup.newMap(I)Ljava/util/HashMap; from class org.apache.logging.log4j.core.lookup.MainMapLookup
at org.apache.logging.log4j.core.lookup.MainMapLookup.<clinit>(MainMapLookup.java:37)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.logging.log4j.core.util.ReflectionUtil.instantiate(ReflectionUtil.java:185)
at org.apache.logging.log4j.core.lookup.Interpolator.<init>(Interpolator.java:65)
at org.apache.logging.log4j.core.config.AbstractConfiguration.doConfigure(AbstractConfiguration.java:346)
at org.apache.logging.log4j.core.config.AbstractConfiguration.start(AbstractConfiguration.java:161)
at org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:359)
at org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:420)
at org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:138)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:147)
at org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:41)
at org.apache.logging.log4j.LogManager.getContext(LogManager.java:175)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getContext(AbstractLoggerAdapter.java:102)
at org.apache.logging.slf4j.Log4jLoggerFactory.getContext(Log4jLoggerFactory.java:43)
at org.apache.logging.log4j.spi.AbstractLoggerAdapter.getLogger(AbstractLoggerAdapter.java:42)
at org.apache.logging.slf4j.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:29)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:277)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:288)
at org.apache.storm.hive.bolt.mapper.DelimitedRecordHiveMapper.<clinit>(DelimitedRecordHiveMapper.java:39)
at com.macys.smt.apm.storm.topology.HiveORCTopology.run(HiveORCTopology.java:79)
at com.macys.smt.apm.storm.topology.HiveORCTopology.main(HiveORCTopology.java:46)`
Code of my Storm Topology:
public class HiveORCTopology {
public static final String KAFKA_SPOUT_ID = "kafka-spout";
public static final String HIVE_PROCESS_BOLT_ID = "hive-process-bolt";
public static final String HIVE_BOLT_ID = "hive-bolt";
public static void main(String[] args) {
HiveORCTopology hot = new HiveORCTopology();
hot.run();
}
public void run(){
String kafkaTopic = "APMPathZip";
BrokerHosts brokerHosts = new ZkHosts("sandbox.hortonworks.com:2181");
String kafkaConsumerGroup = "APM-CALLTRACE-KAFKA-SPOUT";
SpoutConfig spoutConfig = new SpoutConfig(brokerHosts, kafkaTopic, "/kafkastorm",kafkaConsumerGroup);
//SpoutConfig spoutConfig = new SpoutConfig(new ZkHosts("localhost:2181"),
// kafkaTopic, "/kafka_storm", "StormSpout");
//spoutConfig.useStartOffsetTimeIfOffsetOutOfRange = true;
//spoutConfig.startOffsetTime = System.currentTimeMillis();
//KafkaSpout kafkaSpout = new KafkaSpout(spoutConfig);
// Hive connection configuration
//String metaStoreURI = "thrift://one.hdp:9083";
String metaStoreURI = "thrift://sandbox.hortonworks.com:9083";
//String metaStoreURI = "http://localhost:8080/";
String dbName = "default";
String tblName = "apmpathorc";
// Fields for possible partition
// String[] partNames = {"name"};
// Fields for possible column data
String[] colNames = {"id", "endtime", "host", "starttime", "appservername",
"appname", "class", "method", "eventdate", "executiontime", "threadid"};
// Record Writer configuration
DelimitedRecordHiveMapper mapper = new DelimitedRecordHiveMapper()
.withColumnFields(new Fields(colNames));
// .withPartitionFields(new Fields(partNames));
HiveOptions hiveOptions;
hiveOptions = new HiveOptions(metaStoreURI, dbName, tblName, mapper)
.withTxnsPerBatch(2)
.withBatchSize(100)
.withIdleTimeout(10)
.withCallTimeout(10000000);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(KAFKA_SPOUT_ID, new KafkaSpout(spoutConfig));
builder.setBolt(HIVE_PROCESS_BOLT_ID, new HiveDataBolt()).shuffleGrouping(KAFKA_SPOUT_ID);
builder.setBolt(HIVE_BOLT_ID, new HiveBolt(hiveOptions)).shuffleGrouping(HIVE_PROCESS_BOLT_ID);
String topologyName = "StormHiveStreamingTopology";
Config config = new Config();
config.setNumWorkers(1);
config.setMessageTimeoutSecs(60);
try {
StormSubmitter.submitTopology(topologyName, config, builder.createTopology());
} catch (AlreadyAliveException | InvalidTopologyException | AuthorizationException ex) {
Logger.getLogger(HiveORCTopology.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
and 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.macys.smt</groupId>
<artifactId>APM-Storm2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>APM-Storm2</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>3.4.5</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>jdk.tools</groupId>
<artifactId>jdk.tools</artifactId>
<scope>system</scope>
<version>1.7.0</version>
<systemPath>C:\\Program Files\\Java\\jdk1.7.0_76\\lib\\tools.jar</systemPath>
</dependency>
<dependency>
<groupId>com.macys.smt</groupId>
<artifactId>APM-Common</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.macys.smt</groupId>
<artifactId>HBaseDAO</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.10.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-kafka</artifactId>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.10</artifactId>
<version>0.8.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-hive</artifactId>
<version>0.10.0</version>
</dependency>
<!-- <dependency> <groupId>org.apache.storm</groupId> <artifactId>storm-hive</artifactId>
<version>0.9.3.2</version> </dependency> -->
<dependency>
<groupId>org.apache.hive.hcatalog</groupId>
<artifactId>hive-hcatalog-streaming</artifactId>
<version>1.2.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-avatica</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hive.hcatalog</groupId>
<artifactId>hive-hcatalog-core</artifactId>
<version>2.0.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-avatica</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.hive</groupId>
<artifactId>hive-cli</artifactId>
<version>1.2.0</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-core</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.calcite</groupId>
<artifactId>calcite-avatica</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency> <groupId>org.apache.calcite</groupId> <artifactId>calcite-core</artifactId>
<version>0.9.2-incubating</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId> </exclusion> </exclusions> </dependency> -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<!-- Bind the maven-assembly-plugin to the package phase this will create
a jar file without the storm dependencies suitable for deployment to a cluster. -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Please help me out.
Thanks.

I had the same error when I was trying to deploy a topology in my storm cluster: check and recheck whether the all the jars you are submitting do not have any duplicates that storm may be already providing in the classpath.
In my case, once I made sure the slf4j jar was not in the submitted jars, I tried again and it worked just fine.
As I see in your pom.xml, you have to change the log4j scope to provided
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
In any case, you should also check which jars are already submitted by storm and remove them from the your dependencies.
When I run my topology in storm, storm makes this call:
Running: /usr/local/java/jdk1.8.0_91/bin/java -client -Ddaemon.name= -Dstorm.options= -Dstorm.home=/home/ubuntu/apache-storm-1.0.1 -Dstorm.log.dir=/home/ubuntu/apache-storm-1.0.1/logs -Djava.library.path= -Dstorm.conf.file=
-cp /home/ubuntu/apache-storm-1.0.1/lib/disruptor-3.3.2.jar:
/home/ubuntu/apache-storm-1.0.1/lib/kryo-3.0.3.jar:
/home/ubuntu/apache-storm-1.0.1/lib/asm-5.0.3.jar:
/home/ubuntu/apache-storm-1.0.1/lib/storm-rename-hack-1.0.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/servlet-api-2.5.jar:
/home/ubuntu/apache-storm-1.0.1/lib/slf4j-api-1.7.7.jar:
/home/ubuntu/apache-storm-1.0.1/lib/reflectasm-1.10.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/log4j-api-2.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/storm-core-1.0.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/log4j-core-2.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/objenesis-2.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/log4j-slf4j-impl-2.1.jar:
/home/ubuntu/apache-storm-1.0.1/lib/log4j-over-slf4j-1.6.6.jar:
/home/ubuntu/apache-storm-1.0.1/lib/minlog-1.3.0.jar:
/home/ubuntu/apache-storm-1.0.1/lib/clojure-1.7.0.jar:
storm-1.0.0-jar-with-dependencies.jar:
/home/ubuntu/apache-storm-1.0.1/conf:
/home/ubuntu/apache-storm-1.0.1/bin -Dstorm.jar=<your-jar-with-dependencies> <your main class>
here you can see that the log4j-core-2.1.jar is being provided by storm, producing a collision, leading to the exception you are seeing. See this other related question.

Related

Integrate kie-server into spring boot application

I want to integrate all the kie-server autoconfiguration (especially JBPM) in my spring boot application.
I added these gradle dependencies in a separate module of my project
dependencies {
compile group: 'org.kie', name: 'kie-server-spring-boot-starter', version: '7.29.0.Final'
compile group: 'xerces', name: 'xercesImpl', version: '2.12.0'
}
then I added the configuration properties suggested by this link
https://github.com/kiegroup/droolsjbpm-integration/blob/master/kie-spring-boot/kie-spring-boot-samples/jbpm-spring-boot-sample-basic/src/main/resources/application-postgres.properties
then I tryed to start the application, but I got this error:
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in org.jbpm.springboot.datasources.JBPMDataSourceAutoConfiguration required a bean of type 'org.springframework.boot.jdbc.XADataSourceWrapper' that could not be found.
Action:
Consider defining a bean of type 'org.springframework.boot.jdbc.XADataSourceWrapper' in your configuration.
The JBPMDataSourceAutoConfiguration class is linked below
https://github.com/kiegroup/droolsjbpm-integration/blob/master/kie-spring-boot/kie-spring-boot-autoconfiguration/jbpm-spring-boot-data-sources/src/main/java/org/jbpm/springboot/datasources/JBPMDataSourceAutoConfiguration.java
How can I correctly configure an embedded integration of jbpm/drools/kie in my existing spring boot project?
----------UPDATE-------------
After setting the property spring.jta.enabled = true, the exception changed in
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of constructor in org.jbpm.springboot.datasources.JBPMDataSourceAutoConfiguration required a bean of type 'org.springframework.boot.jdbc.XADataSourceWrapper' that could not be found.
The following candidates were found but could not be injected:
- Bean method 'xaDataSourceWrapper' in 'NarayanaConfiguration.GenericJdbcConfiguration' not loaded because #ConditionalOnProperty (narayana.dbcp.enabled=false) found different value in property 'narayana.dbcp.enabled'
- Bean method 'xaDataSourceWrapper' in 'NarayanaConfiguration.GenericJdbcConfiguration' not loaded because Ancestor me.snowdrop.boot.narayana.autoconfigure.NarayanaConfiguration did not match
- Bean method 'xaDataSourceWrapper' in 'NarayanaConfiguration.PooledJdbcConfiguration' not loaded because Ancestor me.snowdrop.boot.narayana.autoconfigure.NarayanaConfiguration did not match
- Bean method 'xaDataSourceWrapper' in 'AtomikosJtaConfiguration' not loaded because #ConditionalOnClass did not find required class 'com.atomikos.icatch.jta.UserTransactionManager'
- Bean method 'xaDataSourceWrapper' in 'BitronixJtaConfiguration' not loaded because #ConditionalOnClass did not find required class 'bitronix.tm.jndi.BitronixContext'
Action:
Consider revisiting the entries above or defining a bean of type 'org.springframework.boot.jdbc.XADataSourceWrapper' in your configuration.
Spring boot uses an embedded tomcat.
It took me a lot of time to make jbpm engine work as a spring boot application with an embedded tomcat, a lot of configs and hacks, especially for the controller 's password which can't be loaded from JKS
So, you need to declare JNDI lookup resources manually.
import org.apache.catalina.Context;
import org.apache.catalina.startup.Tomcat;
import org.apache.tomcat.util.descriptor.web.ContextResource;
import org.kie.server.services.api.KieServer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.embedded.tomcat.TomcatWebServer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.jndi.JndiObjectFactoryBean;
import javax.naming.NamingException;
import javax.sql.DataSource;
#SpringBootApplication
public class KieServerApplication {
private static final Logger log = LoggerFactory.getLogger(KieServerApplication.class);
public static void main(String[] args) throws NamingException {
log.info("Starting things");
SpringApplication.run(KieServerApplication.class, args);
}
#Autowired
private Environment env;
#Bean
public TomcatServletWebServerFactory tomcatFactory() {
return new TomcatServletWebServerFactory() {
#Override
protected TomcatWebServer getTomcatWebServer(
Tomcat tomcat) {
tomcat.enableNaming();
return super.getTomcatWebServer(tomcat);
}
#Override
protected void postProcessContext(Context context) {
final ContextResource jbpmProjectDs = new ContextResource();
jbpmProjectDs.setName("jdbc/jbpmProjectDs");
jbpmProjectDs.setType(DataSource.class.getName());
jbpmProjectDs.setProperty("driverClassName", "com.mysql.cj.jdbc.Driver");
jbpmProjectDs.setProperty("url",env.getProperty("spring.mamodb.datasource.url"));
marjoryDs.setProperty("username", env.getProperty("spring.mamodb.datasource.username"));
jbpmProjectDs.setProperty("password", env.getProperty("spring.mamodb.datasource.password"));
context.getNamingResources().addResource(jbpmProjectDs);
final ContextResource narayanaTransactionManager = new ContextResource();
narayanaTransactionManager.setName("TransactionManager");
narayanaTransactionManager.setType(javax.transaction.TransactionManager.class.getName());
narayanaTransactionManager.setProperty("factory","org.jboss.narayana.tomcat.jta.TransactionManagerFactory");
context.getNamingResources().addResource(narayanaTransactionManager);
final ContextResource transactionSynchronizationRegistry = new ContextResource();
transactionSynchronizationRegistry.setName("TransactionSynchronizationRegistry");
transactionSynchronizationRegistry.setType(javax.transaction.TransactionSynchronizationRegistry.class.getName());
transactionSynchronizationRegistry.setProperty("factory","org.jboss.narayana.tomcat.jta.TransactionSynchronizationRegistryFactory");
context.getNamingResources().addResource(transactionSynchronizationRegistry);
}
};
}
#Bean(destroyMethod = "")
public DataSource jndiDataSource() throws IllegalArgumentException, NamingException {
JndiObjectFactoryBean bean = new JndiObjectFactoryBean();
bean.setJndiName("java:comp/env/jdbc/jbpmProjectDs");
bean.setProxyInterface(DataSource.class);
bean.setLookupOnStartup(false);
bean.afterPropertiesSet();
return (DataSource) bean.getObject();
}
#Bean
CommandLineRunner deployAndValidate() {
return new CommandLineRunner() {
#Autowired
private KieServer kieServer;
#Override
public void run(String... strings) {
log.info("KieServer {} started", kieServer);
}
};
}
}
** properties Config **
#transaction manager configuration
spring.jta.narayana.transaction-manager-id="1"
narayana.transaction-manager-id=1
narayana.dbcp.enabled=true
narayana.dbcp.maxTotal=20
spring.jta.log-dir=./target/tx-object-store
narayana.periodic-recovery-period=10
narayana.recovery-backoff-period=10
POM file just for dependencies:
<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>
<parent>
<groupId>org.kie</groupId>
<artifactId>kie-spring-boot-samples</artifactId>
<version>7.29.0.Final</version>
</parent>
<artifactId>kie-server</artifactId>
<name>KIE Server</name>
<description>KIE Server SpringBoot </description>
<properties>
<version.org.keycloak>5.0.0</version.org.keycloak>
</properties>
<dependencies>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-server-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
</dependency>
<dependency>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger-ui</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<exclusions>
<exclusion>
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>net.minidev</groupId>
<artifactId>accessors-smart</artifactId>
</exclusion>
<exclusion>
<groupId>com.vaadin.external.google</groupId>
<artifactId>android-json</artifactId>
</exclusion>
<exclusion>
<groupId>org.skyscreamer</groupId>
<artifactId>jsonassert</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kie.server</groupId>
<artifactId>kie-server-client</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.jboss.spec.javax.ws.rs</groupId>
<artifactId>jboss-jaxrs-api_2.1_spec</artifactId>
</exclusion>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jboss.narayana.tomcat</groupId>
<artifactId>tomcat-jta</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-transaction-spi</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
</dependency>
<dependency>
<groupId>com.github.relaxng</groupId>
<artifactId>relaxngDatatype</artifactId>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
<dependency>
<groupId>org.jboss.narayana.tomcat</groupId>
<artifactId>tomcat-jta</artifactId>
<version>5.9.0.Final</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.4.2</version>
</dependency>
<dependency>
<groupId>org.keycloak.bom</groupId>
<artifactId>keycloak-adapter-bom</artifactId>
<version>${version.org.keycloak}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.17</version>
</dependency>
<dependency>
<groupId>io.marjory</groupId>
<artifactId>model</artifactId>
<version>1.0.99-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.marjory</groupId>
<artifactId>marjory-jta</artifactId>
<version>0.0.2</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-rs-service-description-swagger</artifactId>
<version>${version.org.apache.cxf}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>8.0.23</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-transaction-spi</artifactId>
<version>7.6.0.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.transaction</groupId>
<artifactId>jboss-transaction-api_1.2_spec</artifactId>
<version>1.1.1.Final</version>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<dependency>
<groupId>pull-parser</groupId>
<artifactId>pull-parser</artifactId>
<version>2.1.10</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.20.0-GA</version>
</dependency>
<dependency>
<groupId>net.bytebuddy</groupId>
<artifactId>byte-buddy</artifactId>
<version>1.8.17</version>
</dependency>
<dependency>
<groupId>com.github.relaxng</groupId>
<artifactId>relaxngDatatype</artifactId>
<version>2011.1</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>mysql</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>QuickBuild</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<includes>
<include>com/marjory/kie/server/*.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>go-to-hell</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Cheers,
just go to start.jbpm.org and
download ready made spring booy kie-server!

Unable to access Swagger UI from Spring Boot app deployed on External tomcat 7.62 server

Please suggest me what configurations I am missing. My works perfectly when I am running the application locally as a spring-boot jar with mvn spring-boot:run.
But when I try to run the application on external tomcat, I am unable to access swagger UI and swagger end point http://localhost:8090/automation-core/swagger-resources/configuration/ui/.
My steps for running externally are.
mvn clean install -U -DskipTests -Pqa (create a war)
I am deploying that war on Tomcat 7.62
pom.xml
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.6.1</version>
<exclusions>
<exclusion>
<artifactId>mapstruct</artifactId>
<groupId>org.mapstruct</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.6.1</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>swagger-ui</artifactId>
<version>2.2.10</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.0</version>
<exclusions>
<exclusion>
<artifactId>commons-lang3</artifactId>
<groupId>org.apache.commons</groupId>
</exclusion>
<exclusion>
<artifactId>swagger-models</artifactId>
<groupId>io.swagger</groupId>
</exclusion>
</exclusions>
</dependency>
<profile>
<id>local</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>local</spring.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>${tomcat.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</profile>
<profile>
<id>qa</id>
<properties>
<spring.profiles.active>qa</spring.profiles.active>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>7.0.62</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</profile>
application.java
#SpringBootApplication
#ImportResource({"classpath:springbeans.xml", "classpath:context.xml"})
#ComponentScan("com.comapany")
#Configuration
#PropertySource({"classpath:application.properties","classpath:database.properties", "classpath:authentication.properties","classpath:credentials.properties"})
#EnableAsync
#EnableRetry
#EnableAutoConfiguration
#EnableMongoRepositories
#EnableSwagger2
public class Application extends AsyncConfigurerSupport
{
public static void main(String[] args) {
//System.setProperty("java.awt.headless", "false");
SpringApplication.run(Application.class, args);
}
#Bean(name="sVNClient",initMethod="init", destroyMethod="clean")
public SVNClient sVNClient() {
return new SVNClient();
}
#Override
public Executor getAsyncExecutor()
{
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(2);
executor.setMaxPoolSize(5);
executor.setQueueCapacity(100);
executor.setThreadNamePrefix("webscan-report");
executor.initialize();
return executor;
}
}
SwaggerConfig.java
#Configuration
#EnableWebMvc
public class SwaggerConfig extends WebMvcConfigurerAdapter{
#Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any()).build();
}
#Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/swagger-ui/**").addResourceLocations("classpath:/META-INF/resources/webjars/swagger-ui/2.2.10/");
}
}

Only first request mapping resolves Java Spring Boot (circular view path)

I'm trying to map several request paths in my Spring Boot application. It's a RESTful web service but I wanted to have two views (main and help) for user interface. I've tried tweaking the names of the return string (ie. from "help.html to "help"), as well as cleaning my project and rebuilding, but I cannot figure why one view resolves and the other view does not and returns a circular path. I've also tried creating a separate HelpController and mapping it there. I don't see anything different I am doing between the two.
Here is my MainController.java:
#Controller
public class MainController {
#RequestMapping(value = "/help", method = RequestMethod.GET)
public String help(){
System.out.println("GET called on help page");
return "help.html";
}
#RequestMapping(value = "/main", method = RequestMethod.GET)
public String landing(){
System.out.println("GET called on index page");
return "landing.html";
}
}
My App.java:
#SpringBootApplication
#EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, HibernateJpaAutoConfiguration.class})
public class App {
// private static final Logger logger = Logger.getLogger(App.class.toString());
public static void main(String[] args){
SpringApplication.run(App.class, args);
}
}
I put my two html templates in the resources/static directory:
But only one of these two paths resolve correctly. main.html looks great:
But help.html has a circular reference I cannot resolve or understand:
Here is my pom.xml (certain tags omitted for privacy):
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>1.5.2.RELEASE</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>dynamodb-local-oregon</id>
<name>DynamoDB Local Release Repository</name>
<url>https://s3-us-west-2.amazonaws.com/dynamodb-local/release</url>
</repository>
</repositories>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
</parent>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>1.5.2.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.derjust/spring-data-dynamodb -->
<dependency>
<groupId>com.github.derjust</groupId>
<artifactId>spring-data-dynamodb</artifactId>
<version>4.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-dynamodb -->
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-dynamodb</artifactId>
<version>1.11.125</version>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>Gosling-SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-bom</artifactId>
<version>${aws-java-sdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.5.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<exclusions>
<exclusion>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.3.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.4.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.3.3.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>DynamoDBLocal</artifactId>
<version>${aws.dynamodblocal.version}</version>
</dependency>
</dependencies>
</project>
the simplest way to solve your issue is to change the mapping from /help to something else, or rename the static file help.html.
The reason for the circular dependency is because the view name help.html will again get mapped to your controller. Spring MVC uses a suffix to determine a mimetype of the response by default, this means that a method mapped to /help, will intercept the /help.html request as well

maven surefire report plugin not running the test cases

I have configured surefire report plugin to my Spring+Maven based project to generate test report(s) and the surefire report plugin able to identify my test class but not running the test cases present in it.
Dependency used in pom.xml
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.18.1</version>
</plugin>
</plugins>
</reporting>
While building the project it genertes the result as bellow
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.thales.idct.controller.LopaReConfigControllerTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#1829ae5e
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.225 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
Even the same things is present in *.html report as well.
Bellow is my test case code
#RunWith(SpringJUnit4ClassRunner.class)
#ContextConfiguration(loader=AnnotationConfigWebContextLoader.class)
#WebAppConfiguration
public class LopaReConfigControllerTest {
public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));
// Application dependency
private MockMvc mvc;
private LopaReConfigRepositoryImpl lopaImpl;
/*#Spy
#InjectMocks
LopaReConfigService lopaReConfigService = new LopaReConfigService();*/
#Mock
LopaReConfigService lopaReConfigService;
#Mock
CommonUtil commonUtil;
#Mock
ProcessLopaReconfigFile processLopaReconfigFile;
#Mock
DBImportRepository dbImportRepository;
#InjectMocks
MockHttpSession session;
#Autowired
WebApplicationContext context;
#InjectMocks
LopaReConfigController lopaReConfigController;
#Mock
UserSessionPool sessionPool;
// Building and Injecting mocked dependency(s) to controller
#Before
public void setup() {
// Process mock annotations
MockitoAnnotations.initMocks(this);
this.mvc = MockMvcBuilders.standaloneSetup(lopaReConfigController).build();
lopaImpl = new LopaReConfigRepositoryImpl();
}
#Test
public void test_getSeatLayoutDisplay() throws Exception {
// Construct JSON data to pass as parameter
BASeatkitDataFeeder seatKitDataFeeder = new BASeatkitDataFeeder();
Gson gson = new Gson();
CommonUtil util = new CommonUtil();
StringBuffer filePathBuff = new StringBuffer();
String jsonStub = "";
String columnXMl = "";
filePathBuff.append(util.getLopaReConfigPath("RAJESH-300ER", "RAJESH-300ER-B777-v300B"));
filePathBuff.append(LoadPropertyFiles.getInstance().getProperty("INPUT"));
//seatKitDataFeeder.setFilepath(XmlFilePath);
seatKitDataFeeder.setMode("");
seatKitDataFeeder.setFilename("");
seatKitDataFeeder.setBuildVersion("Base");
seatKitDataFeeder.setCarrierName("RAJESH-300ER");
seatKitDataFeeder.setDbId("1558");
seatKitDataFeeder.setDbName("RAJESH-300ER-B777-v300B");
seatKitDataFeeder.setSessionId(session.getId());
seatKitDataFeeder.setFilepath(filePathBuff.toString());
String seatKitXmlFilePath = filePathBuff.append(LoadPropertyFiles.getInstance().getProperty("XMLS")).toString();
columnXMl = filePathBuff.append(Constants.COLUMN_XML_FILENAME).toString();
BASeatKitInfo BAinfo = lopaImpl.getBASeatKit(seatKitXmlFilePath);
KitLayout kitLayout = lopaImpl.getBAColumnSeatKit(seatKitXmlFilePath+Constants.SEATKIT_COLUMN_XML_FILENAME,columnXMl);
// Mock the service results and feed
when(commonUtil.getLopaReConfigPath("RAJESH-300ER", "RAJESH-300ER-B777-v300B")).thenReturn(filePathBuff.toString());
when(lopaReConfigService.getBASeatKit(Mockito.anyString())).thenReturn(BAinfo);
when(lopaReConfigService.getBAColumnSeatKit(Mockito.anyString(),Mockito.anyString())).thenReturn(kitLayout);
// Construct JSON Object
jsonStub = gson.toJson(seatKitDataFeeder);
// Test method logic
mvc.perform(post("/getSeatLayoutDisplay")
.contentType(MediaType.APPLICATION_JSON).content(jsonStub))
.andExpect(status().isOk()) // After hitting specific URL/URI check the status code fall under 200 series
.andExpect(content().contentType(APPLICATION_JSON_UTF8)); // Check the return statement is JSON
//.andExpect(jsonPath("$.fieldErrors", hasSize(1)));
// Verify that the getBASeatKit() method of the lopaReConfigService is called only once during execution.
verify(lopaReConfigService, times(0)).getBASeatKit(seatKitXmlFilePath);
verify(lopaReConfigService, times(0)).getBAColumnSeatKit(seatKitDataFeeder.getFilepath(),columnXMl);
}
#Test
public void testGetBAColumnSeatKit() throws Exception{
BAColumnSeatkitDataFeeder seatKitDataFeeder = new BAColumnSeatkitDataFeeder();
Gson gson = new Gson();
CommonUtil util = new CommonUtil();
StringBuffer filePathBuff = new StringBuffer();
String jsonStub = "";
String columnXMl = "";
String centerXmlFilePath = "";
LopaReConfigController cntrl = PowerMockito.spy(lopaReConfigController);
seatKitDataFeeder.setMode("");
seatKitDataFeeder.setFileName("");
seatKitDataFeeder.setBuildVersion("Base");
seatKitDataFeeder.setCarrierName("BRITISH");
seatKitDataFeeder.setDbId("1514");
seatKitDataFeeder.setDbName("BRITISH-B787-PI-2-8");
seatKitDataFeeder.setSessionId(session.getId());
seatKitDataFeeder.setFilePath(filePathBuff.toString());
when(processLopaReconfigFile.getImportStatus(Integer.parseInt(seatKitDataFeeder.getDbId()))).thenReturn(Constants.SUCCESS);
filePathBuff = new StringBuffer(util.getLopaReConfigPath(seatKitDataFeeder.getCarrierName(),seatKitDataFeeder.getDbName()));
filePathBuff.append(LoadPropertyFiles.getInstance().getProperty("INPUT"));
String seatKitXmlFilePath = filePathBuff.append(LoadPropertyFiles.getInstance().getProperty("XMLS")).toString();
StringBuffer columnXmlFileBuf = new StringBuffer(filePathBuff);
columnXmlFileBuf.append(Constants.COLUMN_XML_FILENAME);
String leftXmlFilePath = filePathBuff.append(Constants.COLUMN_SEATKIT).toString();
String columnXmlFilePath = columnXmlFileBuf.toString();
if("Base".equalsIgnoreCase(seatKitDataFeeder.getBuildVersion())){
centerXmlFilePath = leftXmlFilePath;
} else {
centerXmlFilePath=lopaImpl.getLopaFilePath(seatKitDataFeeder.getBuildVersion(),seatKitDataFeeder.getDbId());
}
BASeatKitInfo seatKitInfo = lopaImpl.getBASeatKit(seatKitXmlFilePath);
KitLayout columnSeatKitLeft = lopaImpl.getBAColumnSeatKit(leftXmlFilePath,columnXmlFilePath);
KitLayout columnSeatKitCenter = lopaImpl.getBAColumnSeatKit(centerXmlFilePath,columnXmlFilePath);
Map<String,String> powerMap = lopaImpl.getPowerUnitInfo(seatKitXmlFilePath);
List<LayoutDesignVersionEntity> listLDVE = dbImportRepository.getLayoutDesignVersionList(Integer.parseInt(seatKitDataFeeder.getDbId()));
User user = new User();
user.setAirlineName("BRITISH-B787-PI-2-8");
user.setGroupName("FFF");
user.setLastLoginTime("12:12:12 10:09:09.656");
user.setPassword("FFF");
user.setUserName("FFF");
UserSessionPool.getInstance().addUser(user);
// when(commonUtil.getLopaReConfigPath(Mockito.anyString(),Mockito.anyString())).thenReturn(filePathBuff.toString());
//when(commonUtil.getLopaReConfigPath("RAJESH-300ER", "RAJESH-300ER-B777-v300B")).thenReturn(filePathBuff.toString());
when(commonUtil.getLopaReConfigPath("RAJESH-300ER", "RAJESH-300ER-B777-v300B")).thenReturn(filePathBuff.toString());
when(lopaReConfigService.getBASeatKit(seatKitXmlFilePath)).thenReturn(seatKitInfo);
when(lopaReConfigService.getBAColumnSeatKit(leftXmlFilePath,columnXmlFilePath)).thenReturn(columnSeatKitLeft);
when(lopaReConfigService.getBAColumnSeatKit(centerXmlFilePath,columnXmlFilePath)).thenReturn(columnSeatKitCenter);
when(lopaReConfigService.getPowerUnitInfo(seatKitXmlFilePath)).thenReturn(powerMap);
when(dbImportRepository.getLayoutDesignVersionList(Integer.parseInt(seatKitDataFeeder.getDbId()))).thenReturn(listLDVE);
jsonStub = gson.toJson(seatKitDataFeeder);
System.out.println(jsonStub);
PowerMockito.doNothing().when(cntrl,"isValidUser",seatKitDataFeeder.getSessionId());
mvc.perform(post("/getSeatKitAndLopaInfo")
.contentType(MediaType.APPLICATION_JSON).content(jsonStub))
.andExpect(status().isOk());//.andExpect(jsonPath("airline", "B787-8").exists());// After hitting specific URL/URI check the status code fall under 200 series
//.andExpect(content().contentType(APPLICATION_JSON_UTF8));// Check the return statement is JSON
verify(lopaReConfigService, times(0)).getBASeatKit(seatKitXmlFilePath);
}
}
How can I run test cases present in my test class..?
Is there any better test case reporting tool..?
My POM.xml file is as bellow
<build>
<finalName>${pom.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.jopendocument/jOpenDocument -->
<dependency>
<groupId>org.jopendocument</groupId>
<artifactId>jOpenDocument</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.0.1.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>4.2.0.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.18.0-GA</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>org.springframework.ldap</groupId>
<artifactId>spring-ldap-core</artifactId>
<version>2.0.2.RELEASE</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.0-alpha4</version>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>2.0</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.53</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>5.5.8</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<!-- http://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<!-- Unit testing dependency API's -->
<!--Testing -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- this is included in junit, make sure junit it version 4.11 -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>1.9.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>3.2.3.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>0.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path-assert</artifactId>
<version>0.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
<!-- <version>${powermock.version}</version> -->
<version>1.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.5.1</version>
<scope>test</scope>
</dependency>
</dependencies>
Please delete the maven-surefire-report-plugin from reporting tag place the bellow plugin inside the build tag
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<properties>
<property>
<name>junit</name>
<value>true</value>
</property>
</properties>
</configuration>
</plugin>
</plugins>
</build>

Spring Boot attributes of the Model are not loaded on JSP page

I'm desperate, i'm following all the tutorials and the documentations, and i succesfully create a little hello controller with spring boot, but when i'm try to use spring boot on my project, all the attributes of the spring Model/Modelview are not loaded and i don't know why.
Here my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>com.github.p4535992</groupId>
<artifactId>springMVC12</artifactId>
<version>1.6.10</version>
<packaging>war</packaging>
<name>springMVC12</name>
<description>Demo project for Spring Boot using JSPs</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<!-- Generic properties -->
<downloadSources>true</downloadSources>
<downloadJavadocs>true</downloadJavadocs>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
<java.version>1.8</java.version>
<!-- Version of the Maven properties -->
<maven-eclipse-plugin.version>2.9</maven-eclipse-plugin.version>
<maven-compiler-plugin.version>2.3.2</maven-compiler-plugin.version>
<maven-source-plugin.version>2.3</maven-source-plugin.version>
<maven-javadoc-plugin.version>2.3</maven-javadoc-plugin.version>
<maven-war-plugin.version>2.6</maven-war-plugin.version>
<maven-exec-plugin.version>1.1.1</maven-exec-plugin.version>
<maven-tomcat7-plugin.version>2.2</maven-tomcat7-plugin.version>
<maven-dependency-plugin.version>2.10</maven-dependency-plugin.version>
<mysql.version>5.1.6</mysql.version>
<javax.servlet.jstl.version>1.2</javax.servlet.jstl.version>
<!-- Json-->
<json-path.version>2.0.0</json-path.version>
<com.fasterxml.jackson.core.version>2.5.3</com.fasterxml.jackson.core.version>
<!-- Logging -->
<spring-boot-starter-logging.version>1.2.4.RELEASE</spring-boot-starter-logging.version>
<!-- Test -->
<junit.version>4.12</junit.version>
<com.github.dandelion.version>0.10.1</com.github.dandelion.version>
<!-- Apache and Commons -->
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<commons-io.version>2.4</commons-io.version>
<commons-codec.version>1.10</commons-codec.version>
<!-- UTILITY Github -->
<com.github.p4535992.utility.version>1.6.10</com.github.p4535992.utility.version>
<!--<com.github.p4535992.gate-basic.version>1.6.5</com.github.p4535992.gate-basic.version>-->
<com.github.p4535992.ExtractInfo.version>1.6.10</com.github.p4535992.ExtractInfo.version>
<start-class>com.github.p4535992.mvc.JspDemoApplication</start-class>
<!-- <tomcat.version>7.0.52</tomcat.version>-->
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.github.p4535992</groupId>
<artifactId>extractInfo</artifactId>
<version>${com.github.p4535992.ExtractInfo.version}</version>
<exclusions>
<exclusion>
<groupId>com.github.p4535992</groupId>
<artifactId>utility</artifactId>
</exclusion>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.p4535992</groupId>
<artifactId>utility</artifactId>
<version>${com.github.p4535992.utility.version}</version>
<exclusions>
<exclusion>
<groupId>org.springframework</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
<!-- Other Spring boot dependency -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<!--<scope>provided</scope>-->
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<!-- <scope>provided</scope>-->
</dependency>
<!-- <dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>-->
<!--<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>-->
<!-- Github dependency -->
<dependency>
<groupId>com.github.p4535992</groupId>
<artifactId>extractInfo</artifactId>
</dependency>
<dependency>
<groupId>com.github.p4535992</groupId>
<artifactId>utility</artifactId>
</dependency>
<!-- MySQLDatabase -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<!-- ===================== -->
<!-- Needed for JSON View -->
<!-- ===================== -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${com.fasterxml.jackson.core.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${com.fasterxml.jackson.core.version}</version>
</dependency>
<!-- Need for get json response with controller -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${com.fasterxml.jackson.core.version}</version>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>${json-path.version}</version>
<scope>test</scope>
</dependency>
<!-- Dandelion -->
<dependency>
<groupId>com.github.dandelion</groupId>
<artifactId>datatables-jsp</artifactId>
<version>${com.github.dandelion.version}</version>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<!-- Apache and Commons -->
<!-- NOTE: commons-dbcp replace from tomcat-jdbc -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<!-- Needed for PDF View -->
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>4.2.1</version>
</dependency>
<!-- Needed for XLS View -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.10-beta2</version>
</dependency>
<!-- Needed for RSS View-->
<dependency>
<groupId>com.rometools</groupId>
<artifactId>rome</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>org.apache.taglibs</groupId>
<artifactId>taglibs-standard-impl</artifactId>
<version>1.2.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- ****************************************-->
<!-- Copy dependency jar to a m2 folder -->
<!-- ****************************************-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${user.dir}/lib</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Here my MapController.java:
#Controller
public class MapController {
private static final org.slf4j.Logger logger =
org.slf4j.LoggerFactory.getLogger(MapController.class);
#Autowired
private MapService mapService;
#Autowired
private FileService fileService;
private Marker marker;
private List<Marker> arrayMarker = new ArrayList<>();
private String arrayMarker2 ="";
//List<Marker> supportArray = new ArrayList<>();
private Integer indiceMarker = 0;
/*#RequestMapping(value="/map",method= RequestMethod.GET)
public String loadMap1(Model model){
String html = mapService.getResponseHTMLString();
return "riconciliazione2/mappa/map";
}
#RequestMapping(value="/map",method = RequestMethod.POST)
public String result(#RequestParam(required=false, value="urlParam")String url,Model model){
System.out.println("url: " + url);
return "home";
}*/
#RequestMapping(value="/map",method= RequestMethod.GET)
public String loadMap2(Model model){
//String html = mapService.getResponseHTMLString();
//Site siteForm = new Site();
//model.addAttribute("siteForm",siteForm);
if(!arrayMarker.isEmpty()) model.addAttribute("arrayMarker",arrayMarker);
else model.addAttribute("arrayMarker",null);
arrayMarker2 = JsonUtilities.writeListToJsonArray(arrayMarker);
if(arrayMarker2 != null) model.addAttribute("arrayMarker2",arrayMarker2);
else model.addAttribute("arrayMarker2","");
if(marker!=null)model.addAttribute("marker",marker);
else model.addAttribute("marker",null);
model.addAttribute("indiceMarker",indiceMarker);
model.addAttribute("urlParam",null);
String html = mapService.getResponseHTMLString();
model.addAttribute("HTML",html);
return "riconciliazione2/mappa/leafletMap";
}
/*#RequestMapping("*")
public String hello(HttpServletRequest request,Model model) {
System.out.println(request.getServletPath());
String MAIN = mapService.homeMain();
model.addAttribute("MAIN",MAIN);
return "main";
}*/
#RequestMapping("/")
public String homeMain(Model model){
return "main";
}
#RequestMapping(value="/main",method= RequestMethod.GET)
public String homeMain2(Model model){
//String MAIN = mapService.homeMain();
//model.addAttribute("MAIN",MAIN);
return "main";
}
//---------------------------------------------------------
// NEW GET METHOD
//---------------------------------------------------------
#RequestMapping(value="/map13",method= RequestMethod.GET)
public String loadMap13(){
Model model = new ExtendedModelMap();
//String html = mapService.getResponseHTMLString();
//Site siteForm = new Site();
//model.addAttribute("siteForm",siteForm);
if(!arrayMarker.isEmpty()) model.addAttribute("arrayMarker",arrayMarker);
else model.addAttribute("arrayMarker",null);
arrayMarker2 = JsonUtilities.writeListToJsonArray(arrayMarker);
if(arrayMarker2 != null) model.addAttribute("arrayMarker2",arrayMarker2);
else model.addAttribute("arrayMarker2",null);
if(marker!=null)model.addAttribute("marker",marker);
else model.addAttribute("marker",null);
model.addAttribute("indiceMarker",indiceMarker);
model.addAttribute("urlParam",null);
//String html = mapService.getResponseHTMLString();
//model.addAttribute("HTML",html);
//model.addAttribute("supportArray",supportArray);
return "riconciliazione2/mappa/leafletMap5";
}
//---------------------------------------------------------
// NEW POST METHOD
//---------------------------------------------------------
#RequestMapping(value="/map3",method = RequestMethod.POST)
public String result4(#RequestParam(required=false, value="urlParam")String url,
#RequestParam(required=false,value="arrayParam")List<String> arrayParam
//#ModelAttribute(value="arrayParam") MarkerList arrayParam
//#ModelAttribute(value="markerParam")Marker markerFromJS
){
if(arrayParam!= null && !arrayParam.isEmpty()){
for(String smarker : arrayParam){
if(StringUtilities.isNullOrEmpty(smarker))continue;
marker = new Marker();
try {
marker = JsonUtilities.fromJson(smarker,Marker.class);
} catch (IOException ioe) {
ioe.printStackTrace();
}
arrayMarker.add(marker);
indiceMarker++;
}
}
if(!StringUtilities.isNullOrEmpty(url)) {
String[] splitter;
if (url.contains(",")) {
splitter = url.split(",");
url = splitter[0];
}
System.out.println("url: " + url);
marker = new Marker();
marker = mapService.createMarkerFromGeoDocument(url);
// = new Marker("City",url,"43.3555664", "11.0290384");
//model.addAttribute("marker",marker); //no need is get from the HTTTP GET COMMAND
arrayMarker.add(marker);
indiceMarker++;
}
return "redirect:/map13";
}
Here the link to my JSP page: JSPPage
I don't know why but the attribute arrayMarker2 is always empty, and that give me nuts.
You can find the full code of the project to this link springMVC12.
Ty in advance for any help.
Ok, i solved by myself but i not sure how.
I just replace all the Model of springframework with the ModelAndView Object.

Resources