Re: Commit Exception Error

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Jan 10 2008 - 03:39:35 EST

  • Next message: marco turchi: "Re: Commit Exception Error"

    > maybe I have added it to the wrong place...

    Most likely... "autoReconnect=true" should be appended to the URL, not
    the driver name.

    Andrus

    On Jan 10, 2008, at 4:38 AM, marco turchi wrote:

    > Hi Andrus,
    > I have added the jdbc:mysql://localhost/test?autoReconnect=true
    > string to
    > file.driver.xml file into my cayenne model, but I get this error:
    > org.objectstyle.cayenne.ConfigurationException: [v.1.2.3 May 6 2007]
    > Error
    > during Configuration initialization. [v.1.2.3 May 6 2007] Load
    > failures.
    > Main configuration class: org.object
    > style.cayenne.conf.DefaultConfiguration, details:
    > domain.node.name=TranslationNode,
    > domain.node.datasource=TranslationNode.driver.xml, reason:
    > DataSource load
    > failed - Can not load JDBC driver named 'com.mysql.jdbc.Driver
    > ?autoReconnect=t
    > rue': com.mysql.jdbc.Driver?autoReconnect=true
    > at
    > org
    > .objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(
    > Configuration.java:321)
    > at
    > org
    > .objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(
    > Configuration.java:294)
    > at
    > org
    > .objectstyle.cayenne.conf.Configuration.initializeSharedConfiguration(
    > Configuration.java:275)
    > at
    > org.objectstyle.cayenne.conf.Configuration.getSharedConfiguration
    > (Configuration.java:212)
    > at
    > org.objectstyle.cayenne.access.DataContext.createDataContext(
    > DataContext.java:242)
    > at com.translation.alg.News.<clinit>(News.java:17)
    > maybe I have added it to the wrong place...
    > Thanks
    > Marco
    >
    >
    > On Jan 9, 2008 3:17 PM, Andrus Adamchik <andru..bjectstyle.org>
    > wrote:
    >
    >> Hi Marco,
    >>
    >> I think what you need is a reconnect parameter in your MySQL URL.
    >> E.g.:
    >>
    >> jdbc:mysql://localhost/test?autoReconnect=true
    >>
    >> Andrus
    >>
    >>
    >> On Jan 8, 2008, at 8:02 PM, marco turchi wrote:
    >>
    >>> Dear experts,
    >>> I'm running a java software that gets some data from the DB,
    >>> computes them
    >>> and the writes the result to the DB... Unfortunately, the
    >>> computation of the
    >>> data gets 10 hs...
    >>> I'm able to get the data, compute them, but when I try to write to
    >>> the DB, I
    >>> get this error:
    >>> org.objectstyle.cayenne.CayenneRuntimeException: [v.1.2.3 May 6
    >>> 2007] Commit
    >>> Exception
    >>> at org.objectstyle.cayenne.access.DataContext.flushToParent(
    >>> DataContext.java:1290)
    >>> at org.objectstyle.cayenne.access.DataContext.commitChanges (
    >>> DataContext.java:1166)
    >>> at com.translation.alg.WriterData.insert(WriterData.java:57)
    >>> at com.translation.alg.News.write(News.java:85)
    >>> at
    >>> com.translation.alg.TranslationNews.run(TranslationNews.java :66)
    >>> at
    >>> com.translation.alg.TranslationNews.main(TranslationNews.java:21)
    >>> Caused by: java.sql.SQLException: Connection.close() has already
    >>> been
    >>> called. Invalid operation in this state.
    >>> at com.mysql.jdbc.Connection.getMutex (Connection.java:2130)
    >>> at com.mysql.jdbc.Statement.execute(Statement.java:866)
    >>> at
    >>> org.objectstyle.cayenne.dba.mysql.MySQLPkGenerator.pkFromDatabase
    >>> (MySQLPkGenerator.java:123)
    >>> at
    >>> org.objectstyle.cayenne.dba.JdbcPkGenerator.generatePkForDbEntity(
    >>> JdbcPkGenerator.java:326)
    >>> at
    >>> org
    >>> .objectstyle
    >>> .cayenne.access.DataDomainInsertBucket.createPermIdsForObjEntity
    >>> (DataDomainInsertBucket.java:194)
    >>> at
    >>> org
    >>> .objectstyle
    >>> .cayenne.access.DataDomainInsertBucket.appendQueriesInternal(
    >>> DataDomainInsertBucket.java:122)
    >>> at
    >>> org.objectstyle.cayenne.access.DataDomainSyncBucket.appendQueries
    >>> (DataDomainSyncBucket.java:108)
    >>> at
    >>> org.objectstyle.cayenne.access.DataDomainFlushAction.preprocess (
    >>> DataDomainFlushAction.java:211)
    >>> at org.objectstyle.cayenne.access.DataDomainFlushAction.flush(
    >>> DataDomainFlushAction.java:167)
    >>> at org.objectstyle.cayenne.access.DataDomain.onSyncFlush(
    >>> DataDomain.java :846)
    >>> at org.objectstyle.cayenne.access.DataDomain$2.transform(
    >>> DataDomain.java:817)
    >>> at org.objectstyle.cayenne.access.DataDomain.runInTransaction(
    >>> DataDomain.java:862)
    >>> at org.objectstyle.cayenne.access.DataDomain.onSync
    >>> (DataDomain.java
    >>> :814)
    >>> at org.objectstyle.cayenne.access.DataContext.flushToParent(
    >>> DataContext.java:1262)
    >>> ... 5 more
    >>>
    >>> I have tried to delete and recreate the DataContext using
    >>> createDataContext() before to write to the table, but I get the same
    >>> error.
    >>> (I have created the DataContext the first time when I start the
    >>> program...)
    >>> Can u help me?
    >>> Thanks a lot
    >>> Marco
    >>
    >>



    This archive was generated by hypermail 2.0.0 : Thu Jan 10 2008 - 03:40:14 EST