Arquillian with NetBeans, WebLogic 12c, JPA and a MySQL Datasource
Join the DZone community and get the full member experience.
Join For FreeYou probably followed my posts about testing more complex scenarios with embedded GlassFish (Part I / Part II). Next on my list of things to do was to get this setup working with latest WebLogic 12c.
Getting Started
Modifying the sampleweb Project
Now open the sampleweb project's pom.xml and remove the glassfish-embedded-all dependency together with the arquillian-glassfish-embedded-3.1 and the javaee-api. Now add the wls-remote-12.1 container and the jboss-javaee-6.0 dependencies:
Now open your arquillian.xml descriptor and change the container settings to use the wls container:
Make sure to use the right target server and point to the correct wlsHome. Right-click the AuditRepositoryServiceTest in NetBeans and run "Test File". You will see the remote container doing some work:
22.01.2012 22:40:34 org.jboss.arquillian.container.wls.WebLogicDeployerClient deploy INFO: Starting weblogic.Deployer to deploy the test artifact. 22.01.2012 22:40:46 org.jboss.arquillian.container.wls.WebLogicDeployerClient forkWebLogicDeployer INFO: weblogic.Deployer appears to have terminated successfully. 22.01.2012 22:40:53 org.jboss.arquillian.container.wls.WebLogicDeployerClient undeploy INFO: Starting weblogic.Deployer to undeploy the test artifact. 22.01.2012 22:41:00 org.jboss.arquillian.container.wls.WebLogicDeployerClient forkWebLogicDeployer INFO: weblogic.Deployer appears to have terminated successfully.
And the test going green! If you look at the domain log, you can see, that the test.war module is successfully deployed and undeployed.
Remarks and Thoughts
Looking at what we have with WebLogic 12c (especially the new maven plugin) this all seems very hand-crafted. What would a WebLogic developer have done prior to that in a maven based project? He would have pushed the weblogic.jar to his local repository and use it instead of using any jboss-javaee-6.0 or javaee-api dependencies. If you try this with the Arquillian wls container you start seeing some weird exceptions like the following:
Loading class: javax.transaction.SystemException Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/transaction/SystemExceptionThis is basically because only the wlfullclient.jar contains all needed classes for remote management via JMX. The magic weblogic.jar does have some additional class-path entries in it's manifest which could not be resolved if you put it to your local m2 repository. So you simply have two options left. Use the wlfullclient.jar (see how to build it in the docs) for testing and the weblogic.jar for your development or stick to the jboss-javaee-6.0 dependency for development and testing (scope provided). Both are valid alternatives. As you can see, the WebLogic container is still undocumented in the Arquillian documentation. You can find a more detailed documentation looking at the wls-container project on github.
Download the simpleweb-wls.zip project as a reference to get you started.
Thanks to Vineet and Aslak for the help!
From http://blog.eisele.net/2012/01/arquillian-with-netbeans-weblogic-12c.html
Opinions expressed by DZone contributors are their own.
Comments