-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate 2.2.3 + Activiti + JPA issue
PostPosted: Tue Nov 19, 2013 5:41 am 
Newbie

Joined: Tue Nov 19, 2013 5:12 am
Posts: 1
Hi ,
i'm using in a spring-based application :
Hibernate 2.2.3 Final
Spring 3.2.2. RELEASE
Activiti 5.13
springDataJpa 1.4.1.RELEASE.

My entityManager configuration from root-context.xml :
Code:
   <context:annotation-config />
   
   <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
      <property name="jndiName" value="java:/comp/env/jdbc/DefaultDB" />
   </bean>

   <bean id="multiTenantIdentifierResolver" class="it.sydema.laweb.utils.MultiTenantIdentifierResolver">
      <property name="defaultTenant" value="default" />
      <property name="tenants">
         <map>
            <entry key="default" value="DefaultDB" />
            <entry key="alternative" value="AlternativeDB" />
         </map>
      </property>
   </bean>
   
   <bean id="entityManagerFactory"
      class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="jpaVendorAdapter">
         <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" />
      </property>
      <property name="jpaPropertyMap">
         <map>
            <entry key="hibernate.show_sql" value="true" />
            <entry key="hibernate.use_sql_comments" value="true" />
            <entry key="hibernate.format_sql" value="true" />
            <entry key="hibernate.dialect" value="it.sydema.laweb.utils.SQLServerDialectEx" />
            <entry key="hibernate.connection.datasource" value="java:/comp/env/jdbc/DefaultDB" />
            <entry key="hibernate.multiTenancy" value="DATABASE" />
            <entry key="hibernate.tenant_identifier_resolver">
               <ref bean="multiTenantIdentifierResolver" />
            </entry>
            <entry key="org.hibernate.envers.store_data_at_delete" value="true" />
            <entry key="hibernate.cache.region.factory_class"
               value="org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory" />
            <entry key="hibernate.cache.use_second_level_cache" value="true" />
            <entry key="hibernate.cache.use_query_cache" value="true" />
            <entry key="net.sf.ehcache.configurationResourceName" value="/ehcache.xml" />
      </map>
      </property>
      <property name="dataSource" ref="dataSource" />
   </bean>

   <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
   </bean>

   <tx:annotation-driven transaction-manager="transactionManager" />


Activiti configuration from activiti-context.xml


Code:
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
   
   <property name="databaseType" value="mssql" /> 
     <property name="dataSource" ref="dataSource" />
     <property name="transactionManager" ref="transactionManager" />
     
     <property name="databaseSchemaUpdate" value="false" />
     <property name="jobExecutorActivate" value="false" />
     <property name="jpaEntityManagerFactory" ref="entityManagerFactory" />
    <property name="jpaHandleTransaction" value="true" />
    <property name="jpaCloseEntityManager" value="true" />
   
    <property name="mailServerHost" value="localhost" />
    <property name="mailServerPort" value="5025" />
    <property name="customFormTypes">
      <list>
        <bean class="org.activiti.explorer.form.UserFormType"/>
        <bean class="org.activiti.explorer.form.ProcessDefinitionFormType"/>
        <bean class="org.activiti.explorer.form.MonthFormType"/>   
        <bean class="it.sydema.laweb.activiti.FormTypeAmount" />
        <bean class="it.sydema.laweb.activiti.FormTypeDecimal" />
        <bean class="it.sydema.laweb.activiti.FormTypeInteger"/>
        <bean class="it.sydema.laweb.activiti.FormTypeText"/>
        <bean class="it.sydema.laweb.activiti.FormTypeEntity"/>
        <bean class="it.sydema.laweb.activiti.FormTypeValidationRule"/>
      </list>
    </property>
    <!-- property for custom user and groups --> 
     <property name="customSessionFactories">
        <list>
        <bean class="it.sydema.laweb.activiti.CustomUserManagerFactory">
         <constructor-arg ref="MyConnectionParams" />
      </bean>               
      <bean class="it.sydema.laweb.activiti.CustomGroupManagerFactory">
             <constructor-arg ref="MyConnectionParams" />               
       </bean>
      </list>
   </property>
</bean>       

<bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
   <property name="processEngineConfiguration" ref="processEngineConfiguration" />
</bean>


When i try to start the application i get this error:

Code:
nov 19, 2013 10:33:09 AM org.apache.catalina.core.StandardContext listenerStart
Grave: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'activitiController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.activiti.engine.ProcessEngine it.sydema.laweb.controllers.ActivitiController.processEngine; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.springframework.orm.hibernate3.HibernateSystemException: commit failed; nested exception is org.hibernate.TransactionException: commit failed
   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
   at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
   at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
   at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
   at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
   at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)
   at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)
   at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)
   at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4791)
   at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5285)
   at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
   at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
   at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
   at java.util.concurrent.FutureTask.run(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: org.activiti.engine.ProcessEngine it.sydema.laweb.controllers.ActivitiController.processEngine; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.springframework.orm.hibernate3.HibernateSystemException: commit failed; nested exception is org.hibernate.TransactionException: commit failed
   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)
   at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)
   ... 23 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine': FactoryBean threw exception on object creation; nested exception is org.springframework.orm.hibernate3.HibernateSystemException: commit failed; nested exception is org.hibernate.TransactionException: commit failed
   at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:149)
   at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1454)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:306)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:912)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:855)
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)
   at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)
   ... 25 more
Caused by: org.springframework.orm.hibernate3.HibernateSystemException: commit failed; nested exception is org.hibernate.TransactionException: commit failed
   at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:690)
   at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:104)
   at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:516)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:755)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:724)
   at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:148)
   at org.activiti.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:40)
   at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
   at org.activiti.engine.impl.ProcessEngineImpl.<init>(ProcessEngineImpl.java:76)
   at org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:365)
   at org.activiti.spring.SpringProcessEngineConfiguration.buildProcessEngine(SpringProcessEngineConfiguration.java:64)
   at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:56)
   at org.activiti.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:32)
   at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142)
   ... 33 more
Caused by: org.hibernate.TransactionException: commit failed
   at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:185)
   at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:75)
   at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:512)
   ... 44 more
Caused by: org.hibernate.TransactionException: unable to commit against JDBC connection
   at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:116)
   at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:178)
   ... 46 more
Caused by: java.sql.SQLException: Connection is closed.
   at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.checkOpen(PoolingDataSource.java:185)
   at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.commit(PoolingDataSource.java:210)
   at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.doCommit(JdbcTransaction.java:112)
   ... 47 more


From the activiti forum (http://forums.activiti.org/content/spring-data-jpa-activiti-error) i know that there's an issue with the Hibernate version after 4.1.9.Final.

Using 4.1.9.Final everything works fine but i must use the latest Hibernate version.

I've already tried Hibernate 4.2.7.SP1 without any changes.

Any help would be much appreciated.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.