TestNG & Maven: How to configure it correctly
fenixx Apr 9, 2009 3:44 PMHi all,
it could be a longer post, but I hope you read it.
I am fighting with this problem for a long time, but I don't know where is the problem.
Therefore I have tried to divide it into several sections:
The Goal
I want to execute a simply test(TestNG) with Maven. The test should be executed in the JBoss Embedded. My application server is Glassfish v2.1 b60.
The structure of my project
My Maven-project is divided into four projects: MyProj-ALL, MyProj-EAR, MyProj-EJB, MyProj-WAR. But MyProj-EJB is the place where my test will be created and executed.
Step1: Executing the test with the SeamGen2.1.2 generated project
I wanted to be ensure, that the test will be running correctly. Because of this reason I created a project with SeamGen2.1.2.
SeamGen2.1.2 helps you so much to get a running project quickly. I created an easy TestNG-test to test the database.
Here is the persistence-test.xml:
<?xml version="1.0" encoding="UTF-8"?> <!-- Persistence deployment descriptor for tests --> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <!-- In-memory HSQLDB --> <persistence-unit name="helloWorldTest" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <non-jta-data-source>java:/DefaultDS</non-jta-data-source> <properties> <property name="hibernate.hbm2ddl.auto" value="create-drop"/> <property name="hibernate.show_sql" value="true"/> <property name="hibernate.cache.use_second_level_cache" value="false"/> <property name="jboss.entity.manager.factory.jndi.name" value="java:/helloworldEntityManagerFactory"/> </properties> </persistence-unit> </persistence>
The test was running correctly.
Unfortunately SeamGen uses Ant, but I need to configure it with Maven. To keep in mind the Ant task, here it is:
<target name="test" depends="buildtest" description="Run the tests"> <condition property="incompatible.jdk"> <and> <equals arg1="${ant.java.version}" arg2="1.6"/> <not><available classname="javax.xml.bind.JAXB"/></not> </and> </condition> <fail if="incompatible.jdk">You are using an incompatible JDK 6. Please use Sun JDK 6 Update 4 (1.6.0_04) or newer or use Open JDK 6.</fail> <taskdef resource="testngtasks" classpath="${testng.jar}"/> <path id="test.path"> <path path="${test.dir}"/> <fileset dir="${lib.dir}/test"> <include name="*.jar"/> </fileset> <path path="${bootstrap.dir}"/> <path refid="build.classpath"/> </path> <testng outputdir="${basedir}/test-report"> <jvmarg line="-Djava.endorsed.dirs=${endorsed.dir}"/> <jvmarg line="-Dsun.lang.ClassLoader.allowArraySyntax=true"/> <classpath refid="test.path"/> <xmlfileset dir="${test.dir}" includes="*Test.xml"/> </testng> </target> <target name="javadoc" depends="compile"> <mkdir dir="${dist.dir}/apidoc"/> <javadoc classpathref="build.classpath" destdir="${dist.dir}/apidoc" use="true" protected="true" version="true" windowtitle="${project.name} API Documentation" doctitle="${project.name} API Documentation" link="http://java.sun.com/j2se/5.0/docs/api"> <packageset dir="${src.action.dir}" defaultexcludes="yes"> <include name="*/**"/> </packageset> <packageset dir="${src.model.dir}" defaultexcludes="yes"> <include name="*/**"/> </packageset> </javadoc> </target>
Everything is running correctly. Lets try it with Maven now.
Step2: Configuration of the MyProjEJB to execute a TestNG-test with Maven
I copied the bootstrap-folder and the persistence-test.xml of the generated SeamGen-project to the MyProjEJB.
Here is the structure of the MyProjEJB:
MyProjEJB ->bootstrap ->conf ->messaging-roles.properties ->messaging-users.properties ->bootstrap-beans.xml ->jbossjts-properties.xml ->jboss-service.xml ->login-config.xml ->data ->hypersonic ->localDB.lck ->localDB.log ->localDB.properties ->localDB.script ->deploy ->messaging ->connection-factories-service.xml ->destinations-service.xml ->hsqldb-persistence-service.xml ->jms-ds.xml ->legacy-service.xml ->messaging-service.xml ->remoting-service.xml ->ejb3-interceptors-aop.xml ->hsqldb-ds.xml ->jboss-local-jdbc.rar ->jboss-xa-jdbc.rar ->jms-ra.rar ->remoting.service.xml ->deployers ->aspect-deployer-beans.xml ->ejb3-deployers-beans.xml ->ejb.deployer-beans.xml ->jboss-aspect-library-beans.xml ->jca-deployers-beans.xml ->security-deployer-beans.xml ->META-INF ->persistence.properties ->tmp ->commons-logging.properties ->jndi.properties ->log4j.xml ->lib (libs of the generated SeamGen-project) ->src ->main ->java(Beans and interfaces inside) ->resources ->META-INF ->ejb-jar.xml ->persistence.xml(for the application) ->test ->java ->MyTest.java ->resources ->META-INF ->persistence.properties ->persistence-test.xml(for the test) ->target ->classes ->surefire-reports ->test-classes ->pom.xml
Content of the surefire of the pom.xml:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.4.3</version> <configuration> <testSourceDirectory>${myproj.home}/myproj-ejb/src/test</testSourceDirectory> <testClassesDirectory>${myproj.home}/myproj-ejb/target/test-classes</testClassesDirectory> <additionalClasspathElements> <!-- Load the bootstrap --> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/conf/bootstrap-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/conf/jbossjta-properties.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/conf/jboss-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/conf/login-config.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/data/hypersonic/localDB.lck</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/data/hypersonic/localDB.log</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/data/hypersonic/localDB.properties</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/data/hypersonic/localDB.script</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/connection-factories-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/destinations-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/hsqldb-persistence-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/jms-ds.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/legacy-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/messaging-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/messaging/remoting-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/ejb3-interceptors-aop.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/hsqldb-ds.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/jboss-local-jdbc.rar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/jboss-xa-jdbc.rar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/jms-ra.rar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deploy/remoting-service.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deployers/aspect-deployer-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deployers/ejb3-deployers-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deployers/jboss-aspect-library-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deployers/jca-deployers-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deployers/metadata-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/deployers/security-deployer-beans.xml</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/META-INF/persistence.properties</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/commons-logging.properties</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/jndi.properties</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/bootstrap/log4j.xml</additionalClasspathElement> <!-- Load the libs --> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jboss-embedded-all.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/hibernate-all.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/thirdparty-all.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jboss-embedded-api.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jboss-seam.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jboss-deployers-client-spi.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jboss-deployers-core-spi.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jboss-el.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/activation.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/el-api.jar</additionalClasspathElement> <additionalClasspathElement>${myproj.home}/myproj-ejb/lib/jsf-api.jar</additionalClasspathElement> </additionalClasspathElements> <skipTests>false</skipTests> <testFailureIgnore>false</testFailureIgnore> <argLine>-Dsun.lang.ClassLoader.allowArraySyntax=true -Djava.endorsed.dirs=${project.build.testOutputDirectory}/endorsed</argLine> </configuration> <executions> <execution> <id>surefire-it</id> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> </execution> </executions> </plugin>
Finally the classpath:
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" output="target/classes" path="src/main/java"/> <classpathentry kind="src" path="bootstrap"/> <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/> <classpathentry kind="src" output="target/test-classes" path="src/test/java"/> <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.6.0_11"/> <classpathentry kind="output" path="target/classes"/> </classpath>
Step3: Executing the test with Maven test
If I execute the test with Maven test I get the following error:
[DEBUG] Test Classpath : [DEBUG] C:\Projects\My_Project\main\Sourcen_maven\myproj-ejb\target\test-classes [DEBUG] C:\Projects\My_Project\main\Sourcen_maven\myproj-ejb\target\classes [DEBUG] c:\Projects\javalibs\MavenRepository\junit\junit\4.0\junit-4.0.jar [DEBUG] c:\Projects\javalibs\MavenRepository\log4j\log4j\1.2.14\log4j-1.2.14.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\seam\embedded\jboss-embedded-all\beta3.SP4\jboss-embedded-all-beta3.SP4.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\seam\embedded\jboss-embedded-api\beta3.SP4\jboss-embedded-api-beta3.SP4.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\microcontainer\jboss-deployers-client-spi\2.0.0.Beta6\jboss-deployers-client-spi-2.0.0.Beta6.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\microcontainer\jboss-deployers-core-spi\2.0.0.Beta6\jboss-deployers-core-spi-2.0.0.Beta6.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\seam\embedded\hibernate-all\beta3.SP4\hibernate-all-beta3.SP4.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\seam\embedded\thirdparty-all\beta3.SP4\thirdparty-all-beta3.SP4.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\apache\axis\axis\1.4\axis-1.4.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\apache\axis\axis-jaxrpc\1.4\axis-jaxrpc-1.4.jar [DEBUG] c:\Projects\javalibs\MavenRepository\javax\ejb\ejb-api\3.0\ejb-api-3.0.jar [DEBUG] c:\Projects\javalibs\MavenRepository\javax\faces\jsf-api\1.2_09-BETA1\jsf-api-1.2_09-BETA1.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\seam\jboss-seam\2.1.1.GA\jboss-seam-2.1.1.GA.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\jboss\el\jboss-el\1.0_02.CR2\jboss-el-1.0_02.CR2.jar [DEBUG] c:\Projects\javalibs\MavenRepository\javax\el\el-api\1.0\el-api-1.0.jar [DEBUG] c:\Projects\javalibs\MavenRepository\org\testng\testng\5.6\testng-5.6.jar [DEBUG] c:\Projects\javalibs\MavenRepository\javax\servlet\servlet-api\2.5\servlet-api-2.5.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/conf/bootstrap-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/conf/jbossjta-properties.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/conf/jboss-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/conf/login-config.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/data/hypersonic/localDB.lck [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/data/hypersonic/localDB.log [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/data/hypersonic/localDB.properties [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/data/hypersonic/localDB.script [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/connection-factories-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/destinations-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/hsqldb-persistence-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/jms-ds.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/legacy-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/messaging-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/messaging/remoting-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/ejb3-interceptors-aop.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/hsqldb-ds.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/jboss-local-jdbc.rar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/jboss-xa-jdbc.rar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/jms-ra.rar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deploy/remoting-service.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deployers/aspect-deployer-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deployers/ejb3-deployers-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deployers/jboss-aspect-library-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deployers/jca-deployers-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deployers/metadata-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/deployers/security-deployer-beans.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/META-INF/persistence.properties [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/commons-logging.properties [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/jndi.properties [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/bootstrap/log4j.xml [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jboss-embedded-all.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/hibernate-all.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/thirdparty-all.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jboss-embedded-api.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jboss-seam.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jboss-deployers-client-spi.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jboss-deployers-core-spi.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jboss-el.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/activation.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/el-api.jar [DEBUG] C:/Projects/My_Project/main/Sourcen_maven/myproj-ejb/lib/jsf-api.jar [DEBUG] Setting system property [user.dir]=[C:\Projects\My_Project\main\Sourcen_maven\myproj-ejb] [DEBUG] Setting system property [localRepository]=[c:/Projects/javalibs/MavenRepository] [DEBUG] Setting system property [basedir]=[C:\Projects\My_Project\main\Sourcen_maven\myproj-ejb] [DEBUG] Using JVM: C:\Programme\Java\jdk1.6.0_11\jre\bin\java [INFO] Surefire report directory: C:\Projects\My_Project\main\Sourcen_maven\myproj-ejb\target\surefire-reports Forking command line: cmd.exe /X /C "C:\Programme\Java\jdk1.6.0_11\jre\bin\java -Dsun.lang.ClassLoader.allowArraySyntax=true -Djava.endorsed.dirs=C:\Projects\My_Project\main\Sourcen_maven\myproj-ejb\target\test-classes/endorsed -jar C:\DOKUME~1\myproj\LOKALE~1\Temp\surefirebooter7578639955679396343.jar C:\DOKUME~1\myproj\LOKALE~1\Temp\surefire7457818046451040985tmp C:\DOKUME~1\myproj\LOKALE~1\Temp\surefire4258852975319354709tmp" ------------------------------------------------------- T E S T S ------------------------------------------------------- Running TestSuite [Parser] Running: Command line suite Tests run: 8, Failures: 1, Errors: 0, Skipped: 7, Time elapsed: 17.906 sec <<< FAILURE! Results : Failed tests: startSeam(MyTest)
Here are the details:
CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} jboss.j2ee:jar=classes,name=AddressBookService,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } jboss.j2ee:jar=classes,name=KeyTabAllocationBean,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } jboss.j2ee:jar=classes,name=KeyTabService,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } jboss.j2ee:jar=classes,name=PersonAnlegenBean,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } jboss.j2ee:jar=classes,name=ReleaseManagementService,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } persistence.units:jar=classes.jar,unitName=MYPROJ -> <UNKNOWN>{Described: UNRESOLVED Demands 'jboss.jca:name=jdbc/MYPROJ,service=DataSourceBinding } CONTEXTS IN ERROR: Name -> Error <UNKNOWN> -> UNRESOLVED Demands 'jboss.jca:name=jdbc/myproj,service=DataSourceBinding ]]> </message> <full-stacktrace> <![CDATA[org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS): CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State} jboss.j2ee:jar=classes,name=BeanA,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } jboss.j2ee:jar=classes,name=BeanB,service=EJB3 -> <UNKNOWN>{Described: UNRESOLVED Demands 'persistence.units:jar=classes.jar,unitName=MYPROJ } persistence.units:jar=classes.jar,unitName=MYPROJ -> <UNKNOWN>{Described: UNRESOLVED Demands 'jboss.jca:name=jdbc/myproj,service=DataSourceBinding } CONTEXTS IN ERROR: Name -> Error <UNKNOWN> -> UNRESOLVED Demands 'jboss.jca:name=jdbc/myproj,service=DataSourceBinding
The problem
As you see: There is a problem with the persistence.xml of the project (not of the test).
MyTest.java is a very easy test and don't need the persistence.xml of the project:
public class ReleaseDBTest extends SeamTest { @Test public void sayHello() throws Exception { System.out.println("Hello"); assert true; } @Test public EntityManager createEntityManager() throws Exception { EntityManagerFactory emf = Persistence .createEntityManagerFactory("helloWorldTest"); EntityManager em = emf.createEntityManager(); assert em.isOpen(); return em; } }
In my opinion the configuration of the surefire-plugin is not correct.
Thanks for reading.
I hope you can give me a hint how to solve this problem.
Regards