我在Wildfly 27.0.1.Final服务器上运行一个Jakarta 10应用程序(使用Jberet实现Jakarta批处理)
我想在JBeret中使用JDBC作业存储库。
当我使用默认的“内存中”存储库或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 DB for job-repository: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/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=${wildfly.h2.compatibility.mode:REGULAR}</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<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>
<datasource jndi-name="java:jboss/datasources/MysqlDataSource" pool-name="MysqlDataSource" enabled="true" use-java-context="true" statistics-enabled="${wildfly.datasources.statistics-enabled:${wildfly.statistics-enabled:false}}">
<connection-url>jdbc:mysql://127.0.0.1:3306/taskdb</connection-url>
<driver>mysql</driver>
<security>
<user-name>TASK_USER</user-name>
<password>taskpass</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="oracle" module="com.oracle">
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
</driver>
<driver name="mysql" module="com.mysql">
<driver-class>com.mysql.cj.jdbc.Driver</driver-class>
<xa-datasource-class>com.mysql.cj.jdbc.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
完整的错误堆栈跟踪
WARNING [jakarta.enterprise.resource.webcontainer.faces.lifecycle] (default task-1) #{JSFBean.doJob}: /my_face_page.xhtml @16,84 action="#{JSFBean.doJob}": 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="#{JSFBean.doJob}": 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="#{JSFBean.doJob}": 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 ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")
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 ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")
at com.oracle@23.2.0.0.0//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:710)
... 94 more
我错过什么了吗?
1条答案
按热度按时间67up9zun1#
我发现jberet oracle DLL正在生成表和序列,但由于某种原因,它没有生成触发器。
所以我手动编译了触发器(found here),现在一切都正常了!