如何在使用BigQuery的Spring应用程序中使用Quartz Scheduler

问题描述

我正在将Spring Hibernate应用程序从DB2迁移到Big Query。要连接此Java应用程序,我正在使用Simba驱动程序。

此应用程序具有Quartz调度程序。

我在BQ中创建了Quartz调度程序使用的以下表,这些表是: QRTZ_BLOB_TRIGGERS QRTZ_CALENDARS QRTZ_CRON_TRIGGERS QRTZ_FIRED_TRIGGERS QRTZ_JOB_DETAILS QRTZ_LOCKS QRTZ_PAUSED_TRIGGER_GRPS QRTZ_SCHEDULER_STATE QRTZ_SIMPLE_TRIGGERS QRTZ_SIMPROP_TRIGGERS QRTZ_TRIGGERS

applicationContext.xml配置:

   <bean id="datafeedScheduler" class="org.springframework.scheduling.quartz.Schedulerfactorybean">
        <property name="schedulerName" value="datafeedScheduler"/>
        <property name="dataSource" ref="dataSource"/>
        <property name="configLocation" value="classpath:quartz.properties"/>
        <property name="autoStartup" value="false"/>
        <property name="overwriteExistingJobs" value="true"/>
        <property name="waitForJobsToCompleteOnShutdown" value="true"/>
        <property name="jobDetails" ref="datafeedJob"/>
    </bean>

    <bean class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" id="dataSource">
        <property name="driverClassName" value="com.simba.googlebigquery.jdbc42.Driver"/>
        <property name="url" value="jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443;ProjectId=bq-project;DefaultDataset=bq-dataset;OAuthType=0;OAuthServiceAcctEmail=bq-project-email@dev.iam.gserviceaccount.com;OAuthPvtKeyPath=/Users/serviceAccount/<<serviceAccountKey.json>>"/>
        <property name="testOnBorrow" value="true"/>
        <property name="testOnReturn" value="true"/>
        <property name="testWhileIdle" value="true"/>
        <property name="timeBetweenevictionRunsMillis" value="1800000"/>
        <property name="numTestsPerevictionRun" value="3"/>
        <property name="minevictableIdleTimeMillis" value="1800000"/>
        <property name="initialSize" value="5"/>
        <property name="maxActive" value="20"/>
    </bean>

quartz.properties文件

org.quartz.jobStore.driverDelegateClass=org.quartz.impl.jdbcjobstore.StdJDBCDelegate
org.quartz.jobStore.useProperties=false
org.quartz.scheduler.rmi.export=false
org.quartz.scheduler.rmi.createRegistry=false
org.terracotta.quartz.skipUpdateCheck=true

请注意,我添加的11个表是由Quartz框架强制执行的。现在,对于这些Quartz表中定义的某些数据类型,BigQuery中不存在这些数据类型,例如:BLOB,BIGINT,DECIMAL,因此对于这些数据类型,我将其保留为BLOB的字符串; BIGINT为INT64,十进制为NUMERIC。

  1. 如何解决这个问题
  2. 什么是Simba 11380错误

我正在追随异常,

    SEVERE: Exception sending context initialized event to listener instance of class [org.springframework.web.context.ContextLoaderListener]
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'datafeedScheduler' defined in file [/Users/b003598/eclipse-workspace/Rahul/.Metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/PDFM/WEB-INF/classes/meta-inf/spring/applicationContext.xml]: Invocation of init method Failed; nested exception is org.quartz.JobPersistenceException: Couldn't store job: [Simba][JDBC](11380) Null pointer exception. [See nested exception: java.sql.sqlException: [Simba][JDBC](11380) Null pointer exception.]
    at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1574)
    at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.doCreateBean(AbstractAutowireCapablebeanfactory.java:539)
    at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.createBean(AbstractAutowireCapablebeanfactory.java:476)
    at org.springframework.beans.factory.support.Abstractbeanfactory$1.getobject(Abstractbeanfactory.java:303)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.Abstractbeanfactory.doGetBean(Abstractbeanfactory.java:299)
    at org.springframework.beans.factory.support.Abstractbeanfactory.getBean(Abstractbeanfactory.java:194)
    at org.springframework.beans.factory.support.DefaultListablebeanfactory.preInstantiateSingletons(DefaultListablebeanfactory.java:736)
    at org.springframework.context.support.AbstractApplicationContext.finishbeanfactoryInitialization(AbstractApplicationContext.java:757)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)
    at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:434)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)
    at org.springframework.web.context.ContextLoaderListener.contextinitialized(ContextLoaderListener.java:106)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4689)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5155)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$startChild.call(ContainerBase.java:1412)
    at org.apache.catalina.core.ContainerBase$startChild.call(ContainerBase.java:1402)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.quartz.JobPersistenceException: Couldn't store job: [Simba][JDBC](11380) Null pointer exception. [See nested exception: java.sql.sqlException: [Simba][JDBC](11380) Null pointer exception.]
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1107)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$3.execute(JobStoreSupport.java:1079)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport$45.execute(JobStoreSupport.java:3739)
    at org.quartz.impl.jdbcjobstore.JobStoreCMT.executeInLock(JobStoreCMT.java:245)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInLock(JobStoreSupport.java:3735)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.storeJob(JobStoreSupport.java:1075)
    at org.quartz.core.QuartzScheduler.addJob(QuartzScheduler.java:920)
    at org.quartz.impl.StdScheduler.addJob(StdScheduler.java:269)
    at org.springframework.scheduling.quartz.SchedulerAccessor.addJobToScheduler(SchedulerAccessor.java:274)
    at org.springframework.scheduling.quartz.SchedulerAccessor.registerJobsAndTriggers(SchedulerAccessor.java:216)
    at org.springframework.scheduling.quartz.Schedulerfactorybean.afterPropertiesSet(Schedulerfactorybean.java:512)
    at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.invokeInitMethods(AbstractAutowireCapablebeanfactory.java:1633)
    at org.springframework.beans.factory.support.AbstractAutowireCapablebeanfactory.initializeBean(AbstractAutowireCapablebeanfactory.java:1570)
    ... 21 more
Caused by: java.sql.sqlException: [Simba][JDBC](11380) Null pointer exception.
    at com.simba.googlebigquery.googlebigquery.utils.BQCoreUtils.getParamValueAsText(UnkNown Source)
    at com.simba.googlebigquery.googlebigquery.dataengine.BQsqlExecutor.execute(UnkNown Source)
    at com.simba.googlebigquery.jdbc.common.SPreparedStatement.executeWithParams(UnkNown Source)
    at com.simba.googlebigquery.jdbc.common.SPreparedStatement.executeAnyUpdate(UnkNown Source)
    at com.simba.googlebigquery.jdbc.common.SPreparedStatement.executeUpdate(UnkNown Source)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeUpdate(DelegatingPreparedStatement.java:105)
    at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.insertJobDetail(StdJDBCDelegate.java:645)
    at org.quartz.impl.jdbcjobstore.JobStoreSupport.s`enter code here`toreJob(JobStoreSupport.java:1101)
    ... 33 more
Caused by: java.lang.NullPointerException
    ... 42 more

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)