org.apache.openjpa.persistence.OptimisticLockException

Unable to obtain an object lock on "DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID = APP.JAMES_MAIL.MAIL_UID)) [java.lang.String]". FailedObject: DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID = APP.JAMES_MAIL.MAIL_UID)) [java.lang.String]


Solutions on the web28

Solution icon of apache
via james-server-user by Eric Charles, 10 months ago
Unable to obtain an object lock on "DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID

Solution icon of apache
via james-server-user by Kohei Nozaki, 10 months ago
Unable to obtain an object lock on "DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID

Solution icon of apache
via james-server-user by Kohei Nozaki, 10 months ago
Unable to obtain an object lock on "DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID

Solution icon of apache
via james-server-user by Eric Charles, 1 year ago
Unable to obtain an object lock on "DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID

Solution icon of stackoverflow
Unable to obtain an object lock on "A lock could not be obtained due to a deadlock, cycle of locks and waiters is: Lock : ROW, GADGET_APPLICATIONS, (2,7) Waiting XID : {429, S} , WORKLIGHT, SELECT t0.ID, t0.ENFORCE_AUTHENTICITY, t0

Solution icon of web
via jboss.org by Unknown author, 1 year ago
Unable to obtain an object lock on "null". FailedObject: SELECT DISTINCT e FROM AdmUserAccountT e LEFT OUTER JOIN FETCH e.admAgencyBranchTs WHERE (e.admLookupCodeT.codeValue=:role0) [java.lang.String]

Solution icon of coderanch
via Coderanch by Thirumani Selvam Muthuswamy, 8 months ago
Unable to obtain an object lock on "null [java.lang.String]". FailedObject: null [java.lang.String]

Solution icon of web
Unable to obtain an object lock on "null".

Solution icon of apache
via Apache's JIRA Issue Tracker by Albert Lee, 1 year ago
An optimistic lock violation was detected when flushing object instance "An optimistic lock violation was detected when locking object instance. [java.lang.String]" to the data store. This indicates that the object was concurrently modified in another transaction. FailedObject: 234 [java.lang.Long]

Solution icon of coderanch
via Coderanch by Johnny Caimbridge, 8 months ago
An optimistic lock violation was detected when flushing object instance "com.jpa.entities.BobRun-NULL" to the data store. This indicates that the object was concurrently modified in another transaction. FailedObject: com.jpa.entities.BobRun-NULL

Stack trace

  • org.apache.openjpa.persistence.OptimisticLockException: Unable to obtain an object lock on "DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID = APP.JAMES_MAIL.MAIL_UID)) [java.lang.String]". FailedObject: DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID = APP.JAMES_MAIL.MAIL_UID)) [java.lang.String] at org.apache.openjpa.jdbc.sql.DBDictionary.narrow(DBDictionary.java:4940) at org.apache.openjpa.jdbc.sql.DBDictionary.newStoreException(DBDictionary.java:4918) at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:136) at org.apache.openjpa.jdbc.sql.SQLExceptions.getStore(SQLExceptions.java:78) at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeBulkOperation(JDBCStoreQuery.java:579) at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeDelete(JDBCStoreQuery.java:491) at org.apache.openjpa.kernel.ExpressionStoreQuery$DataStoreExecutor.executeDelete(ExpressionStoreQuery.java:789) at org.apache.openjpa.kernel.QueryImpl.delete(QueryImpl.java:1025) at org.apache.openjpa.kernel.QueryImpl.execute(QueryImpl.java:865) at org.apache.openjpa.kernel.QueryImpl.deleteAll(QueryImpl.java:892) at org.apache.openjpa.kernel.DelegatingQuery.deleteAll(DelegatingQuery.java:574) at org.apache.openjpa.persistence.QueryImpl.executeUpdate(QueryImpl.java:374) at org.apache.james.mailbox.jpa.mail.JPAMessageMapper.deleteDeletedMessagesInMailboxWithUID(JPAMessageMapper.java:378) at org.apache.james.mailbox.jpa.mail.JPAMessageMapper.expungeMarkedForDeletionInMailbox(JPAMessageMapper.java:240) Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: A lock could not be obtained due to a deadlock, cycle of locks and waiters is: Lock : ROW, JAMES_MAIL, (735,6) Waiting XID : {123722435, U} , APP, DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID = APP.JAMES_MAIL.MAIL_UID)) Granted XID : {123722454, X} Lock : TABLE, JAMES_MAIL_PROPERTY, Tablelock Waiting XID : {123722454, IX} , APP, INSERT INTO APP.JAMES_MAIL_PROPERTY (PROPERTY_ID, PROPERTY_LINE_NUMBER, PROPERTY_LOCAL_NAME, PROPERTY_NAME_SPACE, PROPERTY_VALUE, MAILBOX_ID, MAIL_UID) VALUES (?, ?, ?, ?, ?, ?, ?) Granted XID : {123722435, X} . The selected victim is XID : 123722435. {prepstmnt 239961255 DELETE FROM APP.JAMES_MAIL WHERE EXISTS (SELECT 1 FROM APP.JAMES_MAIL t0 WHERE (t0.MAILBOX_ID = ? AND t0.MAIL_UID = ? AND t0.MAIL_IS_DELETED = ?) AND (t0.MAILBOX_ID = APP.JAMES_MAIL.MAILBOX_ID AND t0.MAIL_UID = APP.JAMES_MAIL.MAIL_UID))} [code=30000, state=40001] at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:219) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:195) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$1000(LoggingConnectionDecorator.java:59) at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingPreparedStatement.executeUpdate(LoggingConnectionDecorator.java:1134) at org.apache.openjpa.lib.jdbc.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:272) at org.apache.openjpa.jdbc.kernel.JDBCStoreManager$CancelPreparedStatement.executeUpdate(JDBCStoreManager.java:1765) at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeUpdate(JDBCStoreQuery.java:746) at org.apache.openjpa.jdbc.kernel.JDBCStoreQuery.executeBulkOperation(JDBCStoreQuery.java:577) ... 14 more

Write tip

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

Users with the same issue

Samebug visitor profile picture
Unknown user
Once, 11 months ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
60 times, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
Samebug visitor profile picture
Unknown user
Once, 1 year ago
3 more bugmates