Monthly Archives: September 2012

Quick Note: OpenEJB embedded Arquillian adapter and code coverage

To get code coverage with Arquillian we often use jacoco because:

  • there is an arquillian extension 🙂
  • cobertura, emma…doesn’t work

This is generally true but if you try to use jacoco with OpenEJB embedded Arquillian adapter (this note applies to OpenWebBeans adapter too) it will fail. Why? Simply because this adapter is not a standard one for Arquillian since it is embedded, the JVM is shared between the client and the server…You can remove the jacoco extension and use the jacoco maven plugin/javaagent…but there is easier.

Yes that’s embedded so you can use what you want: cobertura (or Emma) works!

Note on using cobertura in an EJB container: cobertura instruments classes adding an interface. It means if you have a @Local EJB it will magically implement two interfaces (your business one and the Cobertura one). From a spec point of view the deployment will fail. The workaround is to specify as @Local parameter the business interface the bean implements: @Local(MyBusiness.class). In the same idea, @LocalBean becomes mandatory with cobertura (it is not otherwise).

Ping remote hosts from TomEE JMX console

When you write a JEE application it is common to need to interact with remote hosts (at least for your database).

Depending on network quality you can get poor performances and sometimes it is hard to check it (let say you don’t have a ssh access to the machine which is pretty common for cloud platforms).

Another use case is to valid you can contact the remote host (in complex environment with proxies for instance).

That’s why we added to TomEE a JMX ping!

Continue reading