I have a project in which I have used Juint5 for creating tests and test suites. I want to run the test suite via the pom file. Below is the pom file and test suit which I have created. when I run the mvn clean
it does not execute any tests but when I manually run the test suite run as JUnit test all the test cases are executed
can someone please help me here?
Suite file
#RunWith(JUnitPlatform.class)
#SelectClasses( {TestA.class,TestB.class} )
#IncludeTags("unitTest")
public class Testsuite
{
}
classes
public class TestA
{
#Test
#Tag("unitTest")
static void myMethod1()
{
System.out.println("Hello World!");
}
}
public class TestB
{
#Test
#Tag("unitTest")
static void myMethod2()
{
System.out.println("Hello World!");
}
}
pom file entry
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<includes>
<include>**/Testsuite*</include>
</includes>
</configuration>
</plugin>
full 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.junit.karte.emo</groupId>
<artifactId>cg-automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<!-- <packaging>jar</packaging> -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<cucumber.reporting.version>5.3.1</cucumber.reporting.version>
<karate.version>0.9.6</karate.version>
<junit.runner.version>1.0.18</junit.runner.version>
<commons.lang3.version>3.11</commons.lang3.version>
<jsch.version>0.1.55</jsch.version>
<junit.jupiter.engine.version>5.6.2</junit.jupiter.engine.version>
<junit-jupiter-api.version>5.8.0-M1</junit-jupiter-api.version>
<junit.platform.runner>1.6.2</junit.platform.runner>
<cg_password>n</cg_password>
<host_ip>10.204.100.136</host_ip>
<host_usrname>root</host_usrname>
<host_password>n</host_password>
<build_name>change_guardian-6.2</build_name>
<custom_path>/usr</custom_path>
<cg_version>8.5.0.0.13</cg_version>
<web_port>8443</web_port>
<win_host>vlab007206</win_host>
<win_ip>10.204.108.65</win_ip>
<win_user>administrator#cgdom100.lab</win_user>
<win_password>Control4321</win_password>
<asset_type>win</asset_type>
<unix_host>vlab007201</unix_host>
<unix_ip>10.204.100.136</unix_ip>
<unix_user>root</unix_user>
<unix_password>n</unix_password>
<base_build>change_guardian-6.1</base_build>
<basecg_version>8.3</basecg_version>
<maven.compiler.version>3.8.1</maven.compiler.version>
<maven.surefire.version>2.22.2</maven.surefire.version>
<maven.site.version>3.7.1</maven.site.version>
<maven.surefire.report.version>3.0.0.M5</maven.surefire.report.version>
<maven.project.info.reports.version>3.0.0</maven.project.info.reports.version>
<runSuite>StanderdPathInstall.java</runSuite>
<groups>StanderdPathInstall</groups>
</properties>
<repositories>
<repository>
<id>sm.releases</id>
<name>NetIQ Security Management site - RELEASES</name>
<url>https://btpartifactory.swinfra.net:443/artifactory/security-sentinel-mvn-releases/</url>
<releases>
<enabled>true</enabled>
<updatePolicy>${repository-updatePolicy}</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>${repository-updatePolicy}</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
<repository>
<id>sm.snapshots</id>
<name>NetIQ Security Management site - SNAPSHOTS</name>
<url>https://btpartifactory.swinfra.net:443/artifactory/security-sentinel-mvn-snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>${repository-updatePolicy}</updatePolicy>
</snapshots>
</repository>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2/</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>apache.central</id>
<name>Apache Maven Central Repository</name>
<url>https://repository.apache.org/content/repositories/releases/</url>
</repository>
<repository>
<id>maven2-repository.dev.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven2-maven-org</id>
<url>https://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.8.0-M1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-apache</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.intuit.karate</groupId>
<artifactId>karate-junit5</artifactId>
<version>${karate.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.pantsbuild</groupId>
<artifactId>junit-runner</artifactId>
<version>${junit.runner.version}</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons.lang3.version}</version>
</dependency>
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>${jsch.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${junit.jupiter.engine.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${junit-jupiter-api.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>${junit.platform.runner}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<testResources>
<testResource>
<directory>src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven.compiler.version}</version>
<configuration>
<encoding>UTF-8</encoding>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerArgument>-Werror</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
<configuration>
<includes>
<include>StanderdPathInstall.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${maven.site.version}</version>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/test/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven.surefire.report.version}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${maven.project.info.reports.version}</version>
</plugin>
</plugins>
</reporting>
</project>
My solution is
Add #Tag annotation before each test which I want to run
Add tag under the maven-surefire-plugin, e.g integration
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<groups>integration</groups>
</configuration>
</plugin>
Run maven command: mvn test -Dgroups="integration"
I'm trying to build my project with Maven and libraries keep being dropped at /target. I was able to select a new output directory for my project's jar with the outputDirectory tag.
How I can select the directory for the needed jar files to run my program? I can specify which of them to save?
Edit(pom file):
<?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>CarlosRoma</groupId>
<artifactId>TestTools</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--Main class of the project here-->
<mainClass>TestToolClasses.TestTool</mainClass>
</manifest>
</archive>
<outputDirectory>C:\Users\Roma\Desktop\TestTool</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy</id>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>
${project.build.directory}
</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
</build>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<updatePolicy>never</updatePolicy>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<name>TestTool</name>
</project>
Thanks in advance!
I am creating a web app and at the moment I'm trying to get a tomcat server to run. However I get this error message when ran from the cmd line.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tomcat/uti
l/http/mapper/Mapper
at org.apache.catalina.core.StandardContext.<init>(StandardContext.java:457)
at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:532)
at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:526)
at org.apache.catalina.startup.Tomcat.addWebapp(Tomcat.java:207)
at hello.Server.createTomcatServer(Server.java:34)
at hello.Application.main(Application.java:57)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.http.mapper.
Mapper
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 6 more
This 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>org.springframework</groupId>
<artifactId>gs-relational-data-access</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.0.0.RC4</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>7.0.52</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
</dependencies>
<properties>
<start-class>hello.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.2</version>
<configuration>
<!-- put your configurations here -->
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>http://repo.spring.io/libs-snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
And finally my tomcat server code:
public void createTomcatServer() throws ServletException, LifecycleException{
Tomcat tomcat = null;
Integer webPort = new Integer(9696);
tomcat.setPort(webPort);
tomcat.addWebapp("/", new File(webappDirLocation).getAbsolutePath());
System.out.println("configuring app with basedir: " + new File("./" + webappDirLocation).getAbsolutePath());
tomcat.start();
tomcat.getServer().await();
}
I thought I had included all the correct dependencies, etc. But I just cant find out why its not working - I've looked all over google already - so any help would be greatly appreciated.
I encountered the same problem as well and solved it by depending on the embed module instead.
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-core</artifactId>
<version>${embedded.tomcat.version}</version>
</dependency>
I am using jboss6, message driven bean, hibernate and maven2 in my application when i try to compile my mdb using maven2 and deploy on jboss6 i get the following error:
Failed to create Resource MessageBean.jar - cause: java.lang.Exception:Failed to start deployment [vfs:///opt/jboss6/server/default/deploy/MessageBean.jar] during deployment of 'MessageBean.jar' - cause: java.lang.RuntimeException:org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.j2ee:jar=MessageBean.jar,name=MessageBean,service=EJB3" is missing the following dependencies: Dependency "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" (should be in state "Installed", but is actually in state "Instantiated") DEPLOYMENTS IN ERROR: Deployment "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" is in error due to the following reason(s): Instantiated -> org.jboss.deployers.client.spi.IncompleteDeploymentException:Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): DEPLOYMENTS MISSING DEPENDENCIES: Deployment "jboss.j2ee:jar=MessageBean.jar,name=MessageBean,service=EJB3" is missing the following dependencies: Dependency "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" (should be in state "Installed", but is actually in state "Instantiated") DEPLOYMENTS IN ERROR: Deployment "interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory" is in error due to the following reason(s): Instantiated
Here is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>MessageBean</artifactId>
<packaging>ejb</packaging>
<version>1.0-SNAPSHOT</version>
<name>MessageBean Java EE 6 EJB</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-timerservice-spi</artifactId>
<version>1.0.4</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate</artifactId>
<version>3.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-ext-api</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>
<version>1.5.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<!--
<artifactId>javaee-web-api</artifactId>
-->
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<!-- Added below -->
<type>jar</type>
<!-- modified by varsha -->
<scope>provided</scope>
<!-- end -->
</dependency>
<!-- <dependency>
<groupId>org.jboss.ejb3</groupId>
<artifactId>jboss-ejb3-ext-api-impl</artifactId>
<version>1.1.1</version>
</dependency>-->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>java.net2</id>
<name>Java.Net Maven2 Repository, hosts the javaee-api dependency</name>
<url>http://download.java.net/maven/2</url>
</repository>
<repository>
<id>jboss-public-repository-group</id>
<name>JBoss Public Maven Repository Group</name>
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
<layout>default</layout>
<releases>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>never</updatePolicy>
</snapshots>
</repository>
<repository>
<id>jboss</id>
<url>http://repository.jboss.com/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>jboss-snapshot</id>
<url>http://snapshots.jboss.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.1</version>
<configuration>
<ejbVersion>3.1</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0</version>
</plugin>
<!-- <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jboss-maven-plugin</artifactId>
<version>1.5.0</version>
<configuration>
<jbossHome>/opt/jboss6/server/default/deploy</jbossHome>
<jbossHome>/home/varsha/Downloads/jboss-6.0.0.Final/</jbossHome>
<serverName>default</serverName>
<fileName>target/MessageBean.jar</fileName>
<path>/UltimateSMS</path>
</configuration>
</plugin>-->
</plugins>
<finalName>MessageBean</finalName>
</build>
<profiles>
<profile>
<id>endorsed</id>
<activation>
<property>
<name>sun.boot.class.path</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0.2</version>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-endorsed-api</artifactId>
<version>6.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
I am not using ejb3 timer in my application as of now
What seems to be the problem ?
please help :(
the dendency "jboss-ejb3-timerservice-spi" is most likely your problem. not sure why you need to depend on that, but you certainly shouldn't be including it in your deployment. if you do need it as a dependency for some reason, it should be marked as scope "provided". all of those jboss dependencies and any other of those jars which are in the jboss lib directory should be marked as scope "provided". generally, your app should not contain any jars which are part of the jboss server.
Looks like at the time of your .jar deployment something has already instantiated the TimerServiceFactory.
Check your dependencies, I once had a similar problem where one of the jars I had as a maven dependency actually had a jboss.xml in its META-INF folder and was binding a bean I was using to a JNDI name I was already using.
Its a pain to search your dependencies, but this looks like its conflicting with something.
Its possible that one of your dependencies depends on an older version of interface org.jboss.ejb3.timerservice.spi.TimerServiceFactory and it gets instantiated before yours.
Check your .m2 folder and see if you have 2 versions of jboss-ejb3-timerservice-spi downloaded.
i am struggling with CXF and pom files.
I want to add a dependency to the axis2 to it, so I added this to my pom.
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.2</version>
</dependency>
It downloads the dependency correctly and everything seems to work. When I deploy, I get this message:
The bundle could not be resolved. Reason: Missing Constraint: Import-Package: org.apache.axis2.databinding; version="0.0.0"
So I changed my plugin tag to add the org.apache.axis2.databinding reference:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-Activator>de.innoshgs.iai.services.pruefentxschema_uas_01.Activator</Bundle-Activator>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Import-Package>
javax.jws,
javax.wsdl,
javax.xml.bind,
javax.xml.bind.annotation,
javax.xml.namespace,
javax.xml.soap,
javax.xml.transform,
javax.xml.ws,
javax.xml.ws.handler,
javax.xml.ws.handler.soap,
META-INF.cxf,
META-INF.cxf.osgi,
org.apache.cxf.bus,
org.apache.cxf.bus.spring,
org.apache.cxf.bus.resource,
org.apache.cxf.configuration.spring,
org.apache.cxf.feature,
org.apache.cxf.resource,
org.apache.cxf.transport.http_osgi,
org.apache.cxf.interceptor,
org.apache.servicemix.util,
org.springframework.beans.factory.config,
org.apache.camel.osgi,
org.apache.axis2.databinding,
sun.misc;resolution:=optional,
!de.innoshgs.iai.services.pruefentxschema_uas_01,
!de.innoshgs.iai.namespace,
*
</Import-Package>
<Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
<Private-Package>
de.innoshgs.iai.services.pruefentxschema_uas_01,
de.innoshgs.iai.namespace,
</Private-Package>
</instructions>
</configuration>
</plugin>
But I keep getting the same error.
I am not a java dev, I am starting with it,so I am a lost with it. I have been searching and I could get som e hints until I got to this point, but now I seem to get stuck.
What do I have to do, so maven is able to find this databinding reference?
The whole pom file is here:
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.servicemix.examples</groupId>
<artifactId>examples</artifactId>
<version>4.2.0-fuse-01-00</version>
</parent>
<groupId>de.innoshgs.iai.Services</groupId>
<artifactId>PruefenTXSchema_UAS_01</artifactId>
<packaging>bundle</packaging>
<version>4.2.0-fuse-01-00</version>
<name>PruefenTXSchema_UAS_01</name>
<!-- Add fusesource repositories for snaphots and releases -->
<pluginRepositories>
<pluginRepository>
<id>fusesource.m2-snapshot</id>
<name>FuseSource Snapshots Repository</name>
<url>http://repo.fusesource.com/maven2-snapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>fusesource.m2</id>
<name>FuseSource Repository</name>
<url>http://repo.fusesource.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>fusesource.m2-snapshot</id>
<name>FuseSource Snapshots Repository</name>
<url>http://repo.fusesource.com/maven2-snapshot/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>fusesource.m2</id>
<name>FuseSource Repository</name>
<url>http://repo.fusesource.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons.logging.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-spring</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-ftp</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.geronimo.specs</groupId>
<artifactId>geronimo-ws-metadata_2.0_spec</artifactId>
<version>${geronimo.wsmetadata.version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix</groupId>
<artifactId>servicemix-utils</artifactId>
<version>${servicemix-utils.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-all</artifactId>
<version>5.3.1-fuse-02-00</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel.version}</version>
</dependency>
<dependency>
<groupId>org.apache.servicemix.kernel</groupId>
<artifactId>org.apache.servicemix.kernel.main</artifactId>
<version>1.1.0.1-fuse</version>
</dependency>
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2</artifactId>
<version>1.5.2</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/src/main/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/PruefenTXSchema_UAS_01Service.wsdl</wsdl>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<configuration>
<instructions>
<Bundle-Activator>de.innoshgs.iai.services.pruefentxschema_uas_01.Activator</Bundle-Activator>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Import-Package>
javax.jws,
javax.wsdl,
javax.xml.bind,
javax.xml.bind.annotation,
javax.xml.namespace,
javax.xml.soap,
javax.xml.transform,
javax.xml.ws,
javax.xml.ws.handler,
javax.xml.ws.handler.soap,
META-INF.cxf,
META-INF.cxf.osgi,
org.apache.axis2.databinding,
org.apache.cxf.bus,
org.apache.cxf.bus.spring,
org.apache.cxf.bus.resource,
org.apache.cxf.configuration.spring,
org.apache.cxf.feature,
org.apache.cxf.resource,
org.apache.cxf.transport.http_osgi,
org.apache.cxf.interceptor,
org.apache.servicemix.util,
org.springframework.beans.factory.config,
org.apache.camel.osgi,
sun.misc;resolution:=optional,
!de.innoshgs.iai.services.pruefentxschema_uas_01,
!de.innoshgs.iai.namespace,
*
</Import-Package>
<Require-Bundle>org.apache.cxf.bundle</Require-Bundle>
<Private-Package>
de.innoshgs.iai.services.pruefentxschema_uas_01,
de.innoshgs.iai.namespace,
</Private-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
Thanks a lot,
Oscar
Edit: just to make it clear: the server and the computer I am using to develop are different machines.
Can you try adding axis2-adb dependency and see if the error persists?
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-adb</artifactId>
<version>1.5.2</version>
</dependency>
The issue seems to be that the dependency you want to add to your project does not exist in the server. You need your JAR to provide the dependency on the server. Try adding:
<Embed-Dependency>axis2</Embed-Dependency>
after the Import-Package element of your maven bundle plugin configuration. This will embed the axis2 jar into your compiled jar, expose it and allow it to be called within the server. Further reading about the embed dependency can be found at Apache Felix - Embedding Dependencies although I will admit it is not all that helpful to know when/why to use it.