Error using Oracle DB as default job repository in Jakarta batch (JSR352 -Wildfly / jberet)

huangapple go评论71阅读模式
英文:

Error using Oracle DB as default job repository in Jakarta batch (JSR352 -Wildfly / jberet)

问题

我正在运行一个 Jakarta 10 应用程序在 Wildfly 27.0.1.Final 服务器上(实现 Jakarta batch 使用 Jberet)。

我想在 JBeret 中使用 JDBC 作业存储库。

当我使用默认的 "in-memory" 存储库或 MySQL 存储库时,一切都正常运行。但是,当我尝试使用 Oracle 存储库时,即使 Jberet 使用的表已经正确生成(我认为如此),在执行作业时我遇到了这个错误。

Caused by: Error : 1400, Position : 0, SQL = INSERT INTO 
JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(:1 , :2 ) RETURNING 
JOBINSTANCEID INTO :3  [SQL INCLUDES EXPRESSIONS ADDED BY THE ORACLE 
JDBC DRIVER], Original SQL = INSERT INTO JOB_INSTANCE(JOBNAME, 
APPLICATIONNAME) VALUES(?, ?) RETURNING JOBINSTANCEID INTO ?, Error 
Message = ORA-01400: impossible insert NULL in 
("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")

环境:

  • Wildfly 27.0.1.Final
  • Jakarta 10 -> Jakarta Batch 2.1
  • 用于作业存储库的数据库:Oracle DB 21cXE

在 standalone-full.xml 中的配置如下:

存储库配置

    <subsystem xmlns="urn:jboss:domain:batch-jberet:3.0">
        <default-job-repository name="oracle-repository"/>
        <default-thread-pool name="batch"/>
        <job-repository name="in-memory">
            <in-memory/>
        </job-repository>
        <job-repository name="mysql-repository">
            <jdbc data-source="MysqlDataSource"/>
        </job-repository>
        <job-repository name="oracle-repository">
            <jdbc data-source="OracleDS"/>
        </job-repository>
        <thread-pool name="batch">
            <max-threads count="10"/>
            <keepalive-time time="30" unit="seconds"/>
        </thread-pool>
    </subsystem>

数据源配置

    <subsystem xmlns="urn:jboss:domain:datasources:7.0">
        <datasources>
            <!-- 省略其他数据源配置 -->
            <datasource jndi-name="java:jboss/datasources/OracleDS" pool-name="OracleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
                <connection-url>jdbc:oracle:thin:@localhost:1521:XE</connection-url>
                <driver>oracle</driver>
                <security>
                    <user-name>TASK_USER</user-name>
                    <password>taskpass</password>
                </security>
            </datasource>
            <!-- 省略其他数据源配置 -->
        </datasources>
    </subsystem>

完整的错误堆栈跟踪请参考您的原始帖子。

请问还有其他问题吗?

英文:

I'm running a Jakarta 10 application in Wildfly 27.0.1.Final server (thats implement Jakarta batch using Jberet)

I want to use a JDBC Job Repository in JBeret.

Everything runs okay when I use the default "in-memory" repository or when I use the MySQL repository. However, when I try to use the Oracle repository, even though the tables used by Jberet are correctly generated (I think so), I encounter this error when I execute a job.

Caused by: Error : 1400, Position : 0, SQL = INSERT INTO 
JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(:1 , :2 ) RETURNING 
JOBINSTANCEID INTO :3  [SQL INCLUDES EXPRESSIONS ADDED BY THE ORACLE 
JDBC DRIVER], Original SQL = INSERT INTO JOB_INSTANCE(JOBNAME, 
APPLICATIONNAME) VALUES(?, ?) RETURNING JOBINSTANCEID INTO ?, Error 
Message = ORA-01400: impossible insert NULL in 
(&quot;TASK_USER&quot;.&quot;JOB_INSTANCE&quot;.&quot;JOBINSTANCEID&quot;)

Environment:
Wildfly 27.0.1.Final
Jakarta 10 -&gt; Jakarta Batch 2.1
DB for job-repository: Oracle DB 21cXE

