Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error using Oracle DB as default job repository #286

Open
Motta-Felipe opened this issue May 17, 2023 · 2 comments
Open

Error using Oracle DB as default job repository #286

Motta-Felipe opened this issue May 17, 2023 · 2 comments
Assignees

Comments

@Motta-Felipe
Copy link

Motta-Felipe commented May 17, 2023

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 (DDL), 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 to insert NULL in ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")

It's look like It's trying to save a Job with JOBINSTANCEID null.

Environment:
Wildfly 27.0.1.Final
Jakarta 10 API
DB: Oracle DB 21cXE

Configuration in standalone-full.xml :
Repository configuration

    <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>

DataSource configuration

    <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>

complete error stack trace

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 [email protected]//com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:83)
at [email protected]//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 [email protected]//com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:56)
at [email protected]//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
at [email protected]//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 [email protected]//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at [email protected]//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 [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at [email protected]//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at [email protected]//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at [email protected]//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at [email protected]//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at [email protected]//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at [email protected]//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest$1(ElytronRunAsHandler.java:68)
at [email protected]//org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
at [email protected]//org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
at [email protected]//org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
at [email protected]//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
at [email protected]//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at [email protected]//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at [email protected]//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at [email protected]//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at [email protected]//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 [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at [email protected]//io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at [email protected]//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at [email protected]//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at [email protected]//io.undertow.server.Connectors.executeRootHandler(Connectors.java:391)
at [email protected]//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at [email protected]//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 [email protected]//com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:76)
at [email protected]//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 [email protected]//org.jberet.repository.JdbcRepository.insertJobInstance(JdbcRepository.java:329)
at [email protected]//org.jberet.repository.AbstractPersistentRepository.createJobInstance(AbstractPersistentRepository.java:105)
at [email protected]//org.wildfly.extension.batch.jberet.job.repository.JobRepositoryService.createJobInstance(JobRepositoryService.java:112)
at [email protected]//org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService.createJobInstance(JdbcJobRepositoryService.java:45)
at [email protected]//org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:145)
at [email protected]//org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:142)
at [email protected]//org.jberet.operations.AbstractJobOperator.invokeTransaction(AbstractJobOperator.java:465)
at [email protected]//org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:142)
at [email protected]//org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:102)
at [email protected]//org.wildfly.extension.batch.jberet.deployment.JobOperatorService.start(JobOperatorService.java:258)
at [email protected]//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 [email protected]//org.glassfish.expressly.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:186)
at [email protected]//org.glassfish.expressly.parser.AstValue.invoke(AstValue.java:253)
at [email protected]//org.glassfish.expressly.MethodExpressionImpl.invoke(MethodExpressionImpl.java:248)
at [email protected]//org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at [email protected]//org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at [email protected]//com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:70)
... 58 more
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: impossibile inserire NULL in ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")

at [email protected]//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:702)
at [email protected]//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:608)
at [email protected]//oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1335)
at [email protected]//oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:1041)
at [email protected]//oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:443)
at [email protected]//oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:533)
at [email protected]//oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:262)
at [email protected]//oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1392)
at [email protected]//oracle.jdbc.driver.OracleStatement.executeSQLStatement(OracleStatement.java:1877)
at [email protected]//oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1520)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3751)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:4078)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:4049)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:997)
at [email protected]//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
at [email protected]//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: impossibile inserire NULL in ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")

at [email protected]//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:710)
... 94 more

12:14:26,015 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /taskbatch/my_face_page.xhtml: jakarta.servlet.ServletException: JBERET000626: Failed to run INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?)
at jakarta.faces.api//jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:709)
at jakarta.faces.api//jakarta.faces.webapp.FacesServlet.service(FacesServlet.java:449)
at [email protected]//io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:74)
at [email protected]//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 [email protected]//io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:67)
at [email protected]//io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
at [email protected]//io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
at [email protected]//io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
at [email protected]//io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68)
at [email protected]//io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
at [email protected]//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.lambda$handleRequest$1(ElytronRunAsHandler.java:68)
at [email protected]//org.wildfly.security.auth.server.FlexibleIdentityAssociation.runAsFunctionEx(FlexibleIdentityAssociation.java:103)
at [email protected]//org.wildfly.security.auth.server.Scoped.runAsFunctionEx(Scoped.java:161)
at [email protected]//org.wildfly.security.auth.server.Scoped.runAs(Scoped.java:73)
at [email protected]//org.wildfly.elytron.web.undertow.server.ElytronRunAsHandler.handleRequest(ElytronRunAsHandler.java:67)
at [email protected]//io.undertow.servlet.handlers.RedirectDirHandler.handleRequest(RedirectDirHandler.java:68)
at [email protected]//io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:117)
at [email protected]//io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
at [email protected]//io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
at [email protected]//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 [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//org.wildfly.extension.undertow.deployment.GlobalRequestControllerHandler.handleRequest(GlobalRequestControllerHandler.java:68)
at [email protected]//io.undertow.servlet.handlers.SendErrorPageHandler.handleRequest(SendErrorPageHandler.java:52)
at [email protected]//io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:275)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:134)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:131)
at [email protected]//io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48)
at [email protected]//io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$UndertowThreadSetupAction.lambda$create$0(UndertowDeploymentInfoService.java:1435)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:255)
at [email protected]//io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:100)
at [email protected]//io.undertow.server.Connectors.executeRootHandler(Connectors.java:391)
at [email protected]//io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:859)
at [email protected]//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1990)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
at [email protected]//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
at [email protected]//org.xnio.XnioWorker$WorkerThreadFactory$1$1.run(XnioWorker.java:1282)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: jakarta.batch.operations.BatchRuntimeException: JBERET000626: Failed to run INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?)
at [email protected]//org.jberet.repository.JdbcRepository.insertJobInstance(JdbcRepository.java:329)
at [email protected]//org.jberet.repository.AbstractPersistentRepository.createJobInstance(AbstractPersistentRepository.java:105)
at [email protected]//org.wildfly.extension.batch.jberet.job.repository.JobRepositoryService.createJobInstance(JobRepositoryService.java:112)
at [email protected]//org.wildfly.extension.batch.jberet.job.repository.JdbcJobRepositoryService.createJobInstance(JdbcJobRepositoryService.java:45)
at [email protected]//org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:145)
at [email protected]//org.jberet.operations.AbstractJobOperator$1.invoke(AbstractJobOperator.java:142)
at [email protected]//org.jberet.operations.AbstractJobOperator.invokeTransaction(AbstractJobOperator.java:465)
at [email protected]//org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:142)
at [email protected]//org.jberet.operations.AbstractJobOperator.start(AbstractJobOperator.java:102)
at [email protected]//org.wildfly.extension.batch.jberet.deployment.JobOperatorService.start(JobOperatorService.java:258)
at [email protected]//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 [email protected]//org.glassfish.expressly.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:186)
at [email protected]//org.glassfish.expressly.parser.AstValue.invoke(AstValue.java:253)
at [email protected]//org.glassfish.expressly.MethodExpressionImpl.invoke(MethodExpressionImpl.java:248)
at [email protected]//org.jboss.weld.module.web.util.el.ForwardingMethodExpression.invoke(ForwardingMethodExpression.java:40)
at [email protected]//org.jboss.weld.module.web.el.WeldMethodExpression.invoke(WeldMethodExpression.java:50)
at [email protected]//com.sun.faces.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:70)
at [email protected]//com.sun.faces.application.ActionListenerImpl.getNavigationOutcome(ActionListenerImpl.java:74)
at [email protected]//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 [email protected]//com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:56)
at [email protected]//com.sun.faces.lifecycle.Phase.doPhase(Phase.java:72)
at [email protected]//com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:159)
at jakarta.faces.api//jakarta.faces.webapp.FacesServlet.executeLifecyle(FacesServlet.java:691)
... 49 more
Caused by: java.sql.SQLIntegrityConstraintViolationException: ORA-01400: impossible to insert NULL in ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")

at [email protected]//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:702)
at [email protected]//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:608)
at [email protected]//oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:1335)
at [email protected]//oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:1041)
at [email protected]//oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:443)
at [email protected]//oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:533)
at [email protected]//oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:262)
at [email protected]//oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1392)
at [email protected]//oracle.jdbc.driver.OracleStatement.executeSQLStatement(OracleStatement.java:1877)
at [email protected]//oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1520)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3751)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatement.executeLargeUpdate(OraclePreparedStatement.java:4078)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:4049)
at [email protected]//oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:997)
at [email protected]//org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.executeUpdate(WrappedPreparedStatement.java:537)
at [email protected]//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 to insert NULL in ("TASK_USER"."JOB_INSTANCE"."JOBINSTANCEID")

at [email protected]//oracle.jdbc.driver.T4CTTIoer11.processError(T4CTTIoer11.java:710)
... 94 more

Am I missing anything?

@Motta-Felipe Motta-Felipe changed the title Error using Oracle DB as default job respoistory Error using Oracle DB as default job repository May 17, 2023
@chengfang chengfang self-assigned this May 17, 2023
@chengfang
Copy link
Contributor

When inserting a new row of job instance, jberet relies on the database to generate the primary key (jobinstanceid), as you can see from the statement:

INSERT INTO JOB_INSTANCE(JOBNAME, APPLICATIONNAME) VALUES(?, ?)

With Oracle db, jberet uses a trigger to achieve that:

FOR EACH ROW
  BEGIN
    SELECT JOB_INSTANCE_SEQ.nextval INTO :new.JOBINSTANCEID FROM dual;
  END;

Not sure why oracle still sees null jobinstanceid. It should've been generated by the above trigger.

Have you tried an older version of Oracle db?

@Motta-Felipe
Copy link
Author

Yes, I also tried with Oracle DB version 18, and it didn't work either.

I discovered that the jberet oracle DLL is generating tables and sequences, but for some reason, it's not generating the triggers.
TASKBATCH
So I manually compiled the triggers (found here), and now everything is working fine!

Thanks, @chengfang!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants