com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory cannot be cast to org.hibernate.resource.transaction.TransactionCoordinatorBuilder - spring

Trying to connect two different datasources with the Atomikos transaction manager getting the below error
Caused by: java.lang.ClassCastException: com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory cannot be cast to org.hibernate.resource.transaction.TransactionCoordinatorBuilder
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
<bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="location" value="classpath:Application.properties" />
</bean>
<bean id="oracleSessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="oraclesDataSource" />
<property name="mappingResources">
<list>
<value>persons.hbm.xml </value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<!-- <prop key="hibernate.autocommit">true</prop>
<prop key="hibernate.connection.isolation">3</prop> -->
<prop key="hibernate.current_session_context_class">jta</prop>
<prop key="hibernate.transaction.factory_class">
com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory
</prop>
<prop key="hibernate.transaction.manager_lookup_class">
com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup
</prop>
<!-- <prop key="hibernate.current_session_context_class">thread</prop> -->
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.max_size">10</prop>
<prop key="hibernate.c3p0.timeout">300</prop>
</props>
</property>
</bean>
<bean id="mysqlSessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="mysqlDataSource" />
<property name="mappingResources">
<list>
<value>persons.hbm.xml </value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<!-- <prop key="hibernate.autocommit">ture</prop>
<prop key="hibernate.connection.isolation">3</prop> -->
<prop key="hibernate.current_session_context_class">jta</prop>
<prop key="hibernate.transaction.factory_class">
com.atomikos.icatch.jta.hibernate3.AtomikosJTATransactionFactory
</prop>
<prop key="hibernate.transaction.manager_lookup_class">
com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup
</prop>
<!-- <prop key="hibernate.current_session_context_class">thread</prop> -->
<prop key="hibernate.c3p0.min_size">5</prop>
<prop key="hibernate.c3p0.max_size">10</prop>
<prop key="hibernate.c3p0.timeout">300</prop>
</props>
</property>
</bean>
<tx:annotation-driven proxy-target-class="true" />
<tx:jta-transaction-manager
transaction-manager="atomikosTransactionManager" />
<tx:annotation-driven transaction-manager="atomikosTransactionManager"
proxy-target-class="true" />
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<property name="forceShutdown" value="false" />
</bean>
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.J2eeUserTransaction">
<property name="transactionTimeout" value="300" />
</bean>
<tx:annotation-driven />
<bean id="transactionManager"
class="org.springframework.transaction.jta.JtaTransactionManager"
depends-on="atomikosTransactionManager,atomikosUserTransaction">
<property name="transactionManager" ref="atomikosTransactionManager" />
<property name="userTransaction" ref="atomikosUserTransaction" />
<!-- <property name="allowCustomIsolationLevels" value="true" /> -->
</bean>
<bean id="mysqlDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName">
<value>mySqlDataSource</value>
</property>
<property name="xaDataSourceClassName">
<value>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</value>
</property>
<property name="xaProperties">
<props>
<prop key="databaseName">sys</prop>
<prop key="serverName">localhost</prop>
<prop key="port">3306</prop>
<prop key="user">root</prop>
<prop key="password">magesh123</prop>
<prop key="url">jdbc:mysql://localhost:3306/sys</prop>
</props>
</property>
<property name="minPoolSize">
<value>1</value>
</property>
</bean>
<bean id="oraclesDataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
init-method="init" destroy-method="close">
<property name="uniqueResourceName">
<value>OracleDataSource</value>
</property>
<property name="xaDataSourceClassName">
<value>oracle.jdbc.xa.client.OracleXADataSource</value>
</property>
<property name="xaProperties">
<props>
<prop key="databaseName">XE</prop>
<prop key="serverName">localhost</prop>
<!-- <prop key="port">1521</prop> -->
<prop key="user">system</prop>
<prop key="password">magesh123</prop>
<prop key="URL">jdbc:oracle:thin:#localhost:1521:XE</prop>
</props>
</property>
<property name="minPoolSize">
<value>1</value>
</property>
</bean>
<bean id="persons" class="com.bnym.aal.poc.spring_jta.Persons">
</bean>
<bean id="App" class="com.bnym.aal.poc.spring_jta.App">
<property name="springJtaDaoClass" ref="springJtaDaoClass" />
</bean>
<bean id="springJtaDaoClass" class="com.bnym.aal.poc.spring_jta.springJtaDaoClass">
<property name="oracleSessionFactory" ref="oracleSessionFactory" />
<property name="mysqlSessionFactory" ref="mysqlSessionFactory" />
<property name="atomikosTransactionManager" ref="transactionManager" />
<property name="persons" ref="persons" />
</bean>

