开发者

Glassfish EJB Timer Service issues with Read-Only or Locked Derby Database [closed]

开发者 https://www.devze.com 2023-04-11 18:51 出处:网络
Closed. This question needs debugging details. It is not currently accepting answers. Edit the question to include desired behavior, a specific problem or error, and the shortest code necess
Closed. This question needs debugging details. It is not currently accepting answers.

Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.

Closed 6 years ago.

Improve this question

I have two Solaris servers, each with a new installation of Glassfish 3.1.1 (Build 12) and Java 1.6.0_27. The Glassfish servers appear to be fully functional, except I am unable to deploy applications that leverage the EJB Timer Service. By default the Timer Service depends on a table, "EJB_TIMER_TBL", created within the default "__TimerPool" Connection Pool to store state information. On one server the error is:

java.sql.SQLException: An SQL data change is not permitted for a read-only connection, user or database.

On the other server, the error is:

ERROR 40XL1: A开发者_StackOverflow中文版 lock could not be obtained within the time requested

I had believed the issue was file permissions related. However I have reviewed the file permissions & ownership of the Java and Glassfish installation, including the derby database files under "domains/domain1/lib/databases/ejbtimer" and they are the same as on other Solaris servers where I have not had this issue.

Do you have any ideas what would cause the Derby database to be either 'read-only' or 'locked' in a fresh installation of Glassfish & Java? I recognize there may be two different causes here, but both appeared at the same time, following the same installation steps on two separate servers.

Here are more portions of the stack traces from the Glassfish server.log:

Locked Stack:

[#|2011-10-07T17:35:21.739+0000|WARNING|glassfish3.1.1|javax.enterprise.system.container.ejb.com.sun.ejb.containers|_ThreadID=10;_ThreadName=Thread-2;|EJB5108:Unable to initialize EJB Timer Service. The possible cause is the timer resource is not configured correctly, the database has not been started, or the timer database table has not been created. javax.ejb.EJBException at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:5193) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5091) ...

Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLTransactionRollbackException: A lock could not be obtained within the time requested Error Code: 30000 Call: SELECT "TIMERID", "APPLICATIONID", "BLOB", "CONTAINERID", "CREATIONTIMERAW", "INITIALEXPIRATIONRAW", "INTERVALDURATION", "LASTEXPIRATIONRAW", "OWNERID", "PKHASHCODE", "SCHEDULE", "STATE" FROM "EJB_TIMER_TBL" WHERE (("OWNERID" = ?) AND ("STATE" = ?)) bind => [2 parameters bound] Query: ReadAllQuery(name="findTimersByOwnerAndState" referenceClass=TimerState sql="SELECT "TIMERID", "APPLICATIONID", "BLOB", "CONTAINERID", "CREATIONTIMERAW", "INITIALEXPIRATIONRAW", "INTERVALDURATION", "LASTEXPIRATIONRAW", "OWNERID", "PKHASHCODE", "SCHEDULE", "STATE" FROM "EJB_TIMER_TBL" WHERE (("OWNERID" = ?) AND ("STATE" = ?))") at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:644) ...

Caused by: java.sql.SQLException: A lock could not be obtained within the time requested at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory40.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 95 more Caused by: ERROR 40XL1: A lock could not be obtained within the time requested at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.services.locks.ConcurrentLockSet.lockObject(Unknown Source) at org.apache.derby.impl.services.locks.ConcurrentLockSet.zeroDurationLockObject(Unknown Source) at org.apache.derby.impl.services.locks.AbstractPool.zeroDurationlockObject(Unknown Source) ...

Read-Only Stack:

[#|2011-10-07T18:35:43.498+0000|WARNING|glassfish3.1.1|javax.enterprise.system.container.web.com.sun.enterprise.web|_ThreadID=20;_ThreadName=Thread-2;|StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception javax.ejb.EJBException: Transaction aborted at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5120) ...

Caused by: javax.transaction.RollbackException: Transaction marked for rollback. at com.sun.enterprise.transaction.JavaEETransactionImpl.commit(JavaEETransactionImpl.java:479) at com.sun.enterprise.transaction.JavaEETransactionManagerSimplified.commit(JavaEETransactionManagerSimplified.java:852) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:5114) ... 65 more Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.0.v20110604-r9504): org.eclipse.persistence.exceptions.DatabaseException Internal Exception: java.sql.SQLException: An SQL data change is not permitted for a read-only connection, user or database. Error Code: 20000 Call: INSERT INTO "EJB_TIMER_TBL" ("TIMERID", "APPLICATIONID", "BLOB", "CONTAINERID", "CREATIONTIMERAW", "INITIALEXPIRATIONRAW", "INTERVALDURATION", "LASTEXPIRATIONRAW", "OWNERID", "PKHASHCODE", "SCHEDULE", "STATE") VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) bind => [12 parameters bound] Query: InsertObjectQuery(com.sun.ejb.containers.TimerState@75d8af) at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:324) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeDirectNoSelect(DatabaseAccessor.java:840) at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeNoSelect(DatabaseAccessor.java:906) ...

Caused by: java.sql.SQLException: An SQL data change is not permitted for a read-only connection, user or database. at org.apache.derby.impl.jdbc.SQLExceptionFactory40.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source) ...


I had the same situation with the same error message (Error Code: 20000 Call: INSERT INTO EJB__TIMER__TBL ...) mentioned above (I was not able to deploy ear package using EJB timers) so I have checked my running

glassfish_directory_domains/my_domain/lib/databases/ejbtimer directory.

And I have seen one important thing in this directory after listing it's content: somehow the db.lck file was created under root (perhaps last time I started the domain using sudo accidentally) so I did chown and chgrp for all files in this directory and their subdirectories (of course glassfish domain was stopped during this work).

After that everything was perfect again. My ear package deployed successfully.

Thanks for the cooperative thinking :-)


Derby databases can be read-only because they have been installed on read-only media such as CD-ROMs. They can also be read-only because they are stored in a jar or zip file and accessed directly from that jar/zip. Here's some more information: http://db.apache.org/derby/docs/10.8/devguide/cdevdeploy15325.html


I had the same problem with the same stacktrace. The problem was caused by the glassfish admin password. I had to change it to apply a ssl certificate. After I changed the password the error message occured.

I solved the problem by resetting the glassfish password.

Remove password examples

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号