hi,
T4 + JBoss Portal 2.2.1 + Hibernate 3.1 + Spring 1.2.5
Here is the configuration in the applicationContext.xml file:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean
">
<property name="jndiName" value="java:/jdbc/MyDS"/>
</bean>
This configuration works fine for my other WEB applications running in the
same JBoss Portal server. However, when I tried a Portlet App with this
configuration, I got the exception of:
JDBCException: Cannot commit during a managed transaction!
The transaction manager definition is:
<bean id="sessionFactory" class="
org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"/>
...
</bean>
<bean id="transactionManager" class="
org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
I have to use the local data source for this portlet app as:
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<property name="driverClass" value="${jdbc.driverClassName}"/>
<property name="jdbcUrl" value="${jdbc.url}"/>
<property name="user" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
<property name="loginTimeout" value="${hibernate.c3p0.timeout}"/>
</bean>
The above local data source works fine for the portlet app.
Can somebody explain why the JTA data source doesn't work in Portlet app? Or
did I miss something?
Regards,
Liu Yan