Configuration in standalone-full.xml:
Repository configuration

    &lt;subsystem xmlns=&quot;urn:jboss:domain:batch-jberet:3.0&quot;&gt;
        &lt;default-job-repository name=&quot;oracle-repository&quot;/&gt;
        &lt;default-thread-pool name=&quot;batch&quot;/&gt;
        &lt;job-repository name=&quot;in-memory&quot;&gt;
            &lt;in-memory/&gt;
        &lt;/job-repository&gt;
        &lt;job-repository name=&quot;mysql-repository&quot;&gt;
            &lt;jdbc data-source=&quot;MysqlDataSource&quot;/&gt;
        &lt;/job-repository&gt;
        &lt;job-repository name=&quot;oracle-repository&quot;&gt;
            &lt;jdbc data-source=&quot;OracleDS&quot;/&gt;
        &lt;/job-repository&gt;
        &lt;thread-pool name=&quot;batch&quot;&gt;
            &lt;max-threads count=&quot;10&quot;/&gt;
            &lt;keepalive-time time=&quot;30&quot; unit=&quot;seconds&quot;/&gt;
        &lt;/thread-pool&gt;
    &lt;/subsystem&gt;

DataSource configuration

    &lt;subsystem xmlns=&quot;urn:jboss:domain:datasources:7.0&quot;&gt;
        &lt;datasources&gt;
            &lt;datasource jndi-name=&quot;java:jboss/datasources/ExampleDS&quot; pool-name=&quot;ExampleDS&quot; enabled=&quot;true&quot; use-java-context=&quot;true&quot; statistics-enabled=&quot;${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}&quot;&gt;
                &lt;connection-url&gt;jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=${wildfly.h2.compatibility.mode:REGULAR}&lt;/connection-url&gt;
                &lt;driver&gt;h2&lt;/driver&gt;
                &lt;security&gt;
                    &lt;user-name&gt;sa&lt;/user-name&gt;
                    &lt;password&gt;sa&lt;/password&gt;
                &lt;/security&gt;
            &lt;/datasource&gt;
            &lt;datasource jndi-name=&quot;java:jboss/datasources/OracleDS&quot; pool-name=&quot;OracleDS&quot; enabled=&quot;true&quot; use-java-context=&quot;true&quot; statistics-enabled=&quot;${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}&quot;&gt;
                &lt;connection-url&gt;jdbc:oracle:thin:@localhost:1521:XE&lt;/connection-url&gt;
                &lt;driver&gt;oracle&lt;/driver&gt;
                &lt;security&gt;
                    &lt;user-name&gt;TASK_USER&lt;/user-name&gt;
                    &lt;password&gt;taskpass&lt;/password&gt;
                &lt;/security&gt;
            &lt;/datasource&gt;
            &lt;datasource jndi-name=&quot;java:jboss/datasources/MysqlDataSource&quot; pool-name=&quot;MysqlDataSource&quot; enabled=&quot;true&quot; use-java-context=&quot;true&quot; statistics-enabled=&quot;${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}&quot;&gt;
                &lt;connection-url&gt;jdbc:mysql://127.0.0.1:3306/taskdb&lt;/connection-url&gt;
                &lt;driver&gt;mysql&lt;/driver&gt;
                &lt;security&gt;
                    &lt;user-name&gt;TASK_USER&lt;/user-name&gt;
                    &lt;password&gt;taskpass&lt;/password&gt;
                &lt;/security&gt;
            &lt;/datasource&gt;
            &lt;drivers&gt;
                &lt;driver name=&quot;h2&quot; module=&quot;com.h2database.h2&quot;&gt;
                    &lt;xa-datasource-class&gt;org.h2.jdbcx.JdbcDataSource&lt;/xa-datasource-class&gt;
                &lt;/driver&gt;
                &lt;driver name=&quot;oracle&quot; module=&quot;com.oracle&quot;&gt;
                    &lt;driver-class&gt;oracle.jdbc.driver.OracleDriver&lt;/driver-class&gt;
                &lt;/driver&gt;
                &lt;driver name=&quot;mysql&quot; module=&quot;com.mysql&quot;&gt;
                    &lt;driver-class&gt;com.mysql.cj.jdbc.Driver&lt;/driver-class&gt;
                    &lt;xa-datasource-class&gt;com.mysql.cj.jdbc.MysqlXADataSource&lt;/xa-datasource-class&gt;
                &lt;/driver&gt;
            &lt;/drivers&gt;
        &lt;/datasources&gt;

