Camunda get started spring server error

Hi

I’m going through camunda get started and I found same project on git https://github.com/camunda/camunda-get-started-spring. When I deployed loanapproval-spring-0.1.0-SNAPSHOT.war in camunda tomcat server so I’m getting error mentioned below

    01-Sep-2020 09:21:56.096 WARNING [Catalina-utility-2] org.springframework.web.context.support.AnnotationConfigWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in org.camunda.bpm.getstarted.loanapproval.LoanApplicationContext: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.camunda.bpm.engine.ProcessEngine]: Factory method 'processEngine' threw exception; nested exception is org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01004 org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper class found on class path but cannot be cast to org.camunda.feel.valuemapper.CustomValueMapper
01-Sep-2020 09:21:56.098 SEVERE [Catalina-utility-2] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed
	org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngine' defined in org.camunda.bpm.getstarted.loanapproval.LoanApplicationContext: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.camunda.bpm.engine.ProcessEngine]: Factory method 'processEngine' threw exception; nested exception is org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01004 org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper class found on class path but cannot be cast to org.camunda.feel.valuemapper.CustomValueMapper
		at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:599)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1177)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1072)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
		at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
		at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
		at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
		at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
		at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
		at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756)
		at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
		at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
		at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
		at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
		at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
		at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4690)
		at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5151)
		at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
		at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:717)
		at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
		at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:705)
		at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:978)
		at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1849)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
		at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
		at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
		at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
		at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:773)
		at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:427)
		at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1620)
		at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:305)
		at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
		at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1151)
		at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1353)
		at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1357)
		at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1335)
		at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
		at java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
		at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
		at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
		at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
		at java.base/java.lang.Thread.run(Thread.java:835)
	Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.camunda.bpm.engine.ProcessEngine]: Factory method 'processEngine' threw exception; nested exception is org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01004 org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper class found on class path but cannot be cast to org.camunda.feel.valuemapper.CustomValueMapper
		at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:189)
		at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:588)
		... 42 more
	Caused by: org.camunda.bpm.dmn.feel.impl.FeelException: FEEL/SCALA-01004 org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper class found on class path but cannot be cast to org.camunda.feel.valuemapper.CustomValueMapper
		at org.camunda.bpm.dmn.feel.impl.scala.ScalaFeelLogger.spinValueMapperCastException(ScalaFeelLogger.java:56)
		at org.camunda.bpm.dmn.feel.impl.scala.spin.SpinValueMapperFactory.newInstance(SpinValueMapperFactory.java:56)
		at org.camunda.bpm.dmn.feel.impl.scala.spin.SpinValueMapperFactory.createInstance(SpinValueMapperFactory.java:34)
		at org.camunda.bpm.dmn.feel.impl.scala.ScalaFeelEngine.getValueMappers(ScalaFeelEngine.java:125)
		at org.camunda.bpm.dmn.feel.impl.scala.ScalaFeelEngine.<init>(ScalaFeelEngine.java:52)
		at org.camunda.bpm.dmn.feel.impl.scala.ScalaFeelEngineFactory.createInstance(ScalaFeelEngineFactory.java:37)
		at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration.initFeelEngine(DefaultDmnEngineConfiguration.java:200)
		at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration.init(DefaultDmnEngineConfiguration.java:97)
		at org.camunda.bpm.dmn.engine.impl.DefaultDmnEngineConfiguration.buildEngine(DefaultDmnEngineConfiguration.java:86)
		at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.initDmnEngine(ProcessEngineConfigurationImpl.java:2302)
		at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:893)
		at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:870)
		at org.camunda.bpm.engine.spring.SpringTransactionsProcessEngineConfiguration.buildProcessEngine(SpringTransactionsProcessEngineConfiguration.java:63)
		at org.camunda.bpm.engine.spring.ProcessEngineFactoryBean.getObject(ProcessEngineFactoryBean.java:55)
		at org.camunda.bpm.getstarted.loanapproval.LoanApplicationContext.processEngine(LoanApplicationContext.java:81)
		at org.camunda.bpm.getstarted.loanapproval.LoanApplicationContext$$EnhancerBySpringCGLIB$$420d2e7d.CGLIB$processEngine$0(<generated>)
		at org.camunda.bpm.getstarted.loanapproval.LoanApplicationContext$$EnhancerBySpringCGLIB$$420d2e7d$$FastClassBySpringCGLIB$$4d129122.invoke(<generated>)
		at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:228)
		at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:358)
		at org.camunda.bpm.getstarted.loanapproval.LoanApplicationContext$$EnhancerBySpringCGLIB$$420d2e7d.processEngine(<generated>)
		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:567)
		at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162)
		... 43 more
	Caused by: java.lang.ClassCastException: class org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper cannot be cast to class org.camunda.feel.valuemapper.CustomValueMapper (org.camunda.spin.plugin.impl.feel.integration.SpinValueMapper is in unnamed module of loader java.net.URLClassLoader @68de145; org.camunda.feel.valuemapper.CustomValueMapper is in unnamed module of loader org.apache.catalina.loader.ParallelWebappClassLoader @bfd56f5)
		at org.camunda.bpm.dmn.feel.impl.scala.spin.SpinValueMapperFactory.newInstance(SpinValueMapperFactory.java:47)
		... 66 more
