Applying the following configuration in standalone-full-ha.xml
.
<timer-service thread-pool-name="timer" default-data-store="clustered-store">
<data-stores>
<database-data-store name="clustered-store"
datasource-jndi-name="java:jboss/datasources/projectXADatasource"
database="mysql"
partition="timer"/>
</data-stores>
</timer-service>
The XA datasource located at java:jboss/datasources/projectXADatasource
already works fine.
The application does not get deployed. The deployment process fails with the following error.
ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("deploy") failed
- address: ([("deployment" => "WildFly.ear")])
- failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => ["jboss.deployment.subunit.\"WildFly.ear\".\"WildFly-ejb.jar\".component.BackgroundJobManager.ejb3.timerService is missing [jboss.thread.executor.ejb3.timer]"]}
Applying the same configuration to non-clustered environment (standalone-full.xml
) also fails with the same error.
The only thing I have changed is the DDL statement from
create-table.mysql=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(255) PRIMARY KEY NOT NULL...
to
create-table.mysql=CREATE TABLE JBOSS_EJB_TIMER (ID VARCHAR(191) PRIMARY KEY NOT NULL...
available under ${Home}/modules/system/layers/base/org/jboss/as/ejb3/main/timers/timer-sql.properties
Because MySQL is configured to use the utf8mb4
character set which VARCHAR(255)
exceeds for a primary key (767 bytes).
The JDBC driver gives the following error even after this change.
21:07:07,750 ERROR [org.jboss.as.ejb3] (MSC service thread 1-7) WFLYEJB0163: Cannot create table for timer persistence: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:404)
at com.mysql.jdbc.Util.getInstance(Util.java:387)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:941)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3870)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3806)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2470)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2617)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2546)
at com.mysql.jdbc.StatementImpl.executeUpdateInternal(StatementImpl.java:1541)
at com.mysql.jdbc.StatementImpl.executeLargeUpdate(StatementImpl.java:2605)
at com.mysql.jdbc.StatementImpl.executeUpdate(StatementImpl.java:1469)
at com.mysql.jdbc.jdbc2.optional.StatementWrapper.executeUpdate(StatementWrapper.java:749)
at org.jboss.jca.adapters.jdbc.WrappedStatement.executeUpdate(WrappedStatement.java:414)
at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.checkDatabase(DatabaseTimerPersistence.java:286)
at org.jboss.as.ejb3.timerservice.persistence.database.DatabaseTimerPersistence.start(DatabaseTimerPersistence.java:160)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
But I do not think this is relevant to the root problem. The table is created even after this error.
How to fix this error?
component.BackgroundJobManager.ejb3.timerService is missing [jboss.thread.executor.ejb3.timer]
Where BackgroundJobManager
is a singleton EJB having a persistent timer in it. The timer is persisted correctly in the file system (default) but it fails to persist to the database.
I am on WildFly 9.0.2 final.
Currently, I am going with the default thread-pool
as follows.
<timer-service thread-pool-name="default" default-data-store="clustered-store">
<data-stores>
<database-data-store name="clustered-store" datasource-jndi-name="java:jboss/datasources/projectXADatasource" database="mysql" partition="timer"/>
</data-stores>
</timer-service>
and the default thread-pool
in standalone-full-ha.xml
is defined as follows.
<thread-pools>
<thread-pool name="default">
<max-threads count="10"/>
<keepalive-time time="100" unit="milliseconds"/>
</thread-pool>
</thread-pools>
Any other thoughts or suggestions are welcome.