Complete error stack trace

WARNING [jakarta.enterprise.resource.webcontainer.faces.lifecycle] (default task-1) #{JSFBean.doJob}: /my_face_page.xhtml @16,84 action=&quot;#{JSFBean.doJob}&quot;: jakarta.batch.operations.BatchRuntimeException: JBERET000626: Failed to run INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?): jakarta.faces.FacesException: #{JSFBean.doJob}: /my_face_page.xhtml @16,84 action=&quot;#{JSFBean.doJob}&quot;: jakarta.batch.operations.BatchRuntimeException: JBERET000626: Failed to run INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:83)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:62)
at jakarta.faces.api//jakarta.faces.component.UICommand.broadcast(UICommand.java:205)
at jakarta.faces.api//jakarta.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:858)
at jakarta.faces.api//jakarta.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1332)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:56)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:159)
at jakarta.faces.api//jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:691)
at jakarta.faces.api//jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
at io.smallrye.opentracing-contrib//io.smallrye.opentracing.contrib.jaxrs2.server.SpanFinishingFilter.doFilter(SpanFinishingFilter.java:69)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at org.wildfly.security.elytron-web.undertow-server@3.0.0.Final//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest$1(ElytronRunAsHandler.java:68)
at org.wildfly.security.elytron-base@2.0.0.Final//org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
at org.wildfly.security.elytron-base@2.0.0.Final//org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
at org.wildfly.security.elytron-base@2.0.0.Final//org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
at org.wildfly.security.elytron-web.undertow-server@3.0.0.Final//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at io.undertow.core@2.3.0.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.core@2.3.0.Final//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at io.undertow.core@2.3.0.Final//io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
at org.wildfly.security.elytron-web.undertow-server-servlet@3.0.0.Final//org.wildfly.elytron.web.undertow.server.servlet.CleanUpHandler.handleRequest(CleanUpHandler.java:38)
at io.undertow.core@2.3.0.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.core@2.3.0.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at io.undertow.core@2.3.0.Final//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at org.wildfly.extension.undertow@27.0.1.Final//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
at io.undertow.servlet@2.3.0.Final//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at io.undertow.core@2.3.0.Final//io.undertow.server.Connectors.executeRootHandler(Connectors.java:391)
at io.undertow.core@2.3.0.Final//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at org.jboss.threads@2.4.0.Final//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at org.jboss.xnio@3.8.8.Final//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: jakarta.el.ELException: /my_face_page.xhtml @16,84 action=&quot;#{JSFBean.doJob}&quot;: jakarta.batch.operations.BatchRuntimeException: JBERET000626: Failed to run INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:76)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:74)
... 57 more
Caused by: jakarta.batch.operations.BatchRuntimeException: JBERET000626: Failed to run INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.repository.JdbcRepository.insertJobInstance(JdbcRepository.java:329)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.repository.AbstractPersistentRepository.createJobInstance(AbstractPersistentRepository.java:105)
at org.wildfly.extension.batch.jberet@27.0.1.Final//org.wildfly.extension.batch.jberet.job.repository.JobRepositoryService.createJobInstance(JobRepositoryService.java:112)
at org.wildfly.extension.batch.jberet@27.0.1.Final//org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService.createJobInstance(JdbcJobRepositoryService.java:45)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:145)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:142)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.operations.AbstractJobOperator.invokeTransaction(AbstractJobOperator.java:465)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:142)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:102)
at org.wildfly.extension.batch.jberet@27.0.1.Final//org.wildfly.extension.batch.jberet.deployment.JobOperatorService.start(JobOperatorService.java:258)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.operations.DelegatingJobOperator.start(DelegatingJobOperator.java:68)
at deployment.taskbatch.war//com.rb.batch.mybatch.JSFBean.doJob(JSFBean.java:28)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.glassfish.expressly@5.0.0//org.glassfish.expressly.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:186)
at org.glassfish.expressly@5.0.0//org.glassfish.expressly.parser.AstValue.invoke(AstValue.java:253)
at org.glassfish.expressly@5.0.0//org.glassfish.expressly.MethodExpressionImpl.invoke(MethodExpressionImpl.java:248)
at org.jboss.weld.core@5.1.0.Final//org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at org.jboss.weld.core@5.1.0.Final//org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at com.sun.jsf-impl@4.0.0.SP01//com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:70)
... 58 more
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: impossible insert NULL in (&quot;TASK_USER&quot;.&quot;JOB_INSTANCE&quot;.&quot;JOBINSTANCEID&quot;)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:702)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:608)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1335)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:1041)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:443)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:533)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:262)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1392)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.OracleStatement.executeSQLStatement(OracleStatement.java:1877)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1520)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3751)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:4078)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:4049)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:997)
at org.jboss.ironjacamar.jdbcadapters@1.5.9.Final//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
at org.jberet.jberet-core@2.1.1.Final//org.jberet.repository.JdbcRepository.insertJobInstance(JdbcRepository.java:323)
... 79 more
Caused by: Error : 1400, Position : 0, SQL = INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(:1 , :2 ) RETURNING JOBINSTANCEID INTO :3  [SQL INCLUDES EXPRESSIONS ADDED BY THE ORACLE JDBC DRIVER], Original SQL = INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?) RETURNING JOBINSTANCEID INTO ?, Error Message = ORA-01400: impossible insert NULL in (&quot;TASK_USER&quot;.&quot;JOB_INSTANCE&quot;.&quot;JOBINSTANCEID&quot;)
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:710)
... 94 more

