3 Replies Latest reply on Oct 3, 2008 10:20 PM by Alex Grönholm

    Jboss Embed for Junit testing

    darren hartford Expert

      hey all,
      I'm trying to get jboss embed setup for unit testing. I'm running into this problem:

      java.lang.RuntimeException: Failed to bootstrap
      at org.jboss.embedded.junit.BaseTestCase.bootstrap(BaseTestCase.java:103)
      ...
      Caused by: java.lang.IllegalStateException: Failed to create schema loader: java.lang.ClassCastException org.apache.xerces.dom.DOMXSImplementationSourceImpl cannot be cast to org.w3c.dom.DOMImplementationSource
      at org.jboss.xb.binding.Util$2.run(Util.java:517)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.xb.binding.Util.getXSImplementation(Util.java:488)
      at org.jboss.xb.binding.Util.loadSchema(Util.java:387)
      ...


      If there is a better source of how to use jboss embed for unit testing, that would be nice. I'm using these:

      http://www.devx.com/Java/Article/30496/1954

      http://docs.codehaus.org/display/MAVENUSER/How+to+use+the+JBoss+Embedded+EJB3+Container+for+Unit+testing

      http://wiki.jboss.org/wiki/EmbeddedAndJUnit

      Items like the bootstrap-beans.xml is causing grief (don't know what it's supposed to look like), and making sure all the necessary libs are on the classpath, and the right libs (there are like 3 different groups for jboss-embed, different versions).

      My maven pom.xml:

      jboss
      jboss-embedded-all
      2.0.0.BETA1
      test


      trove
      trove
      2.1.1
      test



      Any help to get on the right track would be greatly appreciated. I just want to unit test entity, stateless, stateful, mdb in that order of priority with the normal *-ds.xml config files.