Skip to content
This repository has been archived by the owner on May 4, 2022. It is now read-only.

Unable to register plugin when using Camunda + Tomcat Deployment #103

Open
harjsing opened this issue May 21, 2020 · 3 comments
Open

Unable to register plugin when using Camunda + Tomcat Deployment #103

harjsing opened this issue May 21, 2020 · 3 comments
Labels
bug pr-wanted please provide a PR with a test case
Milestone

Comments

@harjsing
Copy link

harjsing commented May 21, 2020

Hi,
I am unable to register the ReactorProcessEnginePlugin due to a missing default constructor.

It was added at some point in this commit and later removed (probably because of migration to using source eventbus)? #45

Error:

	at org.camunda.bpm.engine.impl.util.EngineUtilLogger.exceptionWhileInstantiatingClass(EngineUtilLogger.java:78)
	at org.camunda.bpm.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:192)
	at org.camunda.bpm.container.impl.deployment.StartProcessEngineStep.createInstance(StartProcessEngineStep.java:154)
	at org.camunda.bpm.container.impl.deployment.StartProcessEngineStep.configurePlugins(StartProcessEngineStep.java:134)
	at org.camunda.bpm.container.impl.deployment.StartProcessEngineStep.performOperationStep(StartProcessEngineStep.java:100)
	at org.camunda.bpm.container.impl.spi.DeploymentOperation.execute(DeploymentOperation.java:116)
	... 17 more
Caused by: java.lang.InstantiationException: org.camunda.bpm.extension.reactor.plugin.ReactorProcessEnginePlugin
	at java.lang.Class.newInstance(Class.java:427)
	at org.camunda.bpm.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:189)
	... 21 more
Caused by: java.lang.NoSuchMethodException: org.camunda.bpm.extension.reactor.plugin.ReactorProcessEnginePlugin.<init>()
	at java.lang.Class.getConstructor0(Class.java:3082)
	at java.lang.Class.newInstance(Class.java:412)
	... 22 more

Using version: 2.1.2

Thanks!

@harjsing
Copy link
Author

@jangalinski Thoughts?

@jangalinski
Copy link
Collaborator

Time is the issue .. :-)

I get the problem ... so we should have a default constructor that internally creates a new instance of the bus and delegates to the current constructor. Easy.

But then you have to make sure, that your consumers use the same bus. So you must not create a new CamundaEventBus in your app but instead get the instance from the process engine configuration. That would work.

Would you like to provide a PR?

@jangalinski jangalinski added this to the 2.11.0 milestone May 29, 2020
@jangalinski jangalinski added the pr-wanted please provide a PR with a test case label May 29, 2020
@harjsing
Copy link
Author

Thanks @jangalinski

I got an instance of the CamundaEventBus like so:

CamundaEventBus eventBus = CamundaReactor.eventBus(processEngineShim.getProcessEngine());  //ProcessEngine (default)

TaskListener listener = new CustomTaskListener(eventBus);

and a simple TaksListener as follows


@CamundaSelector(type = "userTask", event = TaskListener.EVENTNAME_CREATE)
public class CustomTaskListener implements TaskListener {

    public CustomTaskListener(CamundaEventBus bus) {
        bus.register(this);
    }

    public void notify(DelegateTask delegateTask) {
    }
}

I can successfully see the notify being called :-)

I'll submit a PR soon!

harjsing pushed a commit to harjsing/camunda-bpm-reactor that referenced this issue Jun 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug pr-wanted please provide a PR with a test case
Projects
None yet
Development

No branches or pull requests

2 participants