roehrijn
Jul 28th, 2010, 08:36 AM
Hello,
my Spring based project used an HibernateTransactionManager. I'm no working on making it runnable on Websphere 6.1. Therefor I use the WebSphereUowTransactionManager.
This causes some trouble because I get the following error during startup in Websphere:
[28.07.10 15:07:18:207 CEST] 0000001c AnnotationSes I org.springframework.orm.hibernate3.AbstractSession FactoryBean destroy Closing Hibernate SessionFactory
[28.07.10 15:07:18:207 CEST] 0000001c ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/config/data-access-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'sessionFactory' of bean class [org.springframework.transaction.jta.WebSphereUowTr ansactionManager]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1353)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:872)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:423)
at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServ letContextCreated(WebApp.java:917)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitia lizationFinish(WebApp.java:370)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize (WebApp.java:338)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebAp plication(WebGroup.java:93)
at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplic ation(VirtualHost.java:162)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(W ebContainer.java:673)
at com.ibm.ws.wswebcontainer.WebContainer.addWebAppli cation(WebContainer.java:626)
at com.ibm.ws.webcontainer.component.WebContainerImpl .install(WebContainerImpl.java:395)
at com.ibm.ws.webcontainer.component.WebContainerImpl .start(WebContainerImpl.java:611)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.st art(ApplicationMgrImpl.java:1274)
at com.ibm.ws.runtime.component.DeployedApplicationIm pl.fireDeployedObjectStart(DeployedApplicationImpl .java:1165)
at com.ibm.ws.runtime.component.DeployedModuleImpl.st art(DeployedModuleImpl.java:587)
at com.ibm.ws.runtime.component.DeployedApplicationIm pl.start(DeployedApplicationImpl.java:832)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.st artApplication(ApplicationMgrImpl.java:921)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$Ap pInitializer.run(ApplicationMgrImpl.java:2124)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_A synchInitializer.run(WsComponentImpl.java:342)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1497)
Caused by: org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'sessionFactory' of bean class [org.springframework.transaction.jta.WebSphereUowTr ansactionManager]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:1022)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:867)
at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:7 6)
at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:5 8)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1350)
... 30 more
I do not understand this because there should be no "transactionManager" bean. I'm using "txManager" instead:
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<tx:annotation-driven transaction-manager="txManager" />
<bean id="txManager" class="org.springframework.transaction.jta.WebSphereUowTr ansactionManager">
<property name="autodetectTransactionManager" value="false"/>
</bean>
<!-- JNDI Datasource -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="anyDataSource" />
<property name="proxyInterface" value="javax.sql.DataSource"/>
</bean>
<!-- Session Factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jtaTransactionManager" ref="txManager"/>
<property name="exposeTransactionAwareSessionFactory" value="false"/>
<property name="annotatedClasses">
<list>
<value>some.AnnotatedClass</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.hbm2ddl.auto=none
hibernate.dialect=org.hibernate.dialect.Oracle10gD ialect
hibernate.show_sql=true
hibernate.use_outer_join=true
</value>
</property>
</bean>
</beans>
My only idea is that any Spring internals assume the presence of "transactionManager".
Any ideas?
Best regards
Jan
my Spring based project used an HibernateTransactionManager. I'm no working on making it runnable on Websphere 6.1. Therefor I use the WebSphereUowTransactionManager.
This causes some trouble because I get the following error during startup in Websphere:
[28.07.10 15:07:18:207 CEST] 0000001c AnnotationSes I org.springframework.orm.hibernate3.AbstractSession FactoryBean destroy Closing Hibernate SessionFactory
[28.07.10 15:07:18:207 CEST] 0000001c ContextLoader E org.springframework.web.context.ContextLoader initWebApplicationContext Context initialization failed
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/config/data-access-config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'sessionFactory' of bean class [org.springframework.transaction.jta.WebSphereUowTr ansactionManager]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1353)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:1076)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.doCreateBean(AbstractAu towireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.Abstract BeanFactory$1.getObject(AbstractBeanFactory.java:2 91)
at org.springframework.beans.factory.support.DefaultS ingletonBeanRegistry.getSingleton(DefaultSingleton BeanRegistry.java:222)
at org.springframework.beans.factory.support.Abstract BeanFactory.doGetBean(AbstractBeanFactory.java:288 )
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:563)
at org.springframework.context.support.AbstractApplic ationContext.finishBeanFactoryInitialization(Abstr actApplicationContext.java:872)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:423)
at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListe ner.contextInitialized(ContextLoaderListener.java: 47)
at com.ibm.ws.wswebcontainer.webapp.WebApp.notifyServ letContextCreated(WebApp.java:917)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitia lizationFinish(WebApp.java:370)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize (WebApp.java:338)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebAp plication(WebGroup.java:93)
at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplic ation(VirtualHost.java:162)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(W ebContainer.java:673)
at com.ibm.ws.wswebcontainer.WebContainer.addWebAppli cation(WebContainer.java:626)
at com.ibm.ws.webcontainer.component.WebContainerImpl .install(WebContainerImpl.java:395)
at com.ibm.ws.webcontainer.component.WebContainerImpl .start(WebContainerImpl.java:611)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.st art(ApplicationMgrImpl.java:1274)
at com.ibm.ws.runtime.component.DeployedApplicationIm pl.fireDeployedObjectStart(DeployedApplicationImpl .java:1165)
at com.ibm.ws.runtime.component.DeployedModuleImpl.st art(DeployedModuleImpl.java:587)
at com.ibm.ws.runtime.component.DeployedApplicationIm pl.start(DeployedApplicationImpl.java:832)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.st artApplication(ApplicationMgrImpl.java:921)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$Ap pInitializer.run(ApplicationMgrImpl.java:2124)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_A synchInitializer.run(WsComponentImpl.java:342)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.j ava:1497)
Caused by: org.springframework.beans.NotWritablePropertyExcep tion: Invalid property 'sessionFactory' of bean class [org.springframework.transaction.jta.WebSphereUowTr ansactionManager]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:1022)
at org.springframework.beans.BeanWrapperImpl.setPrope rtyValue(BeanWrapperImpl.java:867)
at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:7 6)
at org.springframework.beans.AbstractPropertyAccessor .setPropertyValues(AbstractPropertyAccessor.java:5 8)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1350)
... 30 more
I do not understand this because there should be no "transactionManager" bean. I'm using "txManager" instead:
<?xml version="1.0" encoding="UTF-8"?>
<beans>
<tx:annotation-driven transaction-manager="txManager" />
<bean id="txManager" class="org.springframework.transaction.jta.WebSphereUowTr ansactionManager">
<property name="autodetectTransactionManager" value="false"/>
</bean>
<!-- JNDI Datasource -->
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="anyDataSource" />
<property name="proxyInterface" value="javax.sql.DataSource"/>
</bean>
<!-- Session Factory -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.Anno tationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jtaTransactionManager" ref="txManager"/>
<property name="exposeTransactionAwareSessionFactory" value="false"/>
<property name="annotatedClasses">
<list>
<value>some.AnnotatedClass</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.hbm2ddl.auto=none
hibernate.dialect=org.hibernate.dialect.Oracle10gD ialect
hibernate.show_sql=true
hibernate.use_outer_join=true
</value>
</property>
</bean>
</beans>
My only idea is that any Spring internals assume the presence of "transactionManager".
Any ideas?
Best regards
Jan