Javadelegate class loader on starting Process using rest api with basic authentication filter

Hello All!

I created simple document review process with few variables and document attachment.

I was able to start the process, get the process/task details, complete the task etc. using REST api without enabling the basic authentication filter. But once I add the authentication filter to tomcat web.xml file with the below value as given in this link,

<filter>
  <filter-name>camunda-auth</filter-name>
  <filter-class>
    org.camunda.bpm.engine.rest.security.auth.ProcessEngineAuthenticationFilter
  </filter-class>
  <async-supported>true</async-supported>
  <init-param>
    <param-name>authentication-provider</param-name>
    <param-value>org.camunda.bpm.engine.rest.security.auth.impl.HttpBasicAuthenticationProvider</param-value>
  </init-param>
</filter>
<filter-mapping>
  <filter-name>camunda-auth</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

I’m getting following error in the service task which is the following task of my start task,

{
“type”: “RestException”,
“message”: “Cannot instantiate process definition documentreview:13:7381e4ad-5f8a-11eb-a695-d8f2ca5e626d: ENGINE-09008 Exception while instantiating class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: ENGINE-09017 Cannot load class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: com.demo.bpm.reviewprocess.LoggerDelegate”
}

I see the following error in the tomcat log,

org.camunda.commons.logging.BaseLogger.logError ENGINE-16004 Exception while closing command context: ENGINE-09008 Exception while instantiating class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: ENGINE-09017 Cannot load class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: com.demo.bpm.reviewprocess.LoggerDelegate
org.camunda.bpm.engine.ProcessEngineException: ENGINE-09008 Exception while instantiating class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: ENGINE-09017 Cannot load class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: com.demo.bpm.reviewprocess.LoggerDelegate
.
.
Caused by: org.camunda.bpm.engine.ClassLoadingException: ENGINE-09017 Cannot load class ‘com.demo.bpm.reviewprocess.LoggerDelegate’: com.demo.bpm.reviewprocess.LoggerDelegate
at org.camunda.bpm.engine.impl.util.EngineUtilLogger.classLoadingException(EngineUtilLogger.java:146)
at org.camunda.bpm.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:111)
at org.camunda.bpm.engine.impl.util.ClassDelegateUtil.instantiateDelegate(ClassDelegateUtil.java:46)
… 123 more
Caused by: java.lang.ClassNotFoundException: com.demo.bpm.reviewprocess.LoggerDelegate
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1365)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:398)
at org.camunda.bpm.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:88)
… 124 more

This “LoggerDelegate” got only the message to log the details of the process instance details and variables no other logic.

But if I comment out the authentication filter in the web.xml it works fine.

Please let me know what I’m missing.

Thanks in advance!

Hi @rameshd

Can you take a look at the Style Guide? It’ll help you understand how to format code correctly and also help you create questions that are easy to understand and also easier to answer :slight_smile:

Can you give me more information, uploading the bpmn file and show the code of your Java Class.

Thanks for the link Niall! I will follow the formatting when I post next topic.

I found what’s the issue is, realized late that I added the filter to the tomcat web.xml file instead of uncommenting the “Http Basic Authentication Filter” section in the web.xml under “apache-tomcat-9.0.36\webapps\engine-rest\WEB-INF”.

All good for now using rest api!!

1 Like