6 Replies Latest reply on Oct 7, 2009 9:51 AM by tbar0711

    JBoss Embedded and JUnit testing

    tbar0711 Newbie

      Hi,

      the first thing I have to say is that I searched a lot for a simple JUnit Test of a simple Session Bean using Embedded JBoss. I still haven't found an example that shows me a successful usage of Embedded JBoss. I'm not familiar with the configuration of the Embedded JBoss. It would be great if someone gives me a simple example with source code for creating a simple JUnit Test of a simple session bean using Embedded JBoss.

      The next question is:
      Can I use Embedded JBoss Beta 3 for JUnit testing if I have an application that runs on JBoss 4.2.3 but not on JBoss 5?

      I'm using Eclipse 3.4.2.

      Thanks in advance.

        • 1. Re: JBoss Embedded and JUnit testing
          tbar0711 Newbie

          OK, now I've got it. I took the Embedded JBoss Beta3 and created a simple Session Bean with an interface, a simple Entity Bean and a testclass to test the functionality of that session bean. The test is successful an everything is ok.

          My persistence.xml (your entity beans have to be referenced via the class tags):

          <?xml version="1.0" encoding="UTF-8"?>
          <persistence>
           <persistence-unit name="testdb">
           <jta-data-source>java:/DefaultDS</jta-data-source>
           <properties>
           <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
           <property name="jboss.entity.manager.jndi.name" value="java:/EntityManagers/testdb"/>
           </properties>
           <class>main.example.entity.EntityBeanName</class>
           </persistence-unit>
          </persistence>
          



          You have to add the complete bootstrap directory as source folder to your classpath. Also you can add the META-INF directory with the persistence.xml inside as source folder to your classpath.

          Here is an example of a test class:

          public class MyTestCase extends BaseTestCase {
           public MyTestCase() {
           super("MyTestCase");
           }
          
           private static AssembledDirectory jar;
          
           public static void deploy() {
           jar = AssembledContextFactory.getInstance().create("ejb3TestCase.jar");
           jar.addClass(EntityBeanName.class);
           jar.addClass(SessionBeanInterfaceName.class);
           jar.addClass(SessionBeanName.class);
           jar.mkdir("META-INF").addResource("persistence.xml", "persistence.xml");
           try {
           Bootstrap.getInstance().deploy(jar);
           } catch (DeploymentException e) {
           throw new RuntimeException("Unable to deploy", e);
           }
           }
          
           public static void undeploy() {
           try {
           Bootstrap.getInstance().undeploy(jar);
           AssembledContextFactory.getInstance().remove(jar);
           jar = null;
           } catch (DeploymentException e) {
           throw new RuntimeException("Unable to undeploy", e);
           }
           }
          
           public static Test suite() {
           return preProcessedTest(MyTestCase.class);
           }
          
           public void test() throws Exception {
           InitialContext ctx = new InitialContext();
           SessionBeanInterface local = (SessionBeanInterface) ctx
           .lookup("SessionBean/local");
           EntityBean eb = new EntityBean();
           eb.setSomething1("1");
           eb.setSomething2("XXX");
           local.createEntity(eb);
           List<EntityBean> ebs = local.test();
           assertEquals(1, ebs.size());
           }
          }
          




          But now I'm going to use this for unit testing my real application which runs on a JBoss 4.2.3.

          So my persistence.xml has to be changed into:

          <persistence xmlns="http://java.sun.com/xml/ns/persistence"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
           http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
           version="1.0">
           <persistence-unit name="myDB" transaction-type="JTA">
           <jta-data-source>java:/jdbc/myDS</jta-data-source>
           <properties>
           <property name="hibernate.archive.autodetection" value="class" />
           <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect" />
           <property name="hibernate.session_factory_name" value="java:hibernate/SessionFactory" />
           <property name="hibernate.transaction.manager_lookup_class"
           value="org.hibernate.transaction.JBossTransactionManagerLookup" />
           </properties>
           <class>de.myapp.persistence.EntityBeanName1</class>
           <class>de.myapp.persistence.EntityBeanName2</class>
           <class>de.myapp.persistence.EntityBeanName3</class>
           </persistence-unit>
          </persistence>
          


          This is the same persistence.xml I use in my real application except of the class - tags.

          I put the myapp-ds.xml into the deploy directory of the Embedded JBoss.

          myapp-ds.xml:

          <?xml version="1.0" encoding="UTF-8"?>
          
          <datasources>
           <local-tx-datasource>
           <jndi-name>jdbc/myDS</jndi-name>
           <connection-url>jdbc:oracle:thin:@entwdb:3333:entw</connection-url>
           <driver-class>oracle.jdbc.OracleDriver</driver-class>
           <user-name>user</user-name>
           <password>password</password>
           <max-pool-size>80</max-pool-size>
           <prepared-statement-cache-size>100</prepared-statement-cache-size>
           <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name>
           <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
           <SetBigStringTryClob>true</SetBigStringTryClob>
           <metadata>
           <type-mapping>Oracle9i</type-mapping>
           </metadata>
           </local-tx-datasource>
          </datasources>
          


          Now I start the test but the test ends with a runtime exception: Failed to bootstrap. My log looks like this:

          WARN [org.jboss.mx.loading.UnifiedLoaderRepository3] Tried to add non-URLClassLoader. Ignored
          WARN [org.jboss.aop.deployment.AspectManagerService] Could not find base-aspects.xml file in the resources of sun.misc.Launcher$AppClassLoader@12498b5
          INFO [org.jboss.aop.deployers.AspectDeployer] Deploying xml into org.jboss.aop.AspectManager@1c1f2 for sun.misc.Launcher$AppClassLoader@12498b5
          INFO [org.jboss.resource.deployers.RARDeployment] Required license terms exist, view vfsfile:/home/target/classes/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
          INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/myDS' to JNDI name 'java:jdbc/myDS'
          INFO [org.jboss.resource.deployers.RARDeployment] Required license terms exist, view vfsfile:/home/target/classes/deploy/jms-ra.rar/META-INF/ra.xml
          INFO [org.jboss.resource.deployers.RARDeployment] Required license terms exist, view vfsfile:/home/target/classes/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
          INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
          WARN [org.jboss.jms.server.security.SecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
          INFO [org.jboss.jms.server.ServerPeer] JBoss Messaging 1.4.0.SP1 server [0] started
          WARN [org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
          WARN [org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
          INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] Connector bisocket://pc12:3434 has leasing enabled, lease period 10000 milliseconds
          INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@11be57f started
          INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] Connector bisocket://pc12:3434 has leasing enabled, lease period 10000 milliseconds
          INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@4f7537 started
          INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] Connector bisocket://pc12:3434 has leasing enabled, lease period 10000 milliseconds
          INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@fef26a started
          INFO [org.jboss.jms.server.destination.QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
          INFO [org.jboss.jms.server.destination.QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
          INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
          


          Does anybody know what goes wrong?

          • 2. Re: JBoss Embedded and JUnit testing
            tbar0711 Newbie

            Ok, I fixed it. I had to remove the metadata-tags in my *ds.xml file.

            Now later another Error occured:

            INFO [org.hibernate.transaction.TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
            INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
            INFO [org.hibernate.transaction.TransactionManagerLookupFactory] instantiated TransactionManagerLookup
            INFO [org.hibernate.cfg.SettingsFactory] Automatic flush during beforeCompletion(): disabled
            INFO [org.hibernate.cfg.SettingsFactory] Automatic session close at end of transaction: disabled
            INFO [org.hibernate.cfg.SettingsFactory] JDBC batch size: 15
            INFO [org.hibernate.cfg.SettingsFactory] JDBC batch updates for versioned data: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Scrollable result sets: enabled
            INFO [org.hibernate.cfg.SettingsFactory] JDBC3 getGeneratedKeys(): disabled
            INFO [org.hibernate.cfg.SettingsFactory] Connection release mode: auto
            INFO [org.hibernate.cfg.SettingsFactory] Default batch fetch size: 1
            INFO [org.hibernate.cfg.SettingsFactory] Generate SQL with comments: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Order SQL updates by primary key: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Order SQL inserts for batching: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
            INFO [org.hibernate.hql.ast.ASTQueryTranslatorFactory] Using ASTQueryTranslatorFactory
            INFO [org.hibernate.cfg.SettingsFactory] Query language substitutions: {}
            INFO [org.hibernate.cfg.SettingsFactory] JPA-QL strict compliance: enabled
            INFO [org.hibernate.cfg.SettingsFactory] Second-level cache: enabled
            INFO [org.hibernate.cfg.SettingsFactory] Query cache: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Cache provider: org.hibernate.cache.HashtableCacheProvider
            INFO [org.hibernate.cfg.SettingsFactory] Optimize cache for minimal puts: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Cache region prefix: myDB
            INFO [org.hibernate.cfg.SettingsFactory] Structured second-level cache entries: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Statistics: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Deleted entity synthetic identifier rollback: disabled
            INFO [org.hibernate.cfg.SettingsFactory] Default entity-mode: pojo
            INFO [org.hibernate.cfg.SettingsFactory] Named query checking : enabled
            ERROR [org.jboss.kernel.plugins.dependency.AbstractKernelController] Error installing to Start: name=persistence.units:unitName=myDB state=Create
            java.lang.NoSuchMethodError: org.hibernate.cfg.ExtendedMappings.getReflectionManager()Lorg/hibernate/reflection/ReflectionManager;
             at org.hibernate.search.event.FullTextIndexEventListener.initialize(FullTextIndexEventListener.java:82)
             at org.hibernate.event.EventListeners.initializeListeners(EventListeners.java:356)
             at org.hibernate.cfg.Configuration.getInitializedEventListeners(Configuration.java:1304)
             at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
             at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:918)
             at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:656)
             at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
             at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:259)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56)
             at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110)
             at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:214)
             at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:108)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:69)
             at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135)
             at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46)
             at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
             at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
             at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398)
             at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:96)
             at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:90)
             at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:151)
             at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:604)
             at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:400)
             at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:53)
             at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:37)
             at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65)
             at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
             at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
             at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
             at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
             at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
             at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
             at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
             at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
             at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
             at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127)
             at org.jboss.embedded.Bootstrap.deploy(Bootstrap.java:327)
             at de.persistence.dao.SomethingDaoImplTest.deploy(SomethingDaoImplTest.java:47)
             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
             at java.lang.reflect.Method.invoke(Method.java:585)
             at org.jboss.embedded.junit.BaseTestCase$1.setUp(BaseTestCase.java:130)
             at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
             at junit.framework.TestResult.runProtected(TestResult.java:124)
             at junit.extensions.TestSetup.run(TestSetup.java:25)
             at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
             at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
             at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
             at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
             at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
             at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
            


            Does anybody know what's the problem here?

            • 3. Re: JBoss Embedded and JUnit testing
              tbar0711 Newbie

              Now I took only the JUnit Test relevant classes of my complete application project and put them into a separate project.

              I ran the test and now I get the following error. Perhaps somebody knows where's the fly in the ointment?

              INFO [org.hibernate.util.NamingHelper] JNDI InitialContext properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
              INFO [org.jboss.ejb3.MCKernelAbstraction] installing bean: jboss.j2ee:jar=ejbTestCase.jar,name=SomethingDaoImpl,service=EJB3 with dependencies:
              INFO [org.jboss.ejb3.MCKernelAbstraction] and supplies:
              INFO [org.jboss.ejb3.MCKernelAbstraction] Class:daos.SomethingDAO
              INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: sessions.SomethingDaoImpl ejbName: SomethingDaoImpl
              WARN [org.jboss.ejb3.timerservice.jboss.JBossTimerServiceFactory] TIMER SERVICE IS NOT INSTALLED
              INFO [junit.SomethingDaoImplTest] ***** SomethingDaoImplTest: testLoad() *****
              INFO [junit.SomethingDaoImplTest] ***** SomethingDaoImplTest: testLoadSomethingTexte() *****
              



              My JUnit Test was been terminated with the following exception:

              java.lang.RuntimeException: java.lang.InstantiationException
              



              Thanks in advance.


              • 4. Re: JBoss Embedded and JUnit testing
                tbar0711 Newbie

                Ok, now I know the cause of this exception:
                My Session Bean was declared as an abstract class. I removed the abstract declaration and everything's fine.

                • 5. Re: JBoss Embedded and JUnit testing
                  tbar0711 Newbie

                  Hi there,

                  I shout and jump for joy. Finally I've got a successful green JUnit Test.

                  Now one more question that I possibly can't answer myself:

                  My JUnit Test is successful but at the beginning of the running test I always get a warn message from InputStreamZippedJarVisitor which tells me that it's unable to find file. I hope this time has anyone an idea how I get rid of this warning or what causes this warning?

                  WARN [org.jboss.mx.loading.UnifiedLoaderRepository3] Tried to add non-URLClassLoader. Ignored
                  WARN [org.jboss.aop.deployment.AspectManagerService] Could not find base-aspects.xml file in the resources of sun.misc.Launcher$AppClassLoader@12498b5
                  INFO [org.jboss.aop.deployers.AspectDeployer] Deploying xml into org.jboss.aop.AspectManager@383244 for sun.misc.Launcher$AppClassLoader@12498b5
                  INFO [org.jboss.resource.deployers.RARDeployment] Required license terms exist, view vfsfile:/home/target/classes/deploy/jms-ra.rar/META-INF/ra.xml
                  INFO [org.jboss.resource.deployers.RARDeployment] Required license terms exist, view vfsfile:/home/target/classes/deploy/jboss-xa-jdbc.rar/META-INF/ra.xml
                  INFO [org.jboss.resource.deployers.RARDeployment] Required license terms exist, view vfsfile:/home/target/classes/deploy/jboss-local-jdbc.rar/META-INF/ra.xml
                  INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=jdbc/myDS' to JNDI name 'java:jdbc/myDS'
                  INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=DefaultDS' to JNDI name 'java:DefaultDS'
                  WARN [org.jboss.jms.server.security.SecurityMetadataStore] WARNING! POTENTIAL SECURITY RISK. It has been detected that the MessageSucker component which sucks messages from one node to another has not had its password changed from the installation default. Please see the JBoss Messaging user guide for instructions on how to do this.
                  INFO [org.jboss.jms.server.ServerPeer] JBoss Messaging 1.4.0.SP1 server [0] started
                  INFO [org.jboss.jms.server.destination.QueueService] Queue[/queue/ExpiryQueue] started, fullSize=200000, pageSize=2000, downCacheSize=2000
                  INFO [org.jboss.jms.server.destination.QueueService] Queue[/queue/DLQ] started, fullSize=200000, pageSize=2000, downCacheSize=2000
                  WARN [org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper] supportsFailover attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support failover
                  WARN [org.jboss.jms.server.connectionfactory.ConnectionFactoryJNDIMapper] supportsLoadBalancing attribute is true on connection factory: jboss.messaging.connectionfactory:service=ClusteredConnectionFactory but post office is non clustered. So connection factory will *not* support load balancing
                  INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] Connector bisocket://pc44:3434 has leasing enabled, lease period 10000 milliseconds
                  INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@184cf08 started
                  INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] Connector bisocket://pc44:3434 has leasing enabled, lease period 10000 milliseconds
                  INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@214f6b started
                  INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] Connector bisocket://pc44:3434 has leasing enabled, lease period 10000 milliseconds
                  INFO [org.jboss.jms.server.connectionfactory.ConnectionFactory] org.jboss.jms.server.connectionfactory.ConnectionFactory@f00e0f started
                  INFO [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
                  INFO [org.jboss.ejb3.deployers.PersistenceUnitParsingDeployer] Found persistence units [org.jboss.ejb3.metadata.jpa.spec.PersistenceUnitMetaData@1a6ac39{name=myDB}]
                  INFO [org.jboss.ejb3.MCKernelAbstraction] installing bean: persistence.units:jar=ejbTestCase.jar,unitName=myDB with dependencies:
                  INFO [org.jboss.ejb3.MCKernelAbstraction] and supplies:
                  INFO [org.jboss.ejb3.entity.PersistenceUnitDeployment] Starting persistence unit persistence.units:jar=ejbTestCase.jar,unitName=myDB
                  INFO [org.hibernate.cfg.annotations.Version] Hibernate Annotations 3.4.0.GA
                  INFO [org.hibernate.cfg.Environment] Hibernate 3.3.1.GA
                  INFO [org.hibernate.cfg.Environment] hibernate.properties not found
                  INFO [org.hibernate.cfg.Environment] Bytecode provider name : javassist
                  INFO [org.hibernate.cfg.Environment] using JDK 1.4 java.sql.Timestamp handling
                  INFO [org.hibernate.annotations.common.Version] Hibernate Commons Annotations 3.1.0.GA
                  INFO [org.hibernate.ejb.Version] Hibernate EntityManager 3.4.0.GA
                  INFO [org.hibernate.ejb.Ejb3Configuration] Processing PersistenceUnitInfo [
                   name: myDB
                   ...]
                  WARN [org.hibernate.ejb.packaging.InputStreamZippedJarVisitor] Unable to find file (ignored): vfs://12535380613490/
                  java.lang.RuntimeException: Cannot open stream
                   at org.jboss.virtual.plugins.context.vfs.AssembledDirectoryHandler.openStream(AssembledDirectoryHandler.java:117)
                   at org.jboss.virtual.VirtualFile.openStream(VirtualFile.java:216)
                   at org.jboss.virtual.plugins.vfs.VirtualFileURLConnection.getInputStream(VirtualFileURLConnection.java:117)
                   at java.net.URL.openStream(URL.java:1007)
                   at org.hibernate.ejb.packaging.InputStreamZippedJarVisitor.doProcessElements(InputStreamZippedJarVisitor.java:37)
                   at org.hibernate.ejb.packaging.AbstractJarVisitor.getMatchingEntries(AbstractJarVisitor.java:139)
                   at org.hibernate.ejb.Ejb3Configuration.addScannedEntries(Ejb3Configuration.java:287)
                   at org.hibernate.ejb.Ejb3Configuration.scanForClasses(Ejb3Configuration.java:614)
                   at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:360)
                   at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:131)
                   at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:259)
                   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                   at java.lang.reflect.Method.invoke(Method.java:585)
                   at org.jboss.reflect.plugins.introspection.ReflectionUtils.invoke(ReflectionUtils.java:56)
                   at org.jboss.reflect.plugins.introspection.ReflectMethodInfoImpl.invoke(ReflectMethodInfoImpl.java:110)
                   at org.jboss.joinpoint.plugins.BasicMethodJoinPoint.dispatch(BasicMethodJoinPoint.java:66)
                   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction$JoinpointDispatchWrapper.execute(KernelControllerContextAction.java:214)
                   at org.jboss.kernel.plugins.dependency.ExecutionWrapper.execute(ExecutionWrapper.java:45)
                   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchExecutionWrapper(KernelControllerContextAction.java:108)
                   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.dispatchJoinPoint(KernelControllerContextAction.java:69)
                   at org.jboss.kernel.plugins.dependency.LifecycleAction.installActionInternal(LifecycleAction.java:221)
                   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:135)
                   at org.jboss.kernel.plugins.dependency.KernelControllerContextAction.installAction(KernelControllerContextAction.java:46)
                   at org.jboss.dependency.plugins.action.SimpleControllerContextAction.simpleInstallAction(SimpleControllerContextAction.java:62)
                   at org.jboss.dependency.plugins.action.AccessControllerContextAction.install(AccessControllerContextAction.java:71)
                   at org.jboss.dependency.plugins.AbstractControllerContextActions.install(AbstractControllerContextActions.java:51)
                   at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
                   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
                   at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
                   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
                   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
                   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:574)
                   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:398)
                   at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:96)
                   at org.jboss.kernel.plugins.dependency.AbstractKernelController.install(AbstractKernelController.java:90)
                   at org.jboss.ejb3.MCKernelAbstraction.install(MCKernelAbstraction.java:151)
                   at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:604)
                   at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:400)
                   at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:53)
                   at org.jboss.ejb3.deployers.EJBStage2Deployer.deploy(EJBStage2Deployer.java:37)
                   at org.jboss.deployers.spi.deployer.helpers.AbstractSimpleRealDeployer.internalDeploy(AbstractSimpleRealDeployer.java:65)
                   at org.jboss.deployers.spi.deployer.helpers.AbstractRealDeployer.deploy(AbstractRealDeployer.java:50)
                   at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:169)
                   at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:853)
                   at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:794)
                   at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:327)
                   at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1309)
                   at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:734)
                   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:862)
                   at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:784)
                   at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:622)
                   at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:411)
                   at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:498)
                   at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:506)
                   at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:127)
                   at org.jboss.embedded.Bootstrap.deploy(Bootstrap.java:327)
                   at junit.SomethingDaoImplTest.deploy(SomethingDaoImplTest.java:75)
                   at junit.SomethingDaoImplTest.access$0(SomethingDaoImplTest.java:52)
                   at junit.SomethingDaoImplTest$1.setUp(SomethingDaoImplTest.java:102)
                   at junit.extensions.TestSetup$1.protect(TestSetup.java:20)
                   at junit.framework.TestResult.runProtected(TestResult.java:124)
                   at junit.extensions.TestSetup.run(TestSetup.java:25)
                   at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
                   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
                   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
                  WARN [org.hibernate.ejb.Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
                  INFO [org.hibernate.cfg.AnnotationBinder] Binding entity from annotated class: entities.Entity1
                  INFO [org.hibernate.cfg.annotations.EntityBinder] Bind entity entities.Entity1 on table Entity1
                  INFO [org.hibernate.cfg.AnnotationBinder] Binding entity from annotated class: entities.Entity2
                  INFO [org.hibernate.cfg.annotations.EntityBinder] Bind entity entities.Entity2 on table Entity2
                  INFO [org.hibernate.validator.Version] Hibernate Validator 3.1.0.GA
                  


                  Any help is highly appreciated.

                  • 6. Re: JBoss Embedded and JUnit testing
                    tbar0711 Newbie

                    Ok, it seems like nobody has an answer for my last question.

                    At the moment I'm trying to use Maven to get my Embedded JBoss jars except of using my own user library.

                    It isn't a easy thing to configure the pom correctly. So it would be great if someone has correct pom that includes all the Embedded jars and the bootstrap source folder.

                    Currently I only know how to get the jars within my pom:

                     <properties>
                     <version.jboss-embedded>beta3.SP10</version.jboss-embedded>
                     </properties>
                    
                     <dependencies>
                     <dependency>
                     <groupId>org.jboss.embedded</groupId>
                     <artifactId>jboss-embedded-all</artifactId>
                     <version>${version.jboss-embedded}</version>
                     <scope>test</scope>
                     <exclusions>
                     <exclusion>
                     <groupId>org.jboss.embedded</groupId>
                     <artifactId>jboss-embedded</artifactId>
                     </exclusion>
                     <exclusion>
                     <groupId>org.jboss.microcontainer</groupId>
                     <artifactId>jboss-deployers-client-spi</artifactId>
                     </exclusion>
                     <exclusion>
                     <groupId>org.jboss.microcontainer</groupId>
                     <artifactId>jboss-deployers-core-spi</artifactId>
                     </exclusion>
                     </exclusions>
                     </dependency>
                     <dependency>
                     <groupId>org.jboss.embedded</groupId>
                     <artifactId>jboss-embedded</artifactId>
                     <version>${version.jboss-embedded}</version>
                     <scope>test</scope>
                     </dependency>
                     <dependency>
                     <groupId>org.jboss.embedded</groupId>
                     <artifactId>thirdparty-all</artifactId>
                     <version>${version.jboss-embedded}</version>
                     <scope>test</scope>
                     </dependency>
                     <dependency>
                     <groupId>org.jboss.embedded</groupId>
                     <artifactId>hibernate-all</artifactId>
                     <version>${version.jboss-embedded}</version>
                     <scope>test</scope>
                     </dependency>
                    


                    Now I'm very interested how to inform Maven about my bootstrap source folder. Has anyone an idea? If so, please post your pom here.

                    Kindly regards
                    T.