Arquillian persistence tutorial with Weblogic and H2
heidarzadeh Nov 10, 2012 2:52 AMHi
I checked out Aqruillain persistence tutorial and run it using glassfish embeded and with both derby and h2, it works.
But because I need to test my code with weblogic (and h2) too, I tried running the example in weblogic too.
I added following profile to my pom.xml:
<profile> <id>arquillian-weblogic</id> <activation> <activeByDefault>true</activeByDefault> </activation> <dependencies> <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.spec</groupId> <artifactId>jboss-javaee-6.0</artifactId> <version>1.0.0.Final</version> <type>pom</type> <scope>provided</scope> </dependency> <dependency> <groupId>com.h2database</groupId> <artifactId>h2</artifactId> <version>1.3.166</version> <scope>test</scope> </dependency> </dependencies> <build> <testResources> <testResource> <directory>src/test/resources</directory> </testResource> <testResource> <directory>src/test/resources-weblogic</directory> </testResource> </testResources> </build> </profile>
Then added following lines to arquillian.xml
<engine> <property name="deploymentExportPath">target/arquillian</property> </engine> <container qualifier="wls" default="true"> <configuration> <property name="adminUrl">t3://localhost:7001</property> <property name="adminUserName">weblogic</property> <property name="adminPassword">12345678</property> <property name="target">AdminServer</property> <property name="wlsHome">/opt/weblogic_server11/wlserver</property> </configuration> </container>
then i added persistence file to /resources-weblogic/test-persistence.xml
<persistence-unit name="test" transaction-type="JTA"> <properties> <property name="javax.persistence.jdbc.driver" value="org.h2.jdbcx.JdbcDataSource"/> <property name="javax.persistence.jdbc.url" value="jdbc:h2:file:target/databases/h2/db"/> <property name="javax.persistence.jdbc.user" value="sa"/> <property name="javax.persistence.jdbc.password" value=""/> <property name="eclipselink.ddl-generation" value="drop-and-create-tables"/> <property name="eclipselink.logging.level.sql" value="FINE"/> <property name="eclipselink.logging.parameters" value="true"/> </properties> </persistence-unit>
After running the test I got following error :
Exception Description: PersistenceUnitInfo test has transactionType JTA, but does not have a jtaDataSource defined.
Then I changed transaction-type="JTA" to transaction-type="RESOURCE_LOCAL" and tested again and got following error:
Exception Description: Configuration error. Class [org.h2.jdbcx.JdbcDataSource] not found.
After that I checked "target/arquillian" path to see that what arquillian has generated and saw that it has not packaged h2 jar file in generated war file! shouldn't arquillian package h2 in my war file?
Then I copied h2 jar file in lib directory of my weblogic domain and wanted to start weblogic and test it, but weblogic did not start and I got some OSGi related errors!
Can anyone help me with this error?
Or, can you add a profile for weblogic and h2 in example of, arquillian persistence tutorial?