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

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="" /> <!-- JSFUnit etc. -->
         <ibiblio name="sunJars" m2compatible="true" root="" /> <!-- javax.* APIs etc. -->
         <ibiblio name="glassfish-embedded" m2compatible="true" root="" />

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/ 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?&#8230;. 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 …
  • – some important exceptions may show here
  •|…;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|#]


Published by Jakub Holý

I’m a JVM-based developer since 2005, consultant, and occasionally a project manager, working currently with Iterate AS in Norway.

2 thoughts on “Version hell with JSFUnit, Arquillian, and (embedded) Glassfish and other containers

  1. For Java EE 6 unit and integration testing, you may want to check out my jeeunit project (, which currently supports Glassfish 3.1 and Resin 4.0.18. A comment in my blog pointed me to Arquillian after I’d published jeeunit, and since then I’ve been trying to make Arquillian work for my scenarios, but without real success so far.

    I’m all against reinventing the wheel, but as long as developing and maintaining my own code seems easier than understanding and using someone else’s, I’ll stick with jeeunit 🙂 If you’d like to give jeeunit a try, I’d love to get your feedback.

    Note that the Embedded Glassfish API has changed rather late in the 3.1 pre-release phase, so the current release jeeunit 0.8.0 requires Glassfish 3.1 and is not compatible with Glassfish 3.0.1.

    I have never used JSF, jeeunit’s main focus is on the persistence, EJB, and service layers, but there is no reason why it should not work for the web layer as well. In fact, jeeunit uses the Servlet 3.0 API for communication between the JUnit runner and the embedded Java EE 6 server.


Comments are closed.