I have a Maven web project in which I must run some Selenium UI tests (with JUnit). However, when I build the project (goals: “clean install”) the Selenium tests don’t work because the Tomcat server hasn’t started yet.
I have added a plugin snippet that I found online (the tomcat7-maven-plugin) but it doesn’t seem to do anything.
It might be important to know that my Selenium tests use a Firefox driver with a different binary from my default Firefox install (an older version of Firefox portable to work with the older version of Selenium).
This is my POM.XML file:
<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>org.web3</groupId>
<artifactId>WebShopWeb3</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>tomcat-run</id>
<goals>
<goal>run-war-only</goal>
</goals>
<phase>pre-integration-test</phase>
<configuration>
<port>8080</port>
<fork>true</fork>
</configuration>
</execution>
<execution>
<id>tomcat-shutdown</id>
<goals>
<goal>shutdown</goal>
</goals>
<phase>post-integration-test</phase>
</execution>
</executions>
</plugin>
</plugins>
<finalName>WebShopWeb3</finalName>
</build>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-web-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1211.jre7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.53.0</version>
</dependency>
</dependencies>
</project>
My project (the tests are highlighted):
Does anybody know the lines I need to add to my POM.XML or other things I need to do?
Thanks
I have a simple app with selenium. Here is the 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.foo</groupId>
<artifactId>foo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>Foo App</name>
<description>Test Scenario For Foo</description>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.45.0</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
Related
I'm using a GitLab CI/CD Pipeline that uses the spotbugs plugin for Maven; when I try to run
mvn compile spotbugs:check
I get the following error:
[INFO] Fork Value is true
[java] The following classes needed for analysis were missing:
[java] org.junit.jupiter.api.Assertions
The previous command works on my local machine, but fails on the GitLab runner. I suppose this may be a configuration problem (ie: something wrong on my pom.xml file) but I am not quite sure how to fix it.
Here is pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.7.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>accessing-data-mysql</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>accessing-data-mysql</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- junit 5, unit test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>4.3.2.RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jayway.jsonpath</groupId>
<artifactId>json-path</artifactId>
<version>2.2.0</version>
<scope>test</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-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- Maven checkstyle plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<configLocation>google_checks.xml</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<linkXRef>false</linkXRef>
</configuration>
</plugin>
<!-- Maven spotbugs plugin -->
<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
<version>3.1.12.2</version>
</plugin>
<!-- Maven PMD plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.12.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-integration-test-source</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/integration-test/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-integration-test-resource</id>
<phase>generate-test-resources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>src/integration-test/resources</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<!-- target/docker-spring-boot.jar -->
<finalName>docker-spring-boot</finalName>
</build>
</project>
Thanks for all your help.
I am new to using Maven, so i might be missing something. I keep getting the below error, every time i run "maven install" or "maven test". I have already tried adding the sure-fire plugin to my pom.xml file. Which i have added below. What else could be causing the problem?
Here is the error that keeps popping up in my console every time i run the command
Here is the pom.xml for my project, where i have added the sure-fire plugin:
<?xml version="1.0" encoding="UTF-8"?>
<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.company.Project</groupId>
<artifactId>myprofile</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>myprofile</name>
<description>Service to retrieve my profile</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<vertx.version>3.6.0</vertx.version>
<junit-jupiter.version>5.1.0</junit-jupiter.version>
<assertj-core.version>3.8.0</assertj-core.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-dependencies</artifactId>
<version>${vertx.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web-client</artifactId>
<version>${vertx.version}</version>
</dependency>
<dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-junit5</artifactId>
<version>${vertx.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit-jupiter.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj-core.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.3</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>io.vertx.core.Launcher</Main-Class>
<Main-Verticle>com.company.Project.myProfileVerticle</Main-Verticle>
</manifestEntries>
</transformer>
</transformers>
<artifactSet/>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- Deploy to Nexus -->
<distributionManagement>
<repository>
<id>Projectreleases</id>
<url>http://artifactory.company.local/artifactory/ProjectReleases/</url>
</repository>
<snapshotRepository>
<id>Projectsnapshots</id>
<url>http://artifactory.company.local/artifactory/ProjectSnapshots/</url>
</snapshotRepository>
</distributionManagement>
</project>
The problem is because dependency junit-jupiter-engine inside build plugin is different from dependency declared on dependencies (5.0.3 versus 5.1.0).
I get this error when trying to build GWT project with maven:
Your project declares dependency on gwt-user 2.6.0. This plugin is
designed for at least gwt version 2.7.0
As I found out gwt-user 2.6.0 is downloaded with com.google.gwt.eventbinder.
How I can force com.google.gwt.eventbinder using gwt-user 2.7.0 instead 2.6.0?
The strange thing is that the build worked before I did 'git pull'.
Here is my pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<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.prognoz.ra.okhs</groupId>
<artifactId>gwtclient</artifactId>
<version>0.3.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<gwt.version>2.7.0</gwt.version>
<maven.version>3.0.5</maven.version>
<jdk.version>1.7</jdk.version>
<version.org.codehaus.mojo.gwt.maven.plugin>2.7.0</version.org.codehaus.mojo.gwt.maven.plugin>
<webappDirectory>war</webappDirectory>
<maven.build.timestamp.format>yyyy-MM-dd HH:mm</maven.build.timestamp.format>
<skipTests>true</skipTests>
</properties>
<prerequisites>
<maven>${maven.version}</maven>
</prerequisites>
<dependencies>
<dependency>
<groupId>org.moxieapps.gwt</groupId>
<artifactId>highcharts</artifactId>
<version>1.7.0</version>
<scope>system</scope>
<systemPath>${basedir}/src/main/webapp/WEB-INF/lib/highcharts-1.7.0.jar</systemPath>
</dependency>
<dependency>
<groupId>com.prognoz.ra.dbutil</groupId>
<artifactId>dbutil</artifactId>
<scope>system</scope>
<version>1.0.1-SNAPSHOT</version>
<systemPath>${basedir}/out/artifacts/dbutil_jar/dbutil.jar</systemPath>
</dependency>
<dependency>
<groupId>com.liferay.org.apache.commons.fileupload</groupId>
<artifactId>com.liferay.org.apache.commons.fileupload</artifactId>
<version>6.2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<version>${gwt.version}</version>
<artifactId>gwt-servlet</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava-gwt</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>com.google.gwt.eventbinder</groupId>
<artifactId>eventbinder</artifactId>
<version>1.1.0</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${version.org.codehaus.mojo.gwt.maven.plugin}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
<configuration>
<compileReport>true</compileReport>
<logLevel>INFO</logLevel>
<copyWebapp>true</copyWebapp>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<executions>
<execution>
<id>deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<server>Tomcat8_local</server>
<path>/ra-okhs</path>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>m2e</id>
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Solution 1
The problem is eventbinder has dependency on gwt-user artifact. it uses 2.6.0 by default you can see it by using this command.
mvn dependency:tree
If you add this dependency block to your pom;
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>2.7.0</version>
</dependency>
It will look like this...
This means your project will have gwt-user 2.7.0 all the time, i haven't tested if everything is ok with version compatibility or something your problem will be solved..
Solution 2
Thanks for the #Thomas Broyer's comment we can force eventbinder to use 2.7.0 gwt-user or any gwt dependency. if we just add this dependency management to our pom
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>2.7.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
The result :
I have a small example project for mongodb and can't get the annotation processor to work. I am using the examples from:
http://www.querydsl.com/static/querydsl/latest/reference/html/ch02s07.html
Running mvn clean install produces:
Annotation processor 'com.querydsl.mongodb.morphia.MorphiaAnnotationProcessor' not found
I have been all over the place looking for that processor. Just can't find it. Here is the pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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.stevesando</groupId>
<artifactId>FindAll</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<version>1.2.1.RELEASE</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-mongodb</artifactId>
<version>3.6.0</version>
</dependency>
<dependency>
<groupId>com.mysema.querydsl</groupId>
<artifactId>querydsl-apt</artifactId>
<version>3.6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>com.mysema.maven</groupId>
<artifactId>apt-maven-plugin</artifactId>
<version>1.1.3</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
<configuration>
<outputDirectory>target/generated-sources/java</outputDirectory>
<processor>com.querydsl.mongodb.morphia.MorphiaAnnotationProcessor</processor>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
Using Spring Data, you should use org.springframework.data.mongodb.repository.support.MongoAnnotationProcessor
Spring Data Mongo provides a custom APT processor to generate the
Metamodels instead of the one provided in QueryDSL, it will scan the
Spring specific #Document instead of the Morphia specific annotations.
The correct classname is com.mysema.query.apt.morphia.MorphiaAnnotationProcessor
I have EAR application written with EJB 3.1, where I'm using JPA 2.0.
Persistance unit is configured to use JTA
<persistence-unit name="JPACommonParameters" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
I've created simple deployment, where in EJB I inject Entity manager just like this
#PersistenceContext(unitName = "JPACommonParameters")
protected EntityManager em;
Using this jpa I called simple query using createNamedQuery.
Application is deployed on WLS 12.1.1.0, managed server.
After first deployment it is working. Everything is fine.
After updating the same application without any change I've receiving ClastCastException as object returned from query is not the same as in application.
result = (ParamDef) em.createNamedQuery("ParamDef.findActiveParamDef").
getSingleResult();
After long investigation I've found, that problem is with classloader. Object returned from entity manager is loaded by different classloader(Classloader used during first deployment) than object ParamDef in bracket I'm casting.
Everything is working fine when I will restart manged wls server.
My question is: How to configure application of wls to initialize entityManger every redeploy of application on server to get it working without restart.
Here is my pom file
<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">
<parent>
<artifactId>ofs-direct-services</artifactId>
<groupId>com.oproc.first.app</groupId>
<version>1.1</version>
</parent>
<artifactId>IT-app</artifactId>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<name>IT-app Integ. Tests for app</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<cxf.version>2.2.3</cxf.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.1.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
<version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wls-remote-12.1</artifactId>
<version>1.0.0.Alpha2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jboss.weld</groupId>
<artifactId>weld-core</artifactId>
<version>1.1.5.Final</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.oproc.first.app</groupId>
<artifactId>customer-app-services</artifactId>
<version>1.1</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>com.oproc.first.common.parameters</groupId>
<artifactId>common-parameters-services</artifactId>
<version>1.0</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>com.oproc.first.common.parameters</groupId>
<artifactId>common-parameters-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.oproc.first.common.parameters</groupId>
<artifactId>common-parameters-db</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.oproc.first.common.parameters</groupId>
<artifactId>common-parameters-services</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>com.oproc.first</groupId>
<artifactId>ejb-tuxedo-connector-ejb</artifactId>
<version>1.0</version>
<type>ejb</type>
</dependency>
<dependency>
<groupId>com.oproc.first</groupId>
<artifactId>ejb-tuxedo-connector-client</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>com.oproc.first</groupId>
<artifactId>db4b-db</artifactId>
<version>1.0</version>
<type>jar</type>
</dependency>
</dependencies>
<profiles>
<profile>
<id>no_integration_testing</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<id>default-test</id>
<configuration>
<excludes>
<exclude>**/*Test.java</exclude>
</excludes>
<skipTests>true</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>integration_testing</id>
<build>
<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>
<compilerArguments>
<endorseddirs>${project.build.directory}/endorsed</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skipTests>false</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>