1 Reply Latest reply on Feb 23, 2007 5:01 PM by Andrew San Clemente

    Problems Deploying using JTA, Hibernate 3.1, Jboss 4.0.5

    Andrew San Clemente Newbie

      I have been struggling to get a simple test application that has one entity bean and one stateless session bean to deploy. I am using Hibernate 3.1, Jboss 4.0.5GA, and EJB3.0 annotations. I have scoured the net and found nothing like the errors I am getting. I have setup my defaultDS in my jboss server and sucessfully connected to and used this datasource when accessing from a seperate client so I know my datasource is properly configured in jboss. I now want to deploy my simple ejb.jar so that I can access the session bean from the client and use the container managed transactions and connection pool.
      When I attempt to deploy my simple ear with the entity and session bean, I get the following error :

      [ServiceController] Problem starting service persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS
      javax.persistence.PersistenceException: org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.transaction.JTATransactionFactory


      I have googled endlessly for everything to do with that error and found nothing. I have also turned on full debugging of the jboss server and it is still the same error and info, nothing new. This is making me crazy since I know it's something simple and I have wasted a lot of time on it, help greatly appreciated.

      Here is my persistence.xml :

      <?xml version='1.0' encoding='utf-8'?>
      <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
       <persistence-unit name="devDS" transaction-type="JTA">
       <jta-data-source>java:/DefaultDS</jta-data-source>
       <properties>
       <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
       <property name="format_sql" value="true"/>
       <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
       <property name="hibernate.transaction.factory.class" value="org.hibernate.transaction.JTATransactionFactory"/>
       <property name="transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>
       <property name="cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider"/>
       </properties>
       </persistence-unit>
      </persistence>
      


      Here is my ejb-jar.xml :
      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar
       xmnls="http://java.sun.com/xml/ns/javaee"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-Instance"
       xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd"
       version="3.0">
       <enterprise-beans>
       <session>
       <display-name>HoneyEJB</display-name>
       <ejb-name>HoneyBean</ejb-name>
       <ejb-class>com.dh.session.HoneyBean</ejb-class>
       <local>com.dh.session.HoneyLocal</local>
       <remote>com.dh.session.HoneyRemote</remote>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       <env-entry>
       <env-entry-name>maxusers</env-entry-name>
       <env-entry-type>java.lang.Integer</env-entry-type>
       <env-entry-value>5</env-entry-value>
       <injection-target>
       <injection-target-class>com.dh.session.HoneyBean</injection-target-class>
       <injection-target-name>maxUsers</injection-target-name>
       </injection-target>
       </env-entry>
       </session>
       </enterprise-beans>
      </ejb-jar>
      
      


      Here is my jboss.xml file :

      <?xml version="1.0"?>
      <jboss>
       <enterprise-beans>
       <session>
       <ejb-name>HoneyBean</ejb-name>
       <jndi-name>Honey</jndi-name>
       </session>
       </enterprise-beans>
      </jboss>
      


      And here is the full console output of the deployment :

      15:58:24,857 INFO [EARDeployer] Init J2EE application: file:/tools/jboss-4.0.5.GA/server/dev/deploy/Honey-APP.ear
      15:58:26,012 INFO [Ejb3Deployment] EJB3 deployment time took: 1021
      15:58:26,061 INFO [JmxKernelAbstraction] installing MBean: persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS with dependencies:
      15:58:26,062 INFO [JmxKernelAbstraction] jboss.jca:name=DefaultDS,service=DataSourceBinding
      15:58:26,223 INFO [Version] Hibernate EntityManager 3.2.0.GA
      15:58:26,294 INFO [Version] Hibernate Annotations 3.2.0.GA
      15:58:26,321 INFO [Environment] Hibernate 3.2.0.ga
      15:58:26,357 INFO [Environment] hibernate.properties not found
      15:58:26,366 INFO [Environment] Bytecode provider name : javassist
      15:58:26,383 INFO [Environment] using JDK 1.4 java.sql.Timestamp handling
      15:58:26,842 INFO [Ejb3Configuration] found EJB3 Entity bean: com.dh.entity.Honey
      15:58:26,863 WARN [Ejb3Configuration] Persistence provider caller does not implements the EJB3 spec correctly. PersistenceUnitInfo.getNewTempClassLoader() is null.
      15:58:27,049 INFO [Configuration] Reading mappings from resource: META-INF/orm.xml
      15:58:27,073 INFO [Ejb3Configuration] [PersistenceUnit: devDS] no META-INF/orm.xml found
      15:58:27,263 INFO [AnnotationBinder] Binding entity from annotated class: com.dh.entity.Honey
      15:58:27,398 INFO [EntityBinder] Bind entity com.dh.entity.Honey on table thoney
      15:58:27,879 INFO [ConnectionProviderFactory] Initializing connection provider: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider
      15:58:27,888 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
      15:58:27,891 INFO [SettingsFactory] RDBMS: MySQL, version: 5.0.26-standard-log
      15:58:27,892 INFO [SettingsFactory] JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.4 ( $Date: 2006-10-19 17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )
      15:58:27,958 INFO [Dialect] Using dialect: org.hibernate.dialect.MySQLInnoDBDialect
      15:58:28,001 INFO [TransactionFactoryFactory] Transaction strategy: org.hibernate.ejb.transaction.JoinableCMTTransactionFactory
      15:58:28,011 INFO [TransactionManagerLookupFactory] instantiating TransactionManagerLookup: org.hibernate.transaction.JBossTransactionManagerLookup
      15:58:28,019 INFO [TransactionManagerLookupFactory] instantiated TransactionManagerLookup
      15:58:28,025 INFO [SettingsFactory] Automatic flush during beforeCompletion(): disabled
      15:58:28,026 INFO [SettingsFactory] Automatic session close at end of transaction: disabled
      15:58:28,026 INFO [SettingsFactory] JDBC batch size: 15
      15:58:28,027 INFO [SettingsFactory] JDBC batch updates for versioned data: disabled
      15:58:28,032 INFO [SettingsFactory] Scrollable result sets: enabled
      15:58:28,033 INFO [SettingsFactory] JDBC3 getGeneratedKeys(): enabled
      15:58:28,033 INFO [SettingsFactory] Connection release mode: auto
      15:58:28,036 INFO [SettingsFactory] Maximum outer join fetch depth: 2
      15:58:28,037 INFO [SettingsFactory] Default batch fetch size: 1
      15:58:28,038 INFO [SettingsFactory] Generate SQL with comments: disabled
      15:58:28,038 INFO [SettingsFactory] Order SQL updates by primary key: disabled
      15:58:28,039 INFO [SettingsFactory] Query translator: org.hibernate.transaction.JTATransactionFactory
      15:58:28,050 WARN [ServiceController] Problem starting service persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS
      javax.persistence.PersistenceException: org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.transaction.JTATransactionFactory
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:698)
      at org.hibernate.ejb.HibernatePersistence.createContainerEntityManagerFactory(HibernatePersistence.java:127)
      at org.jboss.ejb3.entity.PersistenceUnitDeployment.start(PersistenceUnitDeployment.java:264)
      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.ejb3.ServiceDelegateWrapper.startService(ServiceDelegateWrapper.java:102)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy56.start(Unknown Source)
      at org.jboss.ejb3.JmxKernelAbstraction.install(JmxKernelAbstraction.java:96)
      at org.jboss.ejb3.Ejb3Deployment.startPersistenceUnits(Ejb3Deployment.java:467)
      at org.jboss.ejb3.Ejb3Deployment.start(Ejb3Deployment.java:317)
      at org.jboss.ejb3.Ejb3Module.startService(Ejb3Module.java:91)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
      at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
      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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
      at $Proxy0.start(Unknown Source)
      at org.jboss.system.ServiceController.start(ServiceController.java:417)
      at sun.reflect.GeneratedMethodAccessor9.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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy28.start(Unknown Source)
      at org.jboss.ejb3.EJB3Deployer.start(EJB3Deployer.java:449)
      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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
      at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
      at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
      at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
      at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy29.start(Unknown Source)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
      at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
      at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
      at sun.reflect.GeneratedMethodAccessor19.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:155)
      at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
      at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
      at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
      at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
      at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
      at $Proxy8.deploy(Unknown Source)
      at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
      at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
      at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      Caused by: org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.transaction.JTATransactionFactory
      at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(SettingsFactory.java:374)
      at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:209)
      at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1933)
      at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1216)
      at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:691)
      ... 101 more
      Caused by: java.lang.ClassCastException: org.hibernate.transaction.JTATransactionFactory
      at org.hibernate.cfg.SettingsFactory.createQueryTranslatorFactory(SettingsFactory.java:371)
      ... 105 more
      15:58:28,414 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:ear=Honey-APP.ear,jar=Honey-EJB.jar,name=HoneyBean,service=EJB3 with dependencies:
      15:58:28,415 INFO [JmxKernelAbstraction] persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS
      15:58:28,433 INFO [EJB3Deployer] Deployed: file:/tools/jboss-4.0.5.GA/server/dev/tmp/deploy/tmp38424Honey-APP.ear-contents/Honey-EJB.jar
      15:58:28,454 INFO [EARDeployer] Started J2EE application: file:/tools/jboss-4.0.5.GA/server/dev/deploy/Honey-APP.ear
      15:58:28,460 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

      --- MBeans waiting for other MBeans ---
      ObjectName: persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS
      State: FAILED
      Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.transaction.JTATransactionFactory
      I Depend On:
      jboss.jca:service=DataSourceBinding,name=DefaultDS
      Depends On Me:
      jboss.j2ee:ear=Honey-APP.ear,jar=Honey-EJB.jar,name=HoneyBean,service=EJB3

      ObjectName: jboss.j2ee:ear=Honey-APP.ear,jar=Honey-EJB.jar,name=HoneyBean,service=EJB3
      State: NOTYETINSTALLED
      I Depend On:
      persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS

      --- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
      ObjectName: persistence.units:ear=Honey-APP.ear,jar=Honey-EJB.jar,unitName=devDS
      State: FAILED
      Reason: javax.persistence.PersistenceException: org.hibernate.HibernateException: could not instantiate QueryTranslatorFactory: org.hibernate.transaction.JTATransactionFactory
      I Depend On:
      jboss.jca:service=DataSourceBinding,name=DefaultDS
      Depends On Me:
      jboss.j2ee:ear=Honey-APP.ear,jar=Honey-EJB.jar,name=HoneyBean,service=EJB3

        • 1. Re: Problems Deploying using JTA, Hibernate 3.1, Jboss 4.0.5
          Andrew San Clemente Newbie

          As a desperation measure, I reiinstalled the jboss AS and then tried again. This time no errors, the difference I noticed is that the following class was being used for Query Translation :

          org.hibernate.hql.ast.ASTQueryTranslatorFactory

          instead of this one in my original post :

          org.hibernate.transaction.JTATransactionFactory

          I have no idea why the change occured, I am using the installer and believe I did everything the same - but obviously that must not be the case.
          So guess it's case closed.