Re: JBoss transactions

From: David Norwood (david..irtuant.com)
Date: Wed Aug 25 2004 - 02:00:53 EDT

  • Next message: David Norwood: "Re: JBoss transactions"

    OK, here is the output:

    2004-08-25 01:38:12,198 INFO [org.objectstyle.cayenne.access.QueryLogger] SELECT t0.FILENAME, t0.NAME, t0.PROCESSID, t0.URL, t0.ID, t0.RULEID FROM MESSAGETYPE t0 WHERE t0.ID = ? [bind: 18]
    2004-08-25 01:38:12,208 INFO [org.objectstyle.cayenne.access.QueryLogger] === returned 1 row. - took 10 ms.
    2004-08-25 01:38:12,208 INFO [org.objectstyle.cayenne.access.QueryLogger] +++ no commit - transaction controlled externally.
    2004-08-25 01:38:12,218 INFO [org.objectstyle.cayenne.access.QueryLogger] SELECT inbox_SEQ.nextval FROM DUAL
    2004-08-25 01:38:12,319 DEBUG [org.objectstyle.cayenne.access.ContextCommit] Creating InsertBatchQuery for DbEntity INBOX
    2004-08-25 01:38:12,319 INFO [org.objectstyle.cayenne.access.QueryLogger] --- will run 1 query.
    2004-08-25 01:38:12,319 INFO [org.objectstyle.cayenne.access.QueryLogger] INSERT INTO INBOX (COMPLETEDATETIME, CREATEDATETIME, DATETIME, ID, MESSAGETYPEID, MSGID, MSGTEXT, PERSONID, SUBJECT, TOPERSONID) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    2004-08-25 01:38:12,319 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 37, 18, 219, NULL, 147, 'HACCP Monitor', 147]
    2004-08-25 01:38:12,319 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 38, 18, 219, NULL, 146, 'HACCP Monitor', 146]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 39, 18, 219, NULL, 25, 'HACCP Monitor', 25]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 40, 18, 219, NULL, 24, 'HACCP Monitor', 24]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 41, 18, 219, NULL, 23, 'HACCP Monitor', 23]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 42, 18, 219, NULL, 22, 'HACCP Monitor', 22]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 43, 18, 219, NULL, 19, 'HACCP Monitor', 19]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 44, 18, 219, NULL, 18, 'HACCP Monitor', 18]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 45, 18, 219, NULL, 13, 'HACCP Monitor', 13]
    2004-08-25 01:38:12,329 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 46, 18, 219, NULL, 12, 'HACCP Monitor', 12]
    2004-08-25 01:38:12,339 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 47, 18, 219, NULL, 11, 'HACCP Monitor', 11]
    2004-08-25 01:38:12,339 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 48, 18, 219, NULL, 10, 'HACCP Monitor', 10]
    2004-08-25 01:38:12,339 INFO [org.objectstyle.cayenne.access.QueryLogger] [batch bind: NULL, '2004-08-25 01:38:12.208', '2004-08-25 01:38:12.208', 49, 18, 219, NULL, 3, 'HACCP Monitor', 3]
    2004-08-25 01:38:12,359 INFO [org.objectstyle.cayenne.access.QueryLogger] *** error.
    java.sql.SQLException: ORA-00001: unique constraint (HACCP.PK_INBOX) violated

            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2321)
            at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1741)
            at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1902)
            at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2047)
            at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:1940)
            at oracle.jdbc.driver.OraclePreparedStatement.executeBatch(OraclePreparedStatement.java:3899)
            at org.jboss.resource.adapter.jdbc.WrappedStatement.executeBatch(WrappedStatement.java:706)
            at org.objectstyle.cayenne.access.DataNode.runBatchUpdateAsBatch(DataNode.java:529)
            at org.objectstyle.cayenne.dba.oracle.OracleDataNode.runBatchUpdateAsBatch(OracleDataNode.java:360)
            at org.objectstyle.cayenne.access.DataNode.runBatchUpdate(DataNode.java:488)
            at org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:352)
            at org.objectstyle.cayenne.access.ContextCommit.commit(ContextCommit.java:195)
            at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1217)
            at org.objectstyle.cayenne.access.DataContext.commitChanges(DataContext.java:1187)
            at com.virtuant.mobilitee.ehc.rulefactory.InboxFactory.distribute(InboxFactory.java:347)
            at com.virtuant.mobilitee.ehc.rulefactory.InboxFactory.send(InboxFactory.java:118)
            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 bsh.Reflect.invokeOnMethod(Unknown Source)
            at bsh.Reflect.invokeObjectMethod(Unknown Source)
            at bsh.Name.invokeMethod(Unknown Source)
            at bsh.BSHMethodInvocation.eval(Unknown Source)
            at bsh.BSHPrimaryExpression.eval(Unknown Source)
            at bsh.BSHPrimaryExpression.eval(Unknown Source)
            at bsh.Interpreter.eval(Unknown Source)
            at bsh.Interpreter.eval(Unknown Source)
            at org.drools.semantics.java.Interp.evaluate(Interp.java:131)
            at org.drools.semantics.java.Interp.evaluate(Interp.java:117)
            at org.drools.semantics.java.BlockConsequence.invoke(BlockConsequence.java:120)
            at org.drools.reteoo.AgendaItem.fire(AgendaItem.java:152)
            at org.drools.reteoo.Agenda.fireNextItem(Agenda.java:316)
            at org.drools.reteoo.WorkingMemoryImpl.fireAllRules(WorkingMemoryImpl.java:288)
            at com.virtuant.mobilitee.ehc.ejb.QueueBrokerBean.doDistribution(QueueBrokerBean.java:176)
            at com.virtuant.mobilitee.ehc.ejb.QueueBrokerBean.onMessage(QueueBrokerBean.java:70)
            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.invocation.Invocation.performCall(Invocation.java:345)
            at org.jboss.ejb.MessageDrivenContainer$ContainerInterceptor.invoke(MessageDrivenContainer.java:477)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
            at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
            at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
            at org.jboss.ejb.plugins.AbstractTxInterceptorBMT.invokeNext(AbstractTxInterceptorBMT.java:153)
            at org.jboss.ejb.plugins.MessageDrivenTxInterceptorBMT.invoke(MessageDrivenTxInterceptorBMT.java:32)
            at org.jboss.ejb.plugins.MessageDrivenInstanceInterceptor.invoke(MessageDrivenInstanceInterceptor.java:85)
            at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:102)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
            at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
            at org.jboss.ejb.MessageDrivenContainer.internalInvoke(MessageDrivenContainer.java:391)
            at org.jboss.ejb.Container.invoke(Container.java:810)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:918)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1211)
            at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
            at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:871)
            at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:159)
            at org.jboss.mq.SpySession.run(SpySession.java:347)
            at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:180)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
            at java.lang.Thread.run(Thread.java:536)
    2004-08-25 01:38:12,359 INFO [org.objectstyle.cayenne.access.QueryLogger] *** no rollback - transaction controlled externally.
    2004-08-25 01:38:12,379 ERROR [java.lang.Class] Fact error: Sourced file: inline evaluation of: `` distribution.setRoleID(1); distribution.s . . . '' : Method Invocation inboxfactory.send
    2004-08-25 01:40:36,376 DEBUG [com.virtuant.mobilitee.ehc.ejb.StartBean] getMessages():
    2004-08-25 01:40:36,376 DEBUG [com.virtuant.mobilitee.ehc.rulefactory.DroolsFactory] getRule() ...
    2004-08-25 01:40:36,376 INFO [STDOUT] oid = com.virtuant.mobilitee.ehc.db.MessageType: <ID: 18>
    2004-08-25 01:40:36,376 INFO [org.objectstyle.cayenne.access.QueryLogger] --- will run 1 query.

    more...
    ---------- Original Message -------------
    Subject: Re: JBoss transactions
    Date: Tue, 24 Aug 2004 14:52:07 -0400
    From: Andrus Adamchik <andru..bjectstyle.org>
    To: cayenne-use..bjectstyle.org

    On Aug 24, 2004, at 1:31 PM, David Norwood wrote:
    > this is always in the log file after each DB access (probably correct):
    >
    > 2004-08-23 18:03:10,305 INFO
    > [org.objectstyle.cayenne.access.QueryLogger] +++ no commit -
    > transaction controlled externally.

    Yes, that's expected. Cayenne simply tells that it is done working with
    DB, and now it is up to the container to commit.

    > I'm getting table updates ok, (ie, the table gets the row) but the
    > Oracle sequence doesn't seem to be incrementing. So when I enter
    > another row, I get a pk unique violation, and it's because the
    > sequence hasn't been incremented. If I then force several updates,
    > even though I get an error each time, the sequence increments, and
    > eventually the table will accept the row.

    Hmm, as far as I know Oracle sequences are not transactional in a
    traditional sense. So new sequence value is immediately visible to all
    transactions without a need to do a commit. I just did a quick test to
    confirm my sanity, and this is indeed so, at least when using SQLPlus
    on Oracle 9i.

    Could you track down what exactly happens in your case? Do you have a
    log confirming that the same PK number is being used twice within an
    application? The one that you posted shows the failure, but not where
    the other record was inserted. There maybe other reasons why you have
    duplicate PKs in the db (e.g. manual rows insert).

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Aug 25 2004 - 02:00:56 EDT