Am I missing anything?

答案1

得分: 0

我发现jberet oracle DLL正在生成表和序列,但出于某种原因,它没有生成触发器。

因此,我手动编译了这些触发器(在此处找到),现在一切都正常运行!

CREATE OR REPLACE TRIGGER JOB_INSTANCE_BRI
BEFORE INSERT ON JOB_INSTANCE
FOR EACH ROW
  BEGIN
    SELECT JOB_INSTANCE_SEQ.nextval INTO :new.JOBINSTANCEID FROM dual;
  END;

CREATE OR REPLACE TRIGGER JOB_EXECUTION_BRI
BEFORE INSERT ON JOB_EXECUTION
FOR EACH ROW
  BEGIN
    SELECT JOB_EXECUTION_SEQ.nextval INTO :new.JOBEXECUTIONID FROM dual;
  END;

CREATE OR REPLACE TRIGGER STEP_EXECUTION_BRI
BEFORE INSERT ON STEP_EXECUTION
FOR EACH ROW
  BEGIN
    SELECT STEP_EXECUTION_SEQ.nextval INTO :new.STEPEXECUTIONID FROM dual;
  END;
英文:

I discovered that the jberet oracle DLL is generating tables and sequences, but for some reason, it's not generating the triggers.

Error using Oracle DB as default job repository in Jakarta batch (JSR352 -Wildfly / jberet)

So I manually compiled the triggers (found here), and now everything is working fine!

CREATE OR REPLACE TRIGGER JOB_INSTANCE_BRI
BEFORE INSERT ON JOB_INSTANCE
FOR EACH ROW
BEGIN
SELECT JOB_INSTANCE_SEQ.nextval INTO :new.JOBINSTANCEID FROM dual;
END;
CREATE OR REPLACE TRIGGER JOB_EXECUTION_BRI
BEFORE INSERT ON JOB_EXECUTION
FOR EACH ROW
BEGIN
SELECT JOB_EXECUTION_SEQ.nextval INTO :new.JOBEXECUTIONID FROM dual;
END;
CREATE OR REPLACE TRIGGER STEP_EXECUTION_BRI
BEFORE INSERT ON STEP_EXECUTION
FOR EACH ROW
BEGIN
SELECT STEP_EXECUTION_SEQ.nextval INTO :new.STEPEXECUTIONID FROM dual;
END;

huangapple
  • 本文由 发表于 2023年5月17日 21:40:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76272782.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定