Changed my hibernate transaction manager to below one and the Transaction manager worked
<prop key="hibernate.transaction.factory_class">
org.hibernate.transaction.CMTTransactionFactory
</prop>
Please refer to the below Git url for the POC on the Atomikos transaction manager for the out of box integration of the Spring - JTA
https://github.com/mageshsrinivasulu/spring-jta.git

Related

FATAL: database "dbName/" does not exist

I am using Spring 4.3.9, Hibernate 5.4.1 with PostgresQL 9.3.
When I start tomcat container using ./catalina.sh run. I get below error in the log file.
org.postgresql.util.PSQLException: FATAL: database "emgda/" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2559)
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:133)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:250)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
at org.postgresql.Driver.makeConnection(Driver.java:454)
at org.postgresql.Driver.connect(Driver.java:256)
at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:135)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
Though the database along with data exists. Below are the configurations.
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource" destroy-method="close">
<property name="driverClass" value="org.postgresql.Driver"/>
<property name="jdbcUrl" value="jdbc:postgresql://192.168.1.230:5432/emgda/"/>
<property name="user" value="user"/>
<property name="password" value="some_password"/>
<property name="minPoolSize" value="20"/>
<property name="maxPoolSize" value="50"/>
<property name="breakAfterAcquireFailure" value="false"/>
<property name="acquireRetryAttempts" value="3"/>
<property name="idleConnectionTestPeriod" value="300"/>
<property name="testConnectionOnCheckout" value="true"/>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.cache.use_second_level_cache">false</prop>
<prop key="hibernate.cache.use_query_cache">false</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">ehcache.xml</prop>
<prop key="hibernate.cache.region.factory_class">net.sf.ehcache.hibernate.SingletonEhCacheRegionFactory</prop>
<prop key="hibernate.generate_statistics">false</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="annotatedClasses">
<list>
<value>com.emg.server.db.Apps</value>
</list>
</property>
</bean>
<bean id="emgDaoSupport" class="com.emg.server.db.EMGDaoSupport">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
</beans>
Remove last "/" on jdbc:postgresql://192.168.1.230:5432/emgda/,

java.naming.provider.url in <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> using YAML

jms.java.naming.provider.url is NOT getting value from application.yaml
<bean id="yamlProperties" class="org.springframework.beans.factory.config.YamlPropertiesFactoryBean">
<property name="resources" value="classpath:application.yaml"/>
</bean>
<context:property-placeholder properties-ref="yamlProperties"/>
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">string-works</prop>
<prop key="java.naming.provider.url">${jms.java.naming.provider.url}</prop>
</props>
</property>
</bean>

BeanCurrentlyInCreationException: Error creating bean with name 'scrService'

