[jboss-user] Re: No transaction is in progress
samk at twinix.com
samk at twinix.com
Thu Apr 9 07:51:49 EDT 2009
See Thread at: http://www.techienuggets.com/Detail?tx=65019 Posted on behalf of a User
Hi,
I am facing this same problem. I am having weblogic 9.2 and using JPA over hibernate. For one message at a time it works okay but when I fire good number of events then get into this no transaction in progress issue.
I am using Container managed transaction in MDB. I create entity manager on that thread and save it in threadlocal.. When that message processing is finished finally I close the Entity Manager in onMessage method itself.
throught out the code I use Entity Manager from ThreadLocal which was created at the begning of onMessage method.
It is weird as I am not able to understand why it works sometime and why it doesnt works sometimes.
Did anyone found solution to above problem?
In Response To:
Hi Guys,
I am not able to solve this problema below. Any body can help me ?
| javax.persistence.TransactionRequiredException: no transaction is in progress
| at org.hibernate.ejb.AbstractEntityManagerImpl.flush(AbstractEntityManagerImpl.java:301)
| at com.powerlogic.jcompany.persistencia.jpa.PlcBaseJpaDAO.altera(PlcBaseJpaDAO.java:482)
| at com.powerlogic.jcompany.modelo.PlcBaseBO.altera(PlcBaseBO.java:492)
| at com.powerlogic.jcompany.facade.PlcFacadeImpl.gravaTabular(PlcFacadeImpl.java:444)
| at com.powerlogic.app.facade.AppFacadeImpl.gravaTabular(AppFacadeImpl.java:43)
| 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:597)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeTarget(MethodInvocation.ja
|
My -ds.xml
| <datasources>
| <local-tx-datasource>
| <jndi-name>jcompany_jsf</jndi-name>
| <connection-url>jdbc:oracle:thin:@10.0.0.1:1521:orades01</connection-url>
| <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
| <user-name>aaa</user-name>
| <password>bbb</password>
| </local-tx-datasource>
| </datasources>
|
My persistence.xml
| <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence">
| <persistence-unit name="default" transaction-type="JTA">
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:jcompany_jsf</jta-data-source>
|
| <jar-file>jcompany_jsf_comuns.jar</jar-file>
|
| <properties>
| <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.format_sql" value="true"/>
|
| </properties>
| </persistence-unit>
| </persistence>
|
My EJB
| @Stateless
| @TransactionManagement(TransactionManagementType.CONTAINER)
| public class AppFacadeImpl extends PlcFacadeImpl implements IAppFacade, IAppFacadeRemote {
|
| @Override
| @TransactionAttribute (TransactionAttributeType.REQUIRED)
| public void gravaTabular(PlcBaseContextVO context, Class classe,
| List lista, List listaAnt) throws PlcException {
| super.gravaTabular(context, classe, lista, listaAnt);
| }
| }
|
Thanks,
Rogerio
More information about the jboss-user
mailing list