13 Replies Latest reply on Feb 5, 2003 2:25 PM by keith_elliott

    XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375 has

    keith_elliott

      Hi Folks,

      I'm running Jboss 2.4.8/Tomcat 3.2.3 on Linux, with MySQL and the mysql-connector-java-2.0.14-bin.jar MySQL driver.

      When I hit a page that accesses a Session EJBs (which in turn accesses Entity EJBs), I get...

      [WARN,XAConnectionFactory] XAConnectionImpl: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@53c375 has no current tx!
      [WARN,XAConnectionFactory] XAConnectionImpl: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@53c375 has no current tx!
      [WARN,XAConnectionFactory] XAConnectionImpl: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@53c375 has no current tx!

      Curiously, when I remove the container-transaction stuff out of the ejb-ref.xml file, the error message goes away. This is what I'm removing from ejb-ref.xml...

      <assembly-descriptor>
      <container-transaction>

      <ejb-name>UtilSessionEJB</ejb-name>
      <method-name>*</method-name>

      <trans-attribute>Supports</trans-attribute>
      </container-transaction>
      </assembly-descriptor>

      I'm upgrading from Jboss 2.2.2. Everything works on the old version - I don't see this error.

      Any insight?
      What does the error message mean?
      How can I fix it?
      Why does removing the transaction stuff from ejb-ref.xml have an effect?
      What is the default <trans-attribute> value if you
      do not set it?

      Thanks a bunch for any help!

      P.S. Sorry if this is a duplicate post, but I got a server error the first time I posted.

        • 1. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
          davidjencks

          If all your beans specify supports, you won't get any transactions. Try required.

          • 2. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
            keith_elliott

            Actually, I intentionally want to run this application without transactions. I can make the message go away if I change the &lt;trans-attribute&gt;, but I'd like to keep it as Supports.

            • 3. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
              kenneth

              Hi

              I'm experiencing the same problem:

              "XAConnectionImpl: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@25c828 has no current tx!"

              My architecture is:

              JBoss 2.4.8 Tomcat 4.0.4
              CMP: MVCSoft Persistence Engine
              DB Drivers: Sybase jConnect 4.2

              I can reproduce this warning message when I log in to my application using the DatabaseServerLoginModule, which only uses internal JBoss code -- so no changes to my ejb-jar.xml file will remove it.

              See the org.jboss.security.auth.spi.DatabaseServerLoginModule source for how the datasource is used.

              Other accesses to the DB which use transaction-required EJB methods do not seem to log this warning.

              My datasource setup is:


              MyDatasource
              org.jboss.pool.jdbc.xa.wrapper.XADataSourceImpl

              jdbc:sybase:Tds:myserver:4000
              1200000
              User
              10
              XXXX
              false
              false
              false
              true
              120000
              1800000
              false
              false
              1.0
              0


              I am very interested in any background about this warning message, but am most concerned with 2 fairly obvious things:

              1. Do I need to worry about these warnings appearing in the logs?
              2. If I do, what should I be doing about it?

              Thanks for any feedback!
              Kenneth

              • 4. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                davidjencks

                If you are doing any modifications outside a transaction you should worry about these messages. In 2.4 connections from XADataSourceImpl ALWAYS have autocommit = false. So if you don't specify transactions, if and when your changes are saved is likely to be between unpredictable and never.

                I don't think even reading outside an explicit transaction is good practice if the database has any possibility of updates since some databases that use versioning hold resources for every open transaction.

                If you are only reading and your database is not holding resources due to implicit open transactions, there is no harm in ignoring the message. If enough people complain I'll consider taking it out.

                If you REALLY don't want any transactional behavior use a JDBCDataSourceLoader instead of a XADataSourceLoader. It leaves autocommit = true and doesn't have any connection with the transaction manager.

                • 5. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                  kenneth

                  David

                  Thanks for the prompt reply, but I'm still a bit confused. How do I get code used outside an EJB to use a transaction? A good example of where this is done is JBoss's own JAAS framework.

                  I've copied an (abridged) snippet of the DB access code taken from the class org.jboss.security.auth.spi.DatabaseServerLoginModule:

                  Connection conn = null;
                  PreparedStatement ps = null;

                  try
                  {
                  InitialContext ctx = new InitialContext();
                  DataSource ds = (DataSource) ctx.lookup(dsJndiName);
                  conn = ds.getConnection();
                  // Get the password
                  ps = conn.prepareStatement(principalsQuery);
                  ps.setString(1, username);
                  ResultSet rs = ps.executeQuery();
                  password = rs.getString(1);
                  rs.close();
                  }
                  catch(Exception ex)
                  {
                  log.error("Query failed", ex);
                  }
                  finally
                  {
                  if( ps != null )
                  {
                  try
                  {
                  ps.close();
                  }
                  catch(SQLException e)
                  {}
                  }
                  if( conn != null )
                  {
                  try
                  {
                  conn.close();
                  }
                  catch (SQLException ex)
                  {}
                  }
                  }
                  return password;


                  Is it necessary to modify this to ensure that work is done in a transaction (to avoid the DB unnecessarily holding resources)? If so, how would I do it? I notice that the conn.commit() is never called, is this a bug in the JBoss code? Finally, to make sure I haven't drifted too far from the original point of this thread, do you think that this code would cause the warning message in question to be logged?

                  Thanks
                  Kenneth

                  • 6. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                    davidjencks

                    Yes, halfway through my previous reply I realized that the db login module was probably the source of your messages.

                    With most or all databases set to READ_COMMITTED, you won't use up any or significant resources reading and not committing. If you are using firebird with tpb_concurrency (normally translated as REPEATABLE_READ) (or interbase or possibly postgres, I've heard rumors they have a versioning architecture also but I don't know how it works), you will be keeping a version of the database as of the start of the transaction. This isn't incredibly expensive, but might add up over time. You also won't see updates until a new tx starts.

                    So if you aren't using firebird, you are probably fine with the db login module as it is. If you are, I'd add a commit after the read.

                    And yes, this is why you are getting the warning message.

                    • 7. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                      lasmith

                      I too am seeing this mesage after upgrading from 2.4.7 to 2.4.9. I just wondered if it will be safe to use log4j to turn warn level off for this class to stop it from clogging up the log files?

                      We use a mixture of transactional behaviour and none transactional behaviour. Any methods that make DB writes are in a transaction ('Required') and methods that do DB reads are just 'Supports'. I was under the impression creating a transaction for reads was unnecessary overhead and hits on performance?

                      Could you explain what you mean by your statement:
                      "I don't think even reading outside an explicit transaction is good practice if the database has any possibility of updates since some databases that use versioning hold resources for every open transaction."

                      Sorry I dont have a lot of experience with databases. The database we use is oracle do you think this could cause the problems you mention?

                      • 8. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                        lasmith

                        I too am seeing this mesage after upgrading from 2.4.7 to 2.4.9. I just wondered if it will be safe to use log4j to turn warn level off for this class to stop it from clogging up the log files.

                        We use a mixture of transactional behaviour and none transactional behaviour. Any methods that make DB writes are in a transaction ('Required') and mehtods that do DB reads are just 'Supports'. I was under the impression creating a transaction for reads was unnecessary overhead and hits on performance?

                        Could you explain what you mean by your statement:
                        "I don't think even reading outside an explicit transaction is good practice if the database has any possibility of updates since some databases that use versioning hold resources for every open transaction."

                        Sorry I dont have a lot of experience with databases. The database we use is oracle do you think this could cause the problems you mention?

                        • 9. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                          fox_hk

                          Hi folks

                          l also find my app dump out a lot of such message.
                          My application primarily use JTA in stateful session bean to control transaction. All Entity bean called by that stateful session bean is set "required" transaction. So l think most of operations done by my program should be within a transaction. l am concerned whether that message implies that JTA can't initiate transaction and all operations are done without transaction. It is highly appreciated some ejb guru can help me understand what implication this message means


                          regards
                          fox

                          • 10. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                            psjoe

                            David,

                            I'm using JBoss 2.4.9. Why am I getting the "has no current tx! on startup? Why am I warned about a transaction on startup? Also, I tried changing to JDBCDataSourceLoader and I always get:
                            java.lang.RuntimeException: No ManagedConnections.
                            Where can I find information on configuring JDBCDataSourceLoader.

                            Below is my JBoss 2.4.9 output
                            [DEBUG,jboss.pool.jdbc.xa.XAConnectionFactory] Starting
                            [DEBUG,org.jboss.pool.ObjectPool] Adding pool: ALCDataSource, GC enabled: false
                            [INFO,org.jboss.jdbc.XADataSourceLoader.ALCDataSource] XA Connection pool ALCDataSource bound to java:/ALCDataSource
                            [WARN,jboss.pool.jdbc.xa.XAConnectionFactory] XAConnectionImpl: org.jboss.pool.jdbc.xa.wrapper.XAConnectionImpl@742700 has no current tx!
                            [INFO,org.jboss.jdbc.XADataSourceLoader.ALCDataSource] Started

                            • 11. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                              kylev

                              Don't bother with JDBCDataSourceLoader. It will blow up, exhausting your pool quickly. And from the response I've gotten, nobody plans to fix it.

                              http://sourceforge.net/tracker/index.php?func=detail&aid=664547&group_id=22866&atid=376685

                              I, too, am getting the "tx message" after switching to the XA wrapper. But I'm still not sure why. I'm just writing normal DB code.

                              Are you not supposed to with XA? Do you HAVE TO enclose all your work in a transaction? Or is this message simply wrong?

                              • 12. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                                kylev

                                darnit, I even get the "tx message" if I do a con.commit().... Now I'm going to have to look at the source and specs to find out what this is actually detecting.

                                • 13. Re: XAConnectionImpl: org.jboss.....XAConnectionImpl@53c375
                                  keith_elliott

                                  I initiated this discussion way back when. Since then, we upgraded to 3.0.4, w/ a separate (not-bundled) Tomcat installation. All seems fine. No more messages. I haven't thought about this issue since we upgraded. The new ver. has been very stable.