问题
DB: PostgreSQL 9.2
Hosting: Openshift
Configuration:
org.quartz.scheduler.instanceName = OneTimeJob
org.quartz.threadPool.threadCount = 3
org.quartz.jobStore.useProperties = true
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.class = org.quartz.impl.jdbcjobstore.JobStoreTX
org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate
org.quartz.jobStore.dataSource = Name
org.quartz.dataSource.Name.connectionProvider.class = com.name.scheduler.DBConnectionProvider
Stacktrace:
An SQLException was provoked by the following failure: java.lang.ArrayIndexOutOfBoundsException at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:65) at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:62) at com.mchange.v2.c3p0.impl.NewPooledConnection.handleThrowable(NewPooledConnection.java:369) at com.mchange.v2.c3p0.impl.NewProxyResultSet.getBytes(NewProxyResultSet.java:2795) at org.quartz.impl.jdbcjobstore.PostgreSQLDelegate.getJobDataFromBlob(PostgreSQLDelegate.java:88) at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.getMapFromProperties(StdJDBCDelegate.java:881) at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:1778) at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTriggersForJob(StdJDBCDelegate.java:1704) at org.quartz.impl.jdbcjobstore.JobStoreSupport.getTriggersForJob(JobStoreSupport.java:2141)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2 at org.postgresql.util.PGbytea.toBytes(PGbytea.java:76) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBytes(AbstractJdbc2ResultSet.java:2271) at org.postgresql.jdbc2.AbstractJdbc2ResultSet.getBytes(AbstractJdbc2ResultSet.java:2451) at com.mchange.v2.c3p0.impl.NewProxyResultSet.getBytes(NewProxyResultSet.java:2781)
PS: Works with postgres 9.4
回答1:
This JIRA https://issues.liferay.com/browse/LPS-15133 has the same stack trace and it tels it is a matter of an out dated driver.
If you have tried with last version of PostgreSQL jdbc driver, maybe you include a dependency from org.postgresql
groupId, and logback
depends on old version of driver with postgres
as groupId, thus you are including both dependencies in your app.
Please, try to exclude the old jdbc version this way:
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.3</version>
<exclusions>
<exclusion>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
</exclusion>
</exclusions>
</dependency>
And tell us if this exlcusion makes your app to work.
Hope it helps!
来源:https://stackoverflow.com/questions/32936429/postgresql-quartz-jdbc-jobstoretx-gettriggersforjob-arrayindexoutofboundse