01-Sep-2020 09:21:56.101 SEVERE [Catalina-utility-2] org.apache.catalina.core.StandardContext.startInternal One or more listeners failed to start. Full details will be found in the appropriate container log file
01-Sep-2020 09:21:56.102 SEVERE [Catalina-utility-2] org.apache.catalina.core.StandardContext.startInternal Context [/loanapproval-spring-0.1.0-SNAPSHOT] startup failed due to previous errors

Not sure what is happening here as I’m begineer with Camunda. coments are appriciated.

best regards,
Tim

I’m able to solve above issue by adding camunda spin core dependency but I’m facing another error while starting the process from task list.

It seems the java delegates class is not being instantiated. I’m using camunda 7.13.0 version.

Can you upload your process and also so the class you’re trying to call.

Hi @Niall,

I appreciate your quick response, I’ve added process and class below:

package org.camunda.bpm.getstarted.loanapproval;

import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;

@Component
public class CalculateInterestService implements JavaDelegate {

    public void execute(DelegateExecution delegate) throws Exception {
        System.out.println("Spring Bean invoked with class name: " + this.getClass().getSimpleName());
    }
}

loanApproval.bpmn (2.8 KB)

Note: I cloned this project from Camunda git repository.

Is your goal to build a project that can be deployed to an instance of tomcat?

Yes, I’m trying to build project and trying to deploy on Camunda apache tomcat server.

Hi @Niall,

I’ve another issue when I’m keeping BPMN file in the spring project inside resource folder then it is working fine. But when I’m keeping BPMN file out from spring project and deploying through REST so I’m getting error:

02-Sep-2020 13:18:00.422 SEVERE [messageListenerContainer-1] org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: no deployed process definition found with key 'loanApproval': processDefinition is null
	org.camunda.bpm.engine.exception.NullValueException: no deployed process definition found with key 'loanApproval': processDefinition is null
		at jdk.internal.reflect.GeneratedConstructorAccessor36.newInstance(Unknown Source)

I tried with key and id but getting same error. Could you provide me a way to fix this issue.

Can you show the call you’re making to start the process.

package org.camunda.engine.spring.consumer;

import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.variable.Variables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

@Data
@Slf4j
@Component
@NoArgsConstructor
public class SpringAMQPRabbitReceiver implements MessageListener {

	@Autowired
	private RuntimeService runtimeService;

	@Override
	public void onMessage(Message message) {
		String body = new String(message.getBody());
		log.info("Received message from queue with message body:{} ", body);
		runtimeService.startProcessInstanceByKey("loanApproval", Variables.putValue("message", body));
	}
}

@Niall I’ve added class which making call to start the process in the same thread .

So you’re deploying the invoice process via the REST API - are you aware that this wont work? If you’re calling local services or front ends (e.g. Java Classes ) the process need to be deployed from the within the resouces folder. Deploying processes via the REST API is intended for use when you’re using External tasks and no local dependencies.

Hi @Niall

I was not aware, which I was trying to achieve that won’t work so thanks a lot for saving my time.

And while exploring more of Camunda I found Standalone process engine architecture that apparently fit in my use case so I’ve few doubts in below points that I want to understand-

  1. I found Standalone (Remote) Process Engine Server in Camunda docs so how to achieve this?

    • If BPMN file is deployed on standalone process engine server so how BPMN file would be able to find the java delegates/implementations?

    • Is this possible to do using spring boot with out having BPMN process inside resource folder?

  2. If we have two war and is this possible to communicate both war delegates to each other.

Could you please refer any git repository example to start with Standalone (Remote) Process Engine Server.

I appreciate your help.

Best regards,
Tim

Hi @Tim_Lo ,

I fixed this problem by adding the dependency below in the pom.xml file.

<dependency>
    <groupId>org.camunda.bpm</groupId>
    <artifactId>camunda-engine-plugin-spin</artifactId>
</dependency>
2 Likes