1 Reply Latest reply on Nov 26, 2009 12:06 PM by Daryl Olson

    UnitTests EJBs cannot be successfull

    blured blured Newbie

      When I'm launching the EJBs unit test for Embedded Jboss béta 3.10 I've got the following error :
      <<
      INFO [org.hibernate.ejb.Version] Hibernate EntityManager 3.4.0.GA
      INFO [org.hibernate.ejb.Ejb3Configuration] Processing PersistenceUnitInfo [
      name: custdb
      ...]
      WARN [org.hibernate.ejb.packaging.InputStreamZippedJarVisitor] Unable to find file (ignored): vfs://12573464685670/
      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 org.jboss.embedded.tutorial.junit.EasierEjbTestCase.deploy(EasierEjbTestCase.java:64)
      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:467)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      WARN [org.hibernate.ejb.Ejb3Configuration] Persistence provider caller does not implement the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
      INFO [org.hibernate.cfg.search.HibernateSearchEventListenerRegister] Unable to find org.hibernate.search.event.FullTextIndexEventListener on the classpath. Hibernate Search is not enabled.
      INFO [org.hibernate.connection.ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      INFO [org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider] Using provided datasource
      INFO [org.hibernate.cfg.SettingsFactory] RDBMS: HSQL Database Engine, version: 1.8.0
      INFO [org.hibernate.cfg.SettingsFactory] JDBC driver: HSQL Database Engine Driver, version: 1.8.0
      INFO [org.hibernate.dialect.Dialect] Using dialect: org.hibernate.dialect.HSQLDialect
      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 region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
      INFO [org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge] 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: ejbTestCase_jar,custdb
      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
      INFO [org.hibernate.impl.SessionFactoryImpl] building session factory
      INFO [org.hibernate.impl.SessionFactoryObjectFactory] Factory name: persistence.units:jar=ejbTestCase.jar,unitName=custdb
      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.hibernate.impl.SessionFactoryObjectFactory] Bound factory to JNDI name: persistence.units:jar=ejbTestCase.jar,unitName=custdb
      WARN [org.hibernate.impl.SessionFactoryObjectFactory] InitialContext did not implement EventContext
      INFO [org.hibernate.tool.hbm2ddl.SchemaExport] Running hbm2ddl schema export
      INFO [org.hibernate.tool.hbm2ddl.SchemaExport] exporting generated schema to database
      INFO [org.hibernate.tool.hbm2ddl.SchemaExport] schema export complete
      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=CustomerDAOBean,service=EJB3 with dependencies:
      INFO [org.jboss.ejb3.MCKernelAbstraction] and supplies:
      INFO [org.jboss.ejb3.MCKernelAbstraction] Class:org.jboss.embedded.tutorial.junit.beans.CustomerDAOLocal
      INFO [org.jboss.ejb3.MCKernelAbstraction] Class:org.jboss.embedded.tutorial.junit.beans.CustomerDAORemote
      INFO [org.jboss.ejb3.EJBContainer] STARTED EJB: org.jboss.embedded.tutorial.junit.beans.CustomerDAOBean ejbName: CustomerDAOBean
      WARN [org.jboss.ejb3.timerservice.jboss.JBossTimerServiceFactory] TIMER SERVICE IS NOT INSTALLED
      >>

      Do you know how to avoid this ?

      Regards,
      Denis.

        • 1. Re: UnitTests EJBs cannot be successfull
          Daryl Olson Newbie

          What I did to get around this error was to replace (see EasierEjbTestCase.deploy()):

          Bootstrap.getInstance().deploy(jar);

          with:

          Bootstrap.getInstance().scanClasspath("output" );

          where "output" is the "Default output folder:" defined in my Eclipse project ("embedded-jboss-beta3.SP10/docs/tutorial/junit/ide/output").

          Similarity for the undeploy(), I replaced:

          AssembledContextFactory.getInstance().remove(jar);
          jar = null;

          with:

          Bootstrap.getInstance().undeployClasspath("output");