-->
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: Having problem with JTA
PostPosted: Fri Jan 09, 2004 1:59 am 
Newbie

Joined: Fri Jan 09, 2004 1:52 am
Posts: 1
I have some problem when using JTA of jboss
Code:
UserTransaction tx=null;
      try {
         tx =(UserTransaction)new InitialContext().lookup("java:comp/UserTransaction");
         dao.addUser(user);
         tx.commit();

      } catch (Exception e) {
         if(tx!=null)
            tx.rollback();
         throw new Exception(e);
         
      }


the error info list:
Code:
13:19:02,687 INFO  [STDOUT] session closed
13:19:05,859 INFO  [STDOUT] filter starts
13:19:06,125 INFO  [Environment] Hibernate 2.1 beta 5
13:19:06,156 INFO  [Environment] hibernate.properties not found
13:19:06,156 INFO  [Environment] using CGLIB reflection optimizer
13:19:06,171 INFO  [Configuration] Configuration resource: /hibernate.cfg.xml
13:19:06,421 INFO  [Configuration] Mapping resource: User.hbm.xml
13:19:06,703 INFO  [Binder] Mapping class: com.up.cip.po.User -> user
13:19:06,984 INFO  [Configuration] Configured SessionFactory: null
13:19:06,984 INFO  [Configuration] processing one-to-many association mappings
13:19:06,984 INFO  [Configuration] processing one-to-one association property re
ferences
13:19:06,984 INFO  [Configuration] processing foreign key constraints
13:19:07,046 INFO  [Dialect] Using dialect: net.sf.hibernate.dialect.MySQLDialec
t
13:19:07,046 INFO  [SettingsFactory] Use outer join fetching: true
13:19:07,093 INFO  [NamingHelper] JNDI InitialContext properties:{}
13:19:07,093 INFO  [DatasourceConnectionProvider] Using datasource: java:/mysqld
atasource
13:19:07,109 INFO  [TransactionFactoryFactory] Transaction strategy: net.sf.hibe
rnate.transaction.JTATransactionFactory
13:19:07,109 INFO  [NamingHelper] JNDI InitialContext properties:{}
13:19:07,125 INFO  [TransactionManagerLookupFactory] No TransactionManagerLookup
configured (in JTA environment, use of process level read-write cache is not re
commended)
13:19:07,125 INFO  [TransactionManagerLookupFactory] No TransactionManagerLookup
configured (in JTA environment, use of process level read-write cache is not re
commended)
13:19:07,390 INFO  [SettingsFactory] Use scrollable result sets: true
13:19:07,390 INFO  [SettingsFactory] JDBC 2 max batch size: 20
13:19:07,390 INFO  [SettingsFactory] echoing all SQL to stdout
13:19:07,390 INFO  [SettingsFactory] Query language substitutions: {}
13:19:07,390 INFO  [SettingsFactory] cache provider: net.sf.hibernate.cache.JCSC
acheProvider
13:19:07,406 INFO  [Configuration] instantiating and configuring caches
13:19:07,812 INFO  [SessionFactoryImpl] building session factory
13:19:08,421 INFO  [SessionFactoryObjectFactory] no JNDI name configured
13:19:08,609 ERROR [STDERR] java.lang.IllegalStateException: No transaction.
13:19:08,609 ERROR [STDERR]     at org.jboss.tm.TxManager.rollback(TxManager.jav
a:272)
13:19:08,609 ERROR [STDERR]     at org.jboss.tm.usertx.client.ServerVMClientUser
Transaction.rollback(ServerVMClientUserTransaction.java:134)



and my hibernte.cfg.xml
Code:
<!DOCTYPE hibernate-configuration
    PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-2.0.dtd">

<hibernate-configuration>
    <session-factory>
        <property name="connection.datasource">java:/mysqldatasource</property>
        <property name="show_sql">true</property>
        <property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
        <property name="hibernate.jdbc.batch_size">20</property>
         
        <!-- Mapping files -->
        <mapping resource="User.hbm.xml"/>
       
    </session-factory>

</hibernate-configuration>


I don't know where is the problem?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jan 09, 2004 8:23 am 
Senior
Senior

Joined: Tue Nov 25, 2003 9:35 am
Posts: 194
Location: San Francisco
Have you seen http://www.hibernate.org/66.html? You are missing a fair bit from the properties.

Since you are using JBoss, why don't you use the MBean approach?

Upgrade to Hibernate 2.1.1.



Sherman


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.