I am getting following Error, for my spring ioc container definition. It basically has a Spring Quartz Scheduler Bean Definition.
This is the final root cause of the error.
Caused by: org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'scrService': org.springframework.beans.factory.FactoryBeanNotInitializedException: FactoryBean is not fully initialized yet
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:170) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:126) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1467) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:246) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) [spring-beans-3.2.13.RELEASE.jar:3.2.13.RELEASE]
... 114 more
Here is ApplicationContext-beans.xml configuration
<bean id="scheduler"
class="org.springframework.scheduling.quartz.SchedulerFactoryBean"
destroy-method="destroy">
<property name="schedulerName">
<value>${org.quartz.scheduler.instanceName}</value>
</property>
<property name="autoStartup" value="true" />
<property name="startupDelay" value="10" />
<!-- To prevent picking up jobs from the database, please remove the line below -->
<property name="dataSource" ref="dataSource" />
<property name="transactionManager" ref="transactionManager"/>
<property name="taskExecutor" ref="senderTaskExecutor" />
<property name="waitForJobsToCompleteOnShutdown" value="true"></property>
<property name="quartzProperties">
<props>
<prop key="org.quartz.scheduler.instanceId">
${org.quartz.scheduler.instanceId}
</prop>
<!-- add key="org.quartz.jobStore.class" with value "org.quartz.simpl.RAMJobStore" for an in memory scheduler -->
<!-- Remove the 3 lines below for an in memory scheduler -->
<prop key="org.quartz.jobStore.driverDelegateClass">
${org.quartz.jobStore.driverDelegateClass}
</prop>
<prop key="org.quartz.jobStore.isClustered">
${org.quartz.jobStore.isClustered}
</prop>
<prop
key="org.quartz.jobStore.clusterCheckinInterval">
${org.quartz.jobStore.clusterCheckinInterval}
</prop>
<prop key="org.quartz.jobStore.useProperties">
${org.quartz.jobStore.useProperties}
</prop>
</props>
</property>
<property name="schedulerContextAsMap">
<map>
<!--<entry key="scrService">
<ref bean="scrService" />
</entry>-->
<entry key="numberLevelService">
<ref bean="numberLevelService" />
</entry>
<!--
...
-->
</map>
</property>
</bean>
<!--
...
-->
<bean id="scrService" parent="baseServiceTransactionProxy">
<property name="target" ref="scrServiceTarget"></property>
</bean> <!--abstract does not have Impl associated for scrServiceTarget or some problem-->
<bean id="numberLevelService" class="com.ding.dong.NumberLevelControllerImpl" factory-method="getInstance" lazy-init="true">
<constructor-arg ref="dataSource"></constructor-arg>
</bean>
<bean id="scrServiceTarget"
class="com.ding.dong.scrServiceImpl">
<property name="pageSizeFactor">
<value>${service.sender.pageSizeFactor}</value>
</property>
<property name="tpsFactor">
<value>${service.sender.tpsFactor}</value>
</property>
<property name="scrDao" ref="scrDao"></property>
<property name="scrRuntimeDao" ref="scrRuntimeDao"></property>
<property name="scrReportDao" ref="scrReportDao"></property>
<property name="scrTemplateDao"
ref="scrTemplateDao">
</property>
<property name="schedulerService" ref="schedulerService"></property>
<property name="shortCodeManagerService"
ref="shortCodeManagerService">
</property>
<property name="userRoleService" ref="userRoleService"></property>
<!-- To prevent connecting to JMS, please remove the line below -->
<property name="messageSenderService"
ref="messageSenderService">
</property>
</bean>
<bean id="baseServiceTransactionProxy"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
abstract="true">
<property name="transactionManager" ref="transactionManager" />
<property name="transactionAttributes">
<props>
<prop key="scheduleSCR">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="removeScheduledSCR">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="extendInProgressSCR">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="stopInProgressSCR">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="retrieveSCRForExecution">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="updateSCRState">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="process*">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="updateMessageLogForContestWinners">
PROPAGATION_REQUIRED,-SCRServiceRuntimeException
</prop>
<prop key="retrieveSCR">
PROPAGATION_REQUIRED,readOnly
</prop>
<prop key="retrieveTemplate">
PROPAGATION_REQUIRED,readOnly
</prop>
<prop key="getScheduledSCRsMessageCount">
PROPAGATION_REQUIRED,readOnly
</prop>
<prop key="isUserQuotaExceeded">
PROPAGATION_REQUIRED,readOnly
</prop>
<prop key="retrieveActiveSCR*">
PROPAGATION_REQUIRED,readOnly
</prop>
<prop key="retrieveSCRInfo">
PROPAGATION_REQUIRED,readOnly
</prop>
<prop key="scheduleTask">
PROPAGATION_REQUIRED,-SchedulerServiceRuntimeException
</prop>
<prop key="*ScheduledTask">
PROPAGATION_REQUIRED,-SchedulerServiceRuntimeException
</prop>
<prop key="updateTaskSchedule">
PROPAGATION_REQUIRED,-SchedulerServiceRuntimeException
</prop>
</props>
</property>
<property name="preInterceptors">
<ref bean="performanceInterceptor" />
</property>
</bean>
For now I had commented the following Quartz Scheduler Entry, So it works fine...
<!--<entry key="scrService">
<ref bean="scrService" />
</entry>-->
As per my interpretation of trace-log, scrService has abstract implementation...
Please advise about this situation... Thanks for your suggestions....

