-->
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.  [ 2 posts ] 
Author Message
 Post subject: Problems with jboss transaction.
PostPosted: Thu Mar 25, 2004 9:28 am 
Newbie

Joined: Thu Mar 25, 2004 9:15 am
Posts: 6
I am using Hibernate 2, jboss 3.2.3 and postgresql 7.3. I am new to Hibernate and I have no clue how to handle the error.

07:04:05,015 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract com.ejb.interfaces.Tuser com.ejb.interfaces.TuserHome.create(com.ejb.dto.TuserData) throws javax.ejb.CreateException,java.rmi.RemoteException, causedBy:
org.jboss.tm.JBossRollbackException: Unable to commit, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=bc2002.local//25, BranchQual=] status=STATUS_NO_TRANSACTION; - nested throwable: (javax.ejb.EJBException: null; CausedByException is:
null)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:413)
at org.jboss.ejb.plugins.TxInterceptorCMT.endTransaction(TxInterceptorCMT.java:398)
at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:277)
at org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java:98)
at org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityInterceptor.java:92)
at org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:120)
at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:93)
at org.jboss.ejb.EntityContainer.internalInvokeHome(EntityContainer.java:483)
at org.jboss.ejb.Container.invoke(Container.java:720)
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:324)
at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBeanDispatcher.java:284)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:546)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:367)
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:324)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:552)
Caused by: javax.ejb.EJBException: null; CausedByException is:
null
at org.jboss.ejb.plugins.BMPPersistenceManager.storeEntity(BMPPersistenceManager.java:475)
at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:387)
at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:714)
at org.jboss.ejb.GlobalTxEntityMap.synchronizeEntities(GlobalTxEntityMap.java:149)
at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapSynchronize.beforeCompletion(GlobalTxEntityMap.java:215)
at org.jboss.tm.TransactionImpl.doBeforeCompletion(TransactionImpl.java:1308)
at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:347)
... 26 more


And this is the transaction attribute in ejb-jar

<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>TuserBMP</ejb-name>
<method-intf>Local</method-intf>
<method-name>*</method-name>
</method>
<method>
<ejb-name>TuserBMP</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>

And this is the code

session = sessionFactory.openSession();
transaction = session.beginTransaction();
session.save(anUser, anUser.getUserid());
transaction.commit();
session.close();


I appreciate any glipmse of light that can show the way.


thanks

bc2002


Top
 Profile  
 
 Post subject:
PostPosted: Tue Apr 13, 2004 9:25 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
If you are using the Hibernate JBoss Mbean, then don't use Hibernate transactions. That is taken care of by the JBoss container. Do something like:


Code:
        try {
            aSession = factory.openSession();

            return UserService.getUser(aSession, username);

        } catch (Throwable t) {
            log.error("getUser: caught exception", t);
        } finally {
            if (aSession != null)  {
                try {
                    aSession.flush();
                    aSession.close();
                } catch (HibernateException he) {
                    log.error("Abort: HibernateException on close", he);
                }
            }
        }


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

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.