Enable CORS in Camunda Tomcat 7.4

Hi,

I am get the following error when making camunda rest call from angular UI.

XMLHttpRequest cannot load http://10.75.81.71:8888/engine-rest/task?processInstanceId=177e4846-63ae-11e6-aa7a-480fcf5b710b. No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://127.0.0.1:8080’ is therefore not allowed access.

How to enable CORS on camunda Tomcat 7.4 server.

I tried adding the CORS filter in engine-rest/web.xml file, problem is not resolved.

Appreciate help in this regard.

Thanks,
Venkat

Maybe http://enable-cors.org/server_tomcat.html could help.

Also see this topic: https://groups.google.com/forum/#!searchin/camunda-bpm-users/CORS$20tomcat/camunda-bpm-users/9pDJ7rMxFkc/grPLy0lQu4EJ

1 Like

Thanks.

Problem is solved by adding the following filter in engine-rest/web.xml config file

<filter>
      <filter-name>CorsFilter</filter-name>
      <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>    
    </filter>
    <filter-mapping>
      <filter-name>CorsFilter</filter-name>
      <url-pattern>/*</url-pattern>
    </filter-mapping>

Regards,
Venkat

1 Like

Hi @Chalama_Reddy,

alternatively you could set up http server and configure proxy pass

Cheers,
Askar

See also: https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter

This works properly, by modifying file server\apache-tomcat-8.0.24\webapps\engine-rest\WEB-INF\web.xml.
Notice that filter has to be added at the top of the file, it not, it will not work.

1 Like

@Eddie_Sandi @falko.menge @system
Hello Folks,
I added the typical configuration CORS filter given in
https://tomcat.apache.org/tomcat-7.0-doc/config/filter.html#CORS_Filter

However when i send a POST request from POSTMAN,
With request body

{
  "variables": {
"creditor": {"value":"Niall","type":"String"},
"amount":{"value":"100","type":"String"},
"invoiceNumber":{"value":"123","type":"String"}
  }
}

Headers and body are given below:


Following error is thrown by server:



Apache Tomcat/8.0.24 - Error report
H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}.line {height: 1px; background-color: #525D76; border: none;}


HTTP Status 500 - org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language ‘juel’: ‘${invoiceCategory}’




type Exception report



message
org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language ‘juel’: ‘${invoiceCategory}’



description
The server encountered an internal error that prevented it from fulfilling this request.



exception


org.jboss.resteasy.spi.UnhandledException: org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language ‘juel’: ‘${invoiceCategory}’
org.jboss.resteasy.core.SynchronousDispatcher.handleApplicationException(SynchronousDispatcher.java:365)
org.jboss.resteasy.core.SynchronousDispatcher.handleException(SynchronousDispatcher.java:233)
org.jboss.resteasy.core.SynchronousDispatcher.handleInvokerException(SynchronousDispatcher.java:209)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:557)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:41)
org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:301)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:169)


root cause


org.camunda.bpm.dmn.engine.impl.DmnEvaluationException: DMN-01002 Unable to evaluate expression for language ‘juel’: ‘${invoiceCategory}’
org.camunda.bpm.dmn.engine.impl.DmnEngineLogger.unableToEvaluateExpression(DmnEngineLogger.java:32)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateElExpression(DefaultDmnDecisionContext.java:329)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateExpression(DefaultDmnDecisionContext.java:297)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateInputExpression(DefaultDmnDecisionContext.java:217)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateInput(DefaultDmnDecisionContext.java:112)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateDecisionTable(DefaultDmnDecisionContext.java:93)
org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.evaluateDecisionTable(DefaultDmnEngine.java:95)
org.camunda.bpm.engine.impl.dmn.invocation.DecisionTableInvocation.invoke(DecisionTableInvocation.java:52)
org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:54)
org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:87)
org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:59)
org.camunda.bpm.engine.impl.util.DecisionTableUtil.invoke(DecisionTableUtil.java:86)
org.camunda.bpm.engine.impl.util.DecisionTableUtil.evaluateDecisionTable(DecisionTableUtil.java:66)
org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior$1.call(DmnBusinessRuleTaskActivityBehavior.java:53)
org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior$1.call(DmnBusinessRuleTaskActivityBehavior.java:50)
org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.executeWithErrorPropagation(AbstractBpmnActivityBehavior.java:105)
org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior.execute(DmnBusinessRuleTaskActivityBehavior.java:50)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:41)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:26)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:565)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:56)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:26)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:131)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:600)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:575)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:131)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:600)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:575)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:131)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:600)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:575)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:157)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:155)
org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:44)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:130)
org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:192)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:155)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:565)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope.scopeCreated(PvmAtomicOperationTransitionCreateScope.java:34)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:49)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:23)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:174)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:157)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:155)
org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:44)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:130)
org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:192)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:155)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.startWithFormProperties(ExecutionEntity.java:468)
org.camunda.bpm.engine.impl.cmd.SubmitStartFormCmd.execute(SubmitStartFormCmd.java:81)
org.camunda.bpm.engine.impl.cmd.SubmitStartFormCmd.execute(SubmitStartFormCmd.java:39)
org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
org.camunda.bpm.engine.impl.FormServiceImpl.submitStartForm(FormServiceImpl.java:74)
org.camunda.bpm.engine.rest.sub.repository.impl.ProcessDefinitionResourceImpl.submitForm(ProcessDefinitionResourceImpl.java:166)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:41)
org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:301)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:169)


root cause


org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier ‘invoiceCategory’
org.camunda.bpm.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
org.camunda.bpm.engine.impl.juel.AstEval.eval(AstEval.java:50)
org.camunda.bpm.engine.impl.juel.AstNode.getValue(AstNode.java:26)
org.camunda.bpm.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
org.camunda.bpm.engine.impl.dmn.el.ProcessEngineElExpression.getValue(ProcessEngineElExpression.java:43)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateElExpression(DefaultDmnDecisionContext.java:325)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateExpression(DefaultDmnDecisionContext.java:297)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateInputExpression(DefaultDmnDecisionContext.java:217)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateInput(DefaultDmnDecisionContext.java:112)
org.camunda.bpm.dmn.engine.impl.DefaultDmnDecisionContext.evaluateDecisionTable(DefaultDmnDecisionContext.java:93)
org.camunda.bpm.dmn.engine.impl.DefaultDmnEngine.evaluateDecisionTable(DefaultDmnEngine.java:95)
org.camunda.bpm.engine.impl.dmn.invocation.DecisionTableInvocation.invoke(DecisionTableInvocation.java:52)
org.camunda.bpm.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:54)
org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocationInContext(DefaultDelegateInterceptor.java:87)
org.camunda.bpm.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:59)
org.camunda.bpm.engine.impl.util.DecisionTableUtil.invoke(DecisionTableUtil.java:86)
org.camunda.bpm.engine.impl.util.DecisionTableUtil.evaluateDecisionTable(DecisionTableUtil.java:66)
org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior$1.call(DmnBusinessRuleTaskActivityBehavior.java:53)
org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior$1.call(DmnBusinessRuleTaskActivityBehavior.java:50)
org.camunda.bpm.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior.executeWithErrorPropagation(AbstractBpmnActivityBehavior.java:105)
org.camunda.bpm.engine.impl.bpmn.behavior.DmnBusinessRuleTaskActivityBehavior.execute(DmnBusinessRuleTaskActivityBehavior.java:50)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:41)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationActivityExecute.execute(PvmAtomicOperationActivityExecute.java:26)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:565)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:56)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionNotifyListenerStart.eventNotificationsCompleted(PvmAtomicOperationTransitionNotifyListenerStart.java:26)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:65)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:131)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:600)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:575)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:131)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:600)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:575)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:131)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:600)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperationSync(ExecutionEntity.java:575)
org.camunda.bpm.engine.impl.core.operation.AbstractEventAtomicOperation.execute(AbstractEventAtomicOperation.java:58)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:166)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:157)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:155)
org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:44)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:130)
org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:192)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:155)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:565)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationTransitionCreateScope.scopeCreated(PvmAtomicOperationTransitionCreateScope.java:34)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:49)
org.camunda.bpm.engine.impl.pvm.runtime.operation.PvmAtomicOperationCreateScope.execute(PvmAtomicOperationCreateScope.java:23)
org.camunda.bpm.engine.impl.interceptor.AtomicOperationInvocation.execute(AtomicOperationInvocation.java:81)
org.camunda.bpm.engine.impl.interceptor.CommandContext.invokeNext(CommandContext.java:187)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:174)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:157)
org.camunda.bpm.engine.impl.interceptor.CommandContext$1.call(CommandContext.java:155)
org.camunda.bpm.engine.impl.context.ProcessApplicationClassloaderInterceptor.call(ProcessApplicationClassloaderInterceptor.java:44)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:117)
org.camunda.bpm.application.AbstractProcessApplication.execute(AbstractProcessApplication.java:130)
org.camunda.bpm.engine.impl.context.Context.executeWithinProcessApplication(Context.java:192)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performNext(CommandContext.java:155)
org.camunda.bpm.engine.impl.interceptor.CommandContext.performOperation(CommandContext.java:141)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.performOperation(ExecutionEntity.java:589)
org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity.startWithFormProperties(ExecutionEntity.java:468)
org.camunda.bpm.engine.impl.cmd.SubmitStartFormCmd.execute(SubmitStartFormCmd.java:81)
org.camunda.bpm.engine.impl.cmd.SubmitStartFormCmd.execute(SubmitStartFormCmd.java:39)
org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
org.camunda.bpm.engine.impl.FormServiceImpl.submitStartForm(FormServiceImpl.java:74)
org.camunda.bpm.engine.rest.sub.repository.impl.ProcessDefinitionResourceImpl.submitForm(ProcessDefinitionResourceImpl.java:166)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167)
org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:257)
org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:222)
org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:159)
org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:107)
org.jboss.resteasy.core.ResourceLocator.invokeOnTargetObject(ResourceLocator.java:154)
org.jboss.resteasy.core.ResourceLocator.invoke(ResourceLocator.java:92)
org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542)
org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524)
org.jboss.resteasy.core.SynchronousDispatcher.invokePropagateNotFound(SynchronousDispatcher.java:169)
org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:212)
org.jboss.resteasy.plugins.server.servlet.FilterDispatcher.doFilter(FilterDispatcher.java:59)
org.camunda.bpm.engine.rest.filter.CacheControlFilter.doFilter(CacheControlFilter.java:41)
org.apache.catalina.filters.CorsFilter.handleSimpleCORS(CorsFilter.java:301)
org.apache.catalina.filters.CorsFilter.doFilter(CorsFilter.java:169)


note
The full stack trace of the root cause is available in the Apache Tomcat/8.0.24 logs.




Apache Tomcat/8.0.24



Hi @Shohil_Sethia,

as I understand this cas nothing to do with CORS, you are missing value of variable ${invoiceCategory}.

Cheers,
Askar

I have tried this earlier

<filter>
	  <filter-name>CorsFilter</filter-name>
	  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>    
</filter>
<filter-mapping>
	  <filter-name>CorsFilter</filter-name>
	  <url-pattern>/*</url-pattern>
</filter-mapping>

But, it was not giving Allow-access-orgin:* before

But adding init paramter, I could able to get

  <filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>    
  <init-param>
		<param-name>cors.allowed.origins</param-name>
		<param-value>*</param-value>
  </init-param>
</filter>
<filter-mapping>
    <filter-name>CorsFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>
2 Likes

Thanks. It works to me, too.

Hi,

I set the filter in server\apache-tomcat-9.0.19\webapps\engine-rest\WEB-INF\web.xml but I still get an error 403 when trying to access REST API form javascript. Any ideas?

Update: SOLVED

For me it worked when I put the filter in %CATALINA_HOME\server\apache-tomcat-9.0.19\conf\web.xml

The filter must be at the top of the file

Cheers

Hello All

I am getting 404 Error after added the filter in Web.xml ,please your help

Sultan,
are you sure, you are in the right web.xml?
For the REST engine you have to edit the web.xml in the engine-rest subdirectory. In the container-version it’s under /camunda/webapps/engine-rest/WEB-INF.

My web.xml fragment looks like:

<filter>
  <filter-name>CorsFilter</filter-name>`
   <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
   <async-supported>true</async-supported>    
   <init-param>
        <param-name>cors.allowed.origins</param-name>
        <param-value>*</param-value>
   </init-param>
   <init-param>
        <param-name>cors.allowed.methods</param-name>
        <param-value>GET,POST,HEAD,OPTIONS,PUT,DELETE</param-value>
   </init-param>
   <init-param>    
            <param-name>cors.allowed.headers</param-name>    
            <param-value>Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization</param-value>    
     </init-param>    
     <init-param>    
            <param-name>cors.exposed.headers</param-name>    
            <param-value>Access-Control-Allow-Origin</param-value>      
     </init-param>
</filter>
<filter-mapping>
    <filter-name>CorsFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

I got it from one of the links above.But I added one important line
<async-supported>true</async-supported>

Without this declaration it is not possible to use external tasks. I always got the following error:
Polling failed with RESTEASY003320: Failed processing arguments of public void org.camunda.bpm.engine.rest.impl.FetchAndLockRestServiceImpl.fetchAndLock ...

hope this helps.

Regards
André

2 Likes