Not seeing BoneCP shutdown() with Hibernate, Spring, Bonecp

I am implementing an application with Spring, Hibernate and BoneCP. When I invoke the shutdown script of Tomcat I see errors like this
The web application [/REST] appears to have started a thread named [BoneCP-release-thread-helper-thread] but has failed to stop it. This is very likely to create a memory leak.
When i see my logs, I am not seeing "Shutting down connection pool...", so I am assuming I am missing something over here.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:sws="http://www.springframework.org/schema/web-services"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-1.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd"
xmlns:context="http://www.springframework.org/schema/context">
<bean id="LookupService" class="com.appserver.rest.LookupService">
<property name="userManager" ref="UserManager"></property>
<property name="groupManager" ref="GroupManager"></property>
<property name="messageManager" ref="MessageManager"></property>
<property name="tokenManager" ref="TokenManager"></property>
<property name="accessManager" ref="AccessManager"></property>
<property name="rosterManager" ref="RosterManager"></property>
</bean>
<bean id="LookupServiceV2" class="com.appserver.rest.LookupServiceV2"
parent="LookupService">
</bean>
<bean id="UserManager" class="com.appserver.rest.UserManager">
<constructor-arg index="0">
<ref bean="authManager" />
</constructor-arg>
</bean>
<bean id="GroupManager" class="com.appserver.rest.GroupManager">
<constructor-arg index="0">
<ref bean="authManager" />
</constructor-arg>
</bean>
<bean id="MessageManager" class="com.appserver.rest.MessageManager">
</bean>
<bean id="TokenManager" class="com.appserver.rest.TokenManager">
<constructor-arg index="0">
<ref bean="secureRandom" />
</constructor-arg>
</bean>
<bean id="authManager" class="com.appserver.rest.AuthenticationManager">
<constructor-arg index="0">
<ref bean="secureRandom" />
</constructor-arg>
</bean>
<bean id="AccessManager" class="com.appserver.rest.AccessManager">
</bean>
<bean id="RosterManager" class="com.appserver.rest.RosterManager">
</bean>
<bean id="secureRandom" class="java.security.SecureRandom">
</bean>
<bean id="messageDeleteScheduler" class="com.appserver.schema.MessageDeleteScheduler" />
<bean id="messageDeleteJob"
class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean">
<property name="targetObject" ref="messageDeleteScheduler" />
<property name="targetMethod" value="scheduleMessageDeletion" />
</bean>
<bean id="messageDeleteTrigger" class="org.springframework.scheduling.quartz.SimpleTriggerBean">
<property name="jobDetail" ref="messageDeleteJob" />
<property name="repeatInterval" value="3600000" />
<property name="startDelay" value="1000" />
</bean>
<bean id="quartz" class="org.springframework.scheduling.quartz.SchedulerFactoryBean" destroy-method="destroy" >
<property name="jobDetails">
<list>
<ref bean="messageDeleteJob" />
</list>
</property>
<property name="triggers">
<list>
<ref bean="messageDeleteTrigger" />
</list>
</property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
autowire="autodetect">
<property name="dataSource" ref="dataSource" />
<property name="annotatedClasses">
<list>
<value>com.appserver.schema.GroupDB</value>
<value>com.appserver.schema.UserDB</value>
<value>com.appserver.schema.MessageDB</value>
<value>com.appserver.schema.UserBlockDB</value>
<value>com.appserver.schema.GroupUserMapperDB</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<!-- <prop key="hibernate.connection.provider_class">com.jolbox.bonecp.provider.BoneCPConnectionProvider</prop> -->
<!-- <prop key="hibernate.connection.driver_class">com.mysql.jdbc.Driver</prop>
<prop key="hibernate.connection.url">jdbc:mysql://localhost/testdb</prop>
<prop key="hibernate.connection.username">alpha1</prop>
<prop key="hibernate.connection.password">r0cktheworld</prop>
<prop key="hibernate.connection.pool_size">50</prop>
-->
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
<prop key="hibernate.current_session_context_class">thread</prop>
<prop key="hibernate.globally_quoted_identifiers">true</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EHCacheProvider</prop>
<!-- <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop> -->
<prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.SingletonEhCacheRegionFactory
</prop>
<prop key="hibernate.cache.use_query_cache">true</prop>
<prop key="hibernate.cache.use_structured_entries">true</prop>
<prop key="hibernate.cache.use_second_level_cache">true</prop>
<!-- this is connection provider -->
<!-- and this is how you configure it -->
<prop key="jadira.usertype.autoRegisterUserTypes">true</prop>
<prop key="jadira.usertype.databaseZone">jvm</prop>
<prop key="jadira.usertype.javaZone">jvm</prop>
</props>
</property>
</bean>
<!-- Spring bean configuration. Tell Spring to bounce off BoneCP -->
<bean id="dataSource"
class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
<ref local="mainDataSource" />
</property>
</bean>
<bean id="mainDataSource" class="com.jolbox.bonecp.BoneCPDataSource" destroy-method="close">
<property name="driverClass" value="com.mysql.jdbc.Driver" />
<property name="jdbcUrl" value="jdbc:mysql://localhost/dbrocker" />
<property name="username" value="root"/>
<property name="password" value="root123"/>
<property name="idleConnectionTestPeriod" value="60"/>
<property name="idleMaxAge" value="240"/>
<property name="maxConnectionsPerPartition" value="60"/>
<property name="minConnectionsPerPartition" value="20"/>
<property name="partitionCount" value="3"/>
<property name="acquireIncrement" value="10"/>
<property name="statementsCacheSize" value="50"/>
<property name="releaseHelperThreads" value="3"/>
</bean>
<context:annotation-config/>
Thanks
This is a known issue. See https://code.google.com/p/guava-libraries/issues/detail?id=92.
Try using the snapshot version of bonecp-0.8.0-rc2 which contains 14.0.1 version of guava that has fixes for guava Finalizer thread not closed.
You can grab the snapshot from here -> https://oss.sonatype.org/content/repositories/snapshots/com/jolbox/bonecp/0.8.0-rc2-SNAPSHOT/

