14 Replies Latest reply on Mar 27, 2006 12:50 PM by Shiung Yong

    Multiple datasource deployment issue

    Shiung Yong Newbie

      I have two .ear files which are identical, and I'm trying to deploy them to connect to two identical but separate datasources.

      Following the suggestions posted on this board, I attempted to put all my entity and session beans in an .ejb3 file in the JBoss/bin directory, then deploy my ear files which just have a skeleton ejb3 file with the persistence.xml in it. The persistence.xml files only differ in the datasource connection. Both have a <jar-file> entry which points to the ejb3 file in the JBoss bin directory. Both ear files throw the following exception:

      15:57:07,052 INFO [Ejb3Deployment] Found persistence.xml file in EJB3 jar
      15:57:07,070 ERROR [Ejb3Module] Initialization failed jboss.j2ee:service=EJB3,module=beans.ejb3
      java.lang.IllegalArgumentException: class not found
       at org.hibernate.ejb.HibernatePersistence.addNamedAnnotatedClasses(HibernatePersistence.java:556)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:389)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:272)
       at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:476)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:219)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:330)
       at org.jboss.system.ServiceController.create(ServiceController.java:275)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy16.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: beans.entity.Request
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:292)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.hibernate.ejb.HibernatePersistence.addNamedAnnotatedClasses(HibernatePersistence.java:549)
       ... 53 more
      15:57:07,074 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=beans.ejb3
      java.lang.IllegalArgumentException: class not found
       at org.hibernate.ejb.HibernatePersistence.addNamedAnnotatedClasses(HibernatePersistence.java:556)
       at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:389)
       at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:272)
       at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:476)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:219)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
       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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:330)
       at org.jboss.system.ServiceController.create(ServiceController.java:275)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy16.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      Caused by: java.lang.ClassNotFoundException: No ClassLoaders found for: beans.entity.Request
       at org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:292)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:475)
       at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:377)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
       at org.hibernate.ejb.HibernatePersistence.addNamedAnnotatedClasses(HibernatePersistence.java:549)
       ... 53 more


      Then, I remove the ejb3 file from the bin directory and combine the bean classes and the persistence.xml file in the ejb3 file inside each ear. Now each ear has all its needed classes contained within it. I then try to deploy them both. The first ear deploys with no problems. The second ear throws this exception:

      15:51:34,396 ERROR [Ejb3Module] Initialization failed jboss.j2ee:module=beans.ejb3,uid=29289177,service=EJB3
      javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EJB3,name=beans.session.OptionsBean already registered.
       at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:755)
       at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:211)
       at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1407)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1402)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:361)
       at org.jboss.ejb3.Ejb3JmxDeployment.registerContainer(Ejb3JmxDeployment.java:154)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:295)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:277)
       at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:259)
       at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:230)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:217)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
       at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:330)
       at org.jboss.system.ServiceController.create(ServiceController.java:275)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy16.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      15:51:34,398 WARN [ServiceController] Problem creating service jboss.j2ee:module=beans.ejb3,uid=29289177,service=EJB3
      javax.management.InstanceAlreadyExistsException: jboss.j2ee:service=EJB3,name=beans.session.OptionsBean already registered.
       at org.jboss.mx.server.registry.BasicMBeanRegistry.add(BasicMBeanRegistry.java:755)
       at org.jboss.mx.server.registry.BasicMBeanRegistry.registerMBean(BasicMBeanRegistry.java:211)
       at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.server.MBeanServerImpl$3.run(MBeanServerImpl.java:1407)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:1402)
       at org.jboss.mx.server.MBeanServerImpl.registerMBean(MBeanServerImpl.java:361)
       at org.jboss.ejb3.Ejb3JmxDeployment.registerContainer(Ejb3JmxDeployment.java:154)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:295)
       at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:277)
       at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:259)
       at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:230)
       at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:217)
       at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
       at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
       at sun.reflect.GeneratedMethodAccessor30.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
       at $Proxy0.create(Unknown Source)
       at org.jboss.system.ServiceController.create(ServiceController.java:330)
       at org.jboss.system.ServiceController.create(ServiceController.java:275)
       at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy16.create(Unknown Source)
       at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:910)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
       at sun.reflect.GeneratedMethodAccessor14.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
      


      This makes sense, the first deployment already deployed the beans. However, if my first attempt at a shared bean deployment failed, and I cannot deploy them isolated from each other within ears, what other options do I have?

      Perhaps more specifically, if the first option was the correct way, why am I getting a ClassNotFound exception, especially if the classes are located in the JBoss/bin folder?

      Thanks for any response, I'm still relatively new to EJBs and struggling to figure all this out.

        • 1. Re: Multiple datasource deployment issue
          Shiung Yong Newbie

          I forgot to mention that everything works perfectly for single deployments. I only run into trouble when doing multiple deployments onto the same instance. Lastly, in the second scenario where I try to deploy two EARs each fully containing their needed classes, both applications end up working, but both access the first database deployed -- the database which corresponds to the successfully error-free first EAR deployed.

          • 2. Re: Multiple datasource deployment issue
            Shiung Yong Newbie

            I managed to get rid of the deployment exceptions, by not using the <jar-file> option in persistence.xml but instead just deploying the ejb3 file containing my entity and session beans into the deploy directory. Then, the skeleton persistence.xml file in my EARs has no problem finding the required classes. Now however, whenever I do a query on either database, I get no response whatsoever.

            No exception, no error, no nothing. It's as if every manager.createQuery("...").getResultList() always returns an empty list. The database log I have shows no accesses to either. I have both DBs setup in different -ds.xml files, JBoss shows both databases being registered to JNDI. Anyone know whats going on? Please help, thanks.

            • 3. Re: Multiple datasource deployment issue
              Shiung Yong Newbie

              I am still stuck on this. In my session bean, I print out a few lines of debug messages.

              09:10:25,481 INFO [STDOUT] Start check, does user exist?
              09:10:25,482 INFO [STDOUT] We are using manager: org.jboss.ejb3.entity.InjectedEntityManager@3d0d64
              09:10:25,500 INFO [STDOUT] Finished checking. User does not exist.
              09:10:39,313 INFO [STDOUT] Start check, does user exist?
              09:10:39,315 INFO [STDOUT] We are using manager: org.jboss.ejb3.entity.InjectedEntityManager@3d0d64
              09:10:39,332 INFO [STDOUT] Finished checking. User does not exist.

              In the first login attempt, I login from the first EAR's web context using a username/password combination that exists in the database. The manager's query returns an empty list, even though it should return a single result. The second login attempt is the same but I login from the second EAR's web context. Again an empty result. As seen above, the entity manager's toString() call prints out the exact same values for both EAR's. Am I somehow injecting the wrong entity manager? Perhaps a default entity manager which accesses a DB which is empty, hence the empty results?

              The session bean where the System.err.println code is above is shared by both EARs and in the deploy directory. Should it be somewhere else?

              If anyone has any advice, even if its only a guess, please let me know. I've been stuck on this for a while now. Thank you.

              • 4. Re: Multiple datasource deployment issue
                Shiung Yong Newbie

                Still stuck, but I found out that both EAR files are connecting to the DefaultDS hypersonic database that is setup with JBoss. How would I specify exactly what database each EAR should connect to? Here are the persistence.xml files within my skeleton ejb3 files within each EAR:

                <entity-manager>
                 <name>ContextRoot1</name>
                 <provider>org.hibernate.ejb.HibernatePersistence</provider>
                 <jta-data-source>java:/DB1</jta-data-source>
                 <non-jta-data-source>java:/DB1</non-jta-data-source>
                 <class>beans.entity.bean1</class>
                 <class>beans.entity.bean2</class>
                 <properties>
                 <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                 <property name="hibernate.hbm2ddl.auto" value="update"/>
                 <property name="hibernate.connection.datasource" value="java:/DB1"/>
                 </properties>
                </entity-manager>


                <entity-manager>
                 <name>ContextRoot2</name>
                 <provider>org.hibernate.ejb.HibernatePersistence</provider>
                 <jta-data-source>java:/DB2</jta-data-source>
                 <non-jta-data-source>java:/DB2</non-jta-data-source>
                 <class>beans.entity.bean1</class>
                 <class>beans.entity.bean2</class>
                 <properties>
                 <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/>
                 <property name="hibernate.hbm2ddl.auto" value="update"/>
                 <property name="hibernate.connection.datasource" value="java:/DB2"/>
                 </properties>
                </entity-manager>


                • 5. Re: Multiple datasource deployment issue
                  Cyril JOUI Newbie

                  Hello !

                  I have the same problems ...
                  Did anyone find any answer ?

                  Thanks.

                  • 6. Re: Multiple datasource deployment issue
                    Bill Burke Master

                    You need to set up a JBoss Datasource!!! DO NOT USE THE "hibernate.connection.datasource" property.

                    There are example DS files under: jboss/docs/examples/jca or check the JBoss App Server documentation.

                    • 7. Re: Multiple datasource deployment issue
                      Shiung Yong Newbie

                      Thank you for the reply Bill Burke. I already have two Postgre databases setup and registered as you suggested. They are both Postgre databases, and here are their configuration files:

                      db1-ds.xml:

                      <datasources>
                       <local-tx-datasource>
                       <jndi-name>DB1</jndi-name>
                       <connection-url>jdbc:postgresql://localhost:5432/db1</connection-url>
                       <driver-class>org.postgresql.Driver</driver-class>
                       <user-name>username</user-name>
                       <password>password</password>
                       <metadata>
                       <type-mapping>PostgreSQL 7.2</type-mapping>
                       </metadata>
                       </local-tx-datasource>
                      
                      </datasources>


                      db2-ds.xml
                      <datasources>
                       <local-tx-datasource>
                       <jndi-name>DB2</jndi-name>
                       <connection-url>jdbc:postgresql://localhost:5432/db2</connection-url>
                      
                       <driver-class>org.postgresql.Driver</driver-class>
                       <user-name>username</user-name>
                       <password>password</password>
                      
                       <metadata>
                       <type-mapping>PostgreSQL 7.2</type-mapping>
                       </metadata>
                       </local-tx-datasource>
                      </datasources>


                      Both -ds files are in my deploy directory. JBoss indicates they are registered to JNDI on startup. However, the problem still persists, both EAR files are connecting to the DefaultDS. In an attempt to troubleshoot the problem, I found that If I modify the default DS in the hibernate properties file at:

                      /JB)SS_HOME/server/all/deploy/ejb3.deployer/META-INF/persistence.properties

                      such that the following line:
                      hibernate.connection.datasource=java:/DefaultDS
                      

                      becomes:
                      hibernate.connection.datasource=java:/DB1
                      


                      then both EAR files connect to DB1. I am unable to get each EAR to connect to its own DB. Do you know what I am doing wrong?

                      Thank you again for your help.








                      • 8. Re: Multiple datasource deployment issue
                        Micha? ? Newbie

                        Hello!

                        Why are you putting Entity beans in ejb3 file? I think JBoss searches entities and persistence.xml in .par.

                        regards

                        blacky

                        • 9. Re: Multiple datasource deployment issue
                          Shiung Yong Newbie

                          As far as I know, the ".par" archive format used to be in the EJB3 spec but I read somewhere that it is not going to be in the final release. The ".ejb3" archive format is a JBoss specific version of the .par archive, and they are equivalent.

                          Anyways, I tried renaming the archives to have a .par extension, but the same problem persisted.

                          Here's my application.xml files:

                          <?xml version="1.0" encoding="UTF-8"?>
                          <application xmlns="http://java.sun.com/xml/ns/j2ee"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                          http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
                          version="1.4">
                           <module>
                           <web>
                           <web-uri>ROOT.war</web-uri>
                           <context-root>/Context1</context-root>
                           </web>
                           </module>
                           <module>
                           <java>HelperClasses.jar</java>
                           </module>
                           <module>
                           <ejb>entities.ejb3</ejb>
                           </module>
                          </application>


                          <?xml version="1.0" encoding="UTF-8"?>
                          <application xmlns="http://java.sun.com/xml/ns/j2ee"
                          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                          http://java.sun.com/xml/ns/j2ee/application_1_4.xsd"
                          version="1.4">
                           <module>
                           <web>
                           <web-uri>ROOT.war</web-uri>
                           <context-root>/Context2</context-root>
                           </web>
                           </module>
                           <module>
                           <java>HelperClasses.jar</java>
                           </module>
                           <module>
                           <ejb>entities.ejb3</ejb>
                           </module>
                          </application>


                          • 10. Re: Multiple datasource deployment issue
                            Bill Burke Master

                             

                            "yxw84" wrote:
                            such that the following line:
                            hibernate.connection.datasource=java:/DefaultDS
                            

                            becomes:
                            hibernate.connection.datasource=java:/DB1
                            


                            then both EAR files connect to DB1. I am unable to get each EAR to connect to its own DB. Do you know what I am doing wrong?

                            Thank you again for your help.


                            Remove the hibernate.connection.datasource from persistence.properties

                            • 11. Re: Multiple datasource deployment issue
                              Cyril JOUI Newbie

                              Hello !

                              I have the same problem ..
                              To try to resolve it I do the following things :
                              I use the name attribute of SessionBean Annotation with a @AppName@ like this :
                              @Stateless(name="@AppName@IAdminService")

                              in the persistence.xml :
                              @AppName@mainEM

                              With Ant I copy all my sources to a temp directory before compiling and group all files into .ejb3 file.

                              So I have two applications with the same code but with 2 differents AppName !

                              I can deploy the both application but only last application I deployed work the other crash when I try to access to SessionBean which uses dependance injection.
                              I have this exception :

                              java.lang.RuntimeException: Non matching type for inject of field: protected com.labosun.sessions.dao.ICategoryDao com.labosun.sessions.bean.PublicService.categoryDao for type: $Proxy176
                               at org.jboss.ejb3.injection.JndiFieldInjector.inject(JndiFieldInjector.java:58)
                               at org.jboss.ejb3.AbstractPool.create(AbstractPool.java:59)
                               at org.jboss.ejb3.ThreadlocalPool.get(ThreadlocalPool.java:33)
                               at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:36)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
                               at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:63)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
                               at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:32)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
                               at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:91)
                               at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
                               at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:148)
                               at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:60)
                               at $Proxy175.setLanguage(Unknown Source)
                               at com.labosun.application.factories.ServiceFactory.getPublicService(Unknown Source)
                               at com.labosun.application.struts.actions.pub.resource.list.DisplayAction.delegateExecute(Unknown Source)
                               at com.labosun.application.struts.actions.BaseAction.execute(Unknown Source)
                               at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
                               at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
                               at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
                               at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:397)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
                               at com.labosun.application.servlet.MainActionServlet.service(Unknown Source)
                               at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at com.labosun.application.filters.SetCharacterEncodingFilter.doFilter(Unknown Source)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at com.labosun.application.filters.SetHttpAttributesFilter.doFilter(Unknown Source)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
                               at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                               at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                               at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                               at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
                               at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
                               at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
                               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
                               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
                               at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                               at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                               at java.lang.Thread.run(Unknown Source)
                              Caused by: java.lang.IllegalArgumentException
                               at sun.reflect.UnsafeObjectFieldAccessorImpl.set(Unknown Source)
                               at java.lang.reflect.Field.set(Unknown Source)
                               at org.jboss.ejb3.injection.JndiFieldInjector.inject(JndiFieldInjector.java:52)
                              


                              My @EJB injector :
                              @EJB(name = "@AppName@IUserDao")
                              


                              I think it's a bug of JBoss no ?

                              I haven't found any solution until now... :(

                              Cyril


                              • 12. Re: Multiple datasource deployment issue
                                Shiung Yong Newbie

                                Thanks for the assistance so far. Following your suggestion Bill Burke, I get an exception while deploying just the shared entity/session bean ejb3 archive.

                                09:20:11,276 ERROR [Ejb3Module] Initialization failed jboss.j2ee:service=EJB3,module=beans.ejb3
                                java.lang.NullPointerException
                                 at javax.naming.InitialContext.getURLScheme(InitialContext.java:228)
                                 at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:277)
                                 at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                 at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:458)
                                 at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:219)
                                 at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
                                 at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
                                 at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
                                 at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                                 at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
                                 at $Proxy0.create(Unknown Source)
                                 at org.jboss.system.ServiceController.create(ServiceController.java:330)
                                 at org.jboss.system.ServiceController.create(ServiceController.java:275)
                                 at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                 at $Proxy16.create(Unknown Source)
                                 at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
                                 at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
                                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
                                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
                                 at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                                 at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                                 at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                 at $Proxy8.deploy(Unknown Source)
                                 at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
                                 at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
                                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
                                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
                                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
                                09:20:11,278 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB3,module=beans.ejb3
                                java.lang.NullPointerException
                                 at javax.naming.InitialContext.getURLScheme(InitialContext.java:228)
                                 at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:277)
                                 at javax.naming.InitialContext.lookup(InitialContext.java:351)
                                 at org.jboss.ejb3.Ejb3Deployment.initializeManagedEntityManagerFactory(Ejb3Deployment.java:458)
                                 at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:219)
                                 at org.jboss.ejb3.Ejb3Module.createService(Ejb3Module.java:34)
                                 at org.jboss.system.ServiceMBeanSupport.jbossInternalCreate(ServiceMBeanSupport.java:238)
                                 at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:220)
                                 at sun.reflect.GeneratedMethodAccessor76.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                                 at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:897)
                                 at $Proxy0.create(Unknown Source)
                                 at org.jboss.system.ServiceController.create(ServiceController.java:330)
                                 at org.jboss.system.ServiceController.create(ServiceController.java:275)
                                 at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:72)
                                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                 at $Proxy16.create(Unknown Source)
                                 at org.jboss.ejb3.EJB3Deployer.create(EJB3Deployer.java:178)
                                 at org.jboss.deployment.MainDeployer.create(MainDeployer.java:918)
                                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:774)
                                 at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:738)
                                 at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
                                 at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
                                 at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:121)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                                 at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
                                 at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
                                 at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:249)
                                 at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:644)
                                 at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:177)
                                 at $Proxy8.deploy(Unknown Source)
                                 at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:325)
                                 at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:501)
                                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:204)
                                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:215)
                                 at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:194)
                                09:20:11,289 INFO [EJB3Deployer] Deployed: file:/usr/local/jboss-4.0.2/server/all/deploy/beans.ejb3
                                09:20:11,306 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
                                
                                --- MBeans waiting for other MBeans ---
                                ObjectName: jboss.j2ee:service=EJB3,module=beans.ejb3
                                 State: FAILED
                                 Reason: java.lang.NullPointerException
                                
                                --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
                                ObjectName: jboss.j2ee:service=EJB3,module=beans.ejb3
                                 State: FAILED
                                 Reason: java.lang.NullPointerException
                                


                                For reference, here is my persistence.properties after the change:
                                hibernate.transaction.manager_lookup_class=org.hibernate.transaction.JBossTransactionManagerLookup
                                hibernate.connection.release_mode=after_statement
                                hibernate.transaction.flush_before_completion=false
                                hibernate.transaction.auto_close_session=false
                                hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory
                                hibernate.hbm2ddl.auto=create-drop
                                #hibernate.hbm2ddl.auto=create
                                hibernate.cache.provider_class=org.hibernate.cache.HashtableCacheProvider
                                # Clustered cache with TreeCache
                                #hibernate.cache.provider_class=org.jboss.ejb3.entity.TreeCacheProviderHook
                                #hibernate.treecache.mbean.object_name=jboss.cache:service=EJB3EntityTreeCache
                                #hibernate.connection.datasource=java:/DefaultDS
                                hibernate.dialect=org.hibernate.dialect.HSQLDialect
                                hibernate.jndi.java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
                                hibernate.jndi.java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
                                


                                • 13. java.lang.RuntimeException: Non matching type for inject of
                                  ramana Newbie

                                  Hi,
                                  Please did anyone solve it

                                  java.lang.RuntimeException: Non matching type for inject of field

                                  I am using straight forward ejb3 beans, and injecting anohter ejb interface with @EJB annotation..

                                  Thanks in advance,
                                  jelda

                                  • 14. Re: Multiple datasource deployment issue
                                    Shiung Yong Newbie

                                    Sorry to keep bothering on this subject... but has anyone got any insight into what might be causing the problem? I put the problem on the shelf for a few months because I got badly stuck, but eventually its an issue I will need to resolve. Please help! Thank you.