Jakub is a Java EE developer since 2005 and occasionally a project manager, working currently with Iterate AS. He's highly interested in developer productivity (and tools like Maven and AOP/AspectJ), web frameworks, Java portals, testing and performance and works a lot with IBM technologies. A native to Czech Republic, he lives now in Oslo, Norway. Jakub is a DZone MVB and is not an employee of DZone and has posted 154 posts at DZone. You can read more from them at their website. View Full User Profile

Version hell with JSFUnit, Arquillian, and (embedded) Glassfish and other containers

  • submit to reddit

JSFUnit and the JBoss Arquillian test framework for JavaEE look very promissing, but according to my experience there are good reasons why they are only beta and alpha versions. May be you can get them working but you must pick the right version of each dependency – for many things change between individual versions at this point – and be lucky to hit one of the “happy paths”. At the end I nearly got JSFUnit 1.0.0.Beta1 running with Arquillian 10.0.0.Alpha4 and glassfish-embedded 3.0.1 but failed to deploy due to a strange parse exception of an arquillian’s web fragment. I record this failure to help those who are struggling with this too.

There are the following fatal constraints:

  • JSFUnit 2.0.0.Beta1 is the latest available one (Beta2 should have been released in April but wasn’t and it has still one issue opened – JSFUNIT-275]; 2.0.0. Final is due on July 1st but considering the delay of Beta2 and no progress in the final version, it will be certainly much later)
  • JSFUnit 2.0.0.Beta1 requires Arquillian 1.0.0.Alpha4, support for Alpha5 comes with Beta2.
  • Container selection:
    • Tomcat 6 only supports servlet 2.5 while JSFUnit requires 3.0 for it uses web fragments; however this seems to be fixed in JSFUNIT 1.0.0.Beta2, see JSFUNIT-273
    • I wasn’t able to get JBoss Embedded (6.0.0.Final), it tried to download quazillion dependencies and ultimately failed due to some version mismatches
    • Embedded GlassFish (GF) – version 3.1 has a different API, which is supported only since Arq. Alpha5, and deployment to 3.0.1 fails due to “SAXParseException: src-resolve: Cannot resolve the name ‘xml:lang’ to a(n) ‘attribute declaration’ component.“, solved only in GF 3.1 (GLASSFISH-13261). Surprisingly I got 3.0.1 working with another project but there it failed due to JSF libraries mismatch (otherwise it might also come to this problem).

My (not so well working) Ivy configuration thus was:

<dependency org="org.jboss.jsfunit" name="jsfunit-arquillian" rev="2.0.0.Beta1" conf="webtest" />
<dependency org="org.jboss.arquillian" name="arquillian-junit" rev="1.0.0.Alpha4" conf="webtest" />
<dependency org="org.jboss.arquillian.container" name="arquillian-glassfish-embedded-3" rev="1.0.0.Alpha4" conf="webtest" />
<dependency org="org.glassfish.extras" name="glassfish-embedded-all" rev="3.0.1" conf="webtest" />

The accompanying settings.xml with repositories:

<settings defaultResolver="all_repositories" />
<chain name="all_repositories">
<ibiblio name="ibiblio" m2compatible="true" />
<ibiblio name="jboss" m2compatible="true" root="https://repository.jboss.org/nexus/content/repositories/releases" /> <!-- JSFUnit etc. -->
<ibiblio name="sunJars" m2compatible="true" root="http://download.java.net/maven/2" /> <!-- javax.* APIs etc. -->
<ibiblio name="glassfish-embedded" m2compatible="true" root="http://download.java.net/maven/glassfish/" />

On JSF versions

It seems that you can test only JSF 2.0 applications (well, you hopefully will be able to test them once Beta2 is out); if you try to test a JSF 1.2 application you will run into conflicting APIs, resulting for example in IllegalArgumentException: javax.faces.context.ExceptionHandlerFactory.

Tip: Increasing logging in the embedded Glassfish

GF uses java logging => copy glassfish/domains/domain1/config/logging.properties somewhere, replace INFO with FINE and run your test with the following setting:


If your test failes due to IllegalStateException: Error launching test at http://localhost:8181/test/ArquillianServletRunner?…. Kept on getting 404s. then likely the deployment of your application has failed and you should increase the logging level and check the issue.

Some entries of interest:

  • ClassName=com.sun.enterprise.deployment.node.web.WebCommonNode;MethodName=addDescriptor;|Adding web component …
  • javax.enterprise.system.tools.deployment.org.glassfish.deployment.common – some important exceptions may show here
  • javax.enterprise.system.container.web.com.sun.enterprise.web|…;ClassName=com.sun.enterprise.web.WebModuleListener;MethodName=configureJsp;| sysClasspath for __default-web-module is
    … jsfunit-arquillian-2.0.0.Beta1.jar: …
  • There was a NPE which perhaps is actually OK: ClassName=org.glassfish.deployment.common.InstalledLibrariesResolver;MethodName=getInstalledLibraries;|InstalledLibrariesResolver : exception occurred : java.lang.NullPointerException|#]


From http://theholyjava.wordpress.com/2011/06/07/version-hell-with-jsfunit-arquillian-and-embedded-glassfish-and-other-containers/

Published at DZone with permission of Jakub Holý, author and DZone MVB.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)