TomEE and finer RESOURCE_LOCAL persistence unit configuration

The issue with RESOURCE_LOCAL units is that it is used a bit differently if you are in a EE container or not. Basically in a container the spec mandates the unit type to be JTA is you don’t specify any datasource (jta and non jta one)…even if you set RESOURCE_LOCAL.

Issue is: in standalone mode you never do it so if you import a standalone app then it is broken.

That’s why TomEE added two configurable properties (system properties or unit properties).

Continue reading

Arquillian and TomEE embedded: multiple webapps, different CDI extensions

TomEE embedded made several progresses recently and it is nice to use with Arquillian. Since it is fully integrated with Arquillian you can deploy 2, 3 or much more webapps in the TomEE embedded instance…but then you have an issue: CDI. CDI extension mecanism is based on Java ServiceLoader mecanism. It means it uses META-INF/services/* to load its extensions. The issue: TomEE embedded is embedded. Of course it shares its container classloader with all applications but in this case you’ll get in 90% of cases your extension as well (cause of Maven, gradle, …). So it means if you deploy your application with the desired CDI extension and another (a test one) where you don’t want them you’ll get trouble since the extension will be loaded.

How to avoid it?

Continue reading