Integrating OSworkflow with Spring and Hibernate

How can I integrate OSworkflow with spring and hibernate.What are the configuration i need to specify in xml files and which jar files are requires for it.
Update
I have defined the applicationContext.xml as follows
<bean id="workflowStore" class="com.opensymphony.workflow.spi.hibernate.SpringHibernateWorkflowStore" autowire="byName"> <property name="resource" value="workflow-defs.xml"/>
<property name="reload" value="true"/> </bean>
<bean id="workflowFactory" class="com.opensymphony.workflow.loader.XMLWorkflowFactory" init-method="initDone"/>
<bean id="workflowConfiguration" class="com.opensymphony.workflow.config.SpringConfiguration">
<property name="store"><ref local="workflowStore"/></property>
<property name="factory"><ref local="workflowFactory"/></property>
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="namingStrategy">
<bean class="org.hibernate.cfg.ImprovedNamingStrategy" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
<prop key="hibernate.format_sql">${hibernate.format_sql}</prop>
<prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
<prop key="hibernate.cache.provider_configuration_file_resource_path">ehcache/ehcache-hibernate-local.xml</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
<property name="packagesToScan" value="net.top.*.entity.*" />
<property name="mappingResources">
<list>
<value>com/opensymphony/workflow/spi/hibernate/WorkflowDescriptor.hbm.xml</value>
<value>com/opensymphony/workflow/spi/hibernate/HibernateCurrentStep.hbm.xml</value>
<value>com/opensymphony/workflow/spi/hibernate/HibernateHistoryStep.hbm.xml</value>
<value>com/opensymphony/workflow/spi/hibernate/HibernateWorkflowEntry.hbm.xml</value>
<value>com/opensymphony/module/propertyset/hibernate/PropertySetItemImpl.hbm.xml</value>
</list>
</property>
</bean>
It shows an error as
Could not determine type for: com.opensymphony.workflow.loader.NotNullStringType, for columns: [org.hibernate.mapping.Column(value)]
Did i miss anything?.

Resources