question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

setTaskIdGenerator(new DbIdGenerator()) with H2 causes NPE

See original GitHub issue

HI, I was trying to set id generator for engine configuration as suggested in Upgrade notes in 6.3.1 blog post, but code mentioned there doesn’t set the generator for task ids. When I tried to set it like this:

@Bean
    public EngineConfigurationConfigurer<SpringProcessEngineConfiguration> processEngineDbIdGeneratorConfigurer() { 
        return engineConfiguration -> engineConfiguration
                .setTaskIdGenerator(new DbIdGenerator());
    }

and with H2 being used as db it throws NPE:

2018-07-04T08:04:36.763Z ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet] [traceId:,parentId:,spanId:] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null
	at org.flowable.engine.impl.db.DbIdGenerator.getNewBlock(DbIdGenerator.java:44) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.db.DbIdGenerator.getNextId(DbIdGenerator.java:37) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.task.service.impl.persistence.entity.TaskEntityManagerImpl.insert(TaskEntityManagerImpl.java:207) ~[flowable-task-service-6.3.1.jar:6.3.1]
	at org.flowable.task.service.impl.persistence.entity.TaskEntityManagerImpl.insert(TaskEntityManagerImpl.java:38) ~[flowable-task-service-6.3.1.jar:6.3.1]
	at org.flowable.task.service.impl.TaskServiceImpl.insertTask(TaskServiceImpl.java:98) ~[flowable-task-service-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.util.TaskHelper.insertTask(TaskHelper.java:174) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.util.TaskHelper.insertTask(TaskHelper.java:149) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.bpmn.behavior.UserTaskActivityBehavior.execute(UserTaskActivityBehavior.java:220) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeActivityBehavior(ContinueProcessOperation.java:258) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.executeSynchronous(ContinueProcessOperation.java:155) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughFlowNode(ContinueProcessOperation.java:112) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.continueThroughSequenceFlow(ContinueProcessOperation.java:305) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.agenda.ContinueProcessOperation.run(ContinueProcessOperation.java:78) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperation(CommandInvoker.java:88) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.CommandInvoker.executeOperations(CommandInvoker.java:72) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:56) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.interceptor.BpmnOverrideContextInterceptor.execute(BpmnOverrideContextInterceptor.java:25) ~[flowable-engine-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.interceptor.TransactionContextInterceptor.execute(TransactionContextInterceptor.java:53) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:71) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.idm.spring.SpringTransactionInterceptor$1.doInTransaction(SpringTransactionInterceptor.java:49) ~[flowable-idm-spring-6.3.1.jar:6.3.1]
	at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140) ~[spring-tx-5.0.6.RELEASE.jar:5.0.6.RELEASE]
	at org.flowable.idm.spring.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:46) ~[flowable-idm-spring-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:56) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.common.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:51) ~[flowable-engine-common-6.3.1.jar:6.3.1]
	at org.flowable.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:105) ~[flowable-engine-6.3.1.jar:6.3.1]
...

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
filiphrcommented, Jul 9, 2018

Thanks for the reproducal @jyyna. We will have a look into it and try to figure out why that is happening.

0reactions
jyynacommented, Jul 9, 2018

Hi Martin, yes, with changes in your PR it works. Thanks Martin

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - What is a NullPointerException, and how do I fix it?
The NullPointerException (NPE) typically occurs when you declare a variable but did not create an object and assign it to the variable before...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found