You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When a batch job is started from a managed transaction (e.g. from a stateless EJB), it sometimes (not always) fails to execute the job.
This is with the default configuration when the Batch engine uses the default H2 datasource. I haven't tested with other databases.
When the job fails, there's a NullPointerException in the server log. It turns out that it's not the original exception, it only covers the original PersistenceException exception, which is swallowed. The information from the debugger shows that the original PersistenceException says:
But when I check the data in the database, the table EXECUTIONINSTANCEDATA contains the JOBEXECID which is going to be inserted into STEPEXECUTIONINSTANCEDATA. This probably means that it wasn't in the table at the time when the INSERT into STEPEXECUTIONINSTANCEDATA was executed but it was added later.
Expected Outcome
A timer defined on a Stateless EJB starts a Batch job with the following code:
BatchRuntime.getJobOperator().start("EventFilesProcessorJob", null); // the EventFilesProcessorJob job is defined as a Batch job in a XML file at the expected location
The job runs successfully as defined in the XML, without any exceptions.
Current Outcome
Most of the times, the batch job runs successfully as expected. Sometimes (roughly 1 in 10 times), it fails with the following stacktrace:
According to the source code, the exception is raised from a catch block that is already handling an exception. The original exception is swallowed but the debugger shows that this is the original exception:
AlanRoth
changed the title
A batch Job started from a managed transaction sometimes leads to a failed execution and NullPointerException
A batch Job started from a managed transaction sometimes leads to a failed execution and NullPointerException / FISH-1414
Apr 27, 2021
Description
When a batch job is started from a managed transaction (e.g. from a stateless EJB), it sometimes (not always) fails to execute the job.
This is with the default configuration when the Batch engine uses the default H2 datasource. I haven't tested with other databases.
When the job fails, there's a NullPointerException in the server log. It turns out that it's not the original exception, it only covers the original PersistenceException exception, which is swallowed. The information from the debugger shows that the original PersistenceException says:
But when I check the data in the database, the table EXECUTIONINSTANCEDATA contains the JOBEXECID which is going to be inserted into STEPEXECUTIONINSTANCEDATA. This probably means that it wasn't in the table at the time when the INSERT into STEPEXECUTIONINSTANCEDATA was executed but it was added later.
Expected Outcome
A timer defined on a Stateless EJB starts a Batch job with the following code:
The job runs successfully as defined in the XML, without any exceptions.
Current Outcome
Most of the times, the batch job runs successfully as expected. Sometimes (roughly 1 in 10 times), it fails with the following stacktrace:
nullpointer_stacktrace.txt
According to the source code, the exception is raised from a catch block that is already handling an exception. The original exception is swallowed but the debugger shows that this is the original exception:
persistenceexc_stacktrace.txt
Steps to reproduce (Only for bug reports)
Just build the attached application batch-issue.zip with
mvn install
and deploy to Payara Server.Context (Optional)
This issue was originally reported in Payara Forum for the CargoTracker project.
Environment
The text was updated successfully, but these errors were encountered: