AW: Camunda BPM with Maven and REST

484 views
Skip to first unread message

Daniel Meyer

unread,
Aug 2, 2013, 11:52:35 AM8/2/13
to steffen....@gmail.com, camunda-...@googlegroups.com

Hi Steffen,

 

Thanks for your interest in camunda BPM.

 

I gather that you want to combine the process engine and the REST API in a single WAR file deployment and configure the services with Spring?

 

I added a quickstart which demonstrates how to deploy a webapplication, which

·         bundles the camunda-engine JAR library

·         starts and configures a process engine in a Spring Application context

·         bundles the camunda-engine-REST library

·         exposes the process engine API via REST

 

https://github.com/camunda/camunda-quickstarts/tree/master/deployment/embedded-spring-rest

 

Does this solve your problem?

 

Cheers,

Daniel Meyer

Steffen Heublein

unread,
Aug 5, 2013, 5:06:56 AM8/5/13
to Daniel Meyer, camunda-...@googlegroups.com
Hi Daniel,

thanks for your reply.


I followed your guide and I can start the server with the module just fine. Engine starts up as well from what I can tell from the Tomcat console. Yet, when I try to access the REST engine with the link you provided in your guide, Tomcat returns me a 404 "resource not found". Any more advice?

Best,
Steffen

Daniel Meyer

unread,
Aug 5, 2013, 8:08:06 AM8/5/13
to Steffen Heublein, camunda-...@googlegroups.com

Hi Steffen,

 

can you see Rest-Easy deploying the rest endpoints in server log?

 

Maybe you could post the complete tomcat start log. Mine looks like this:

 

05.08.2013 14:05:58 org.apache.catalina.startup.Catalina initDirs

SCHWERWIEGEND: Cannot find specified temporary folder at C:\demo\apache-tomcat-7.0.39\temp

05.08.2013 14:05:58 org.apache.catalina.core.AprLifecycleListener init

INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.6.0_39\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Programs\oracle\app\oracle\product\11.2.0\server\bin;;C:\Programs\apache-maven-3.0.4\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;C:\Program Files\Intel\In

05.08.2013 14:05:58 org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler ["http-bio-8080"]

05.08.2013 14:05:58 org.apache.coyote.AbstractProtocol init

INFO: Initializing ProtocolHandler ["ajp-bio-8009"]

05.08.2013 14:05:58 org.apache.catalina.startup.Catalina load

INFO: Initialization processed in 266 ms

05.08.2013 14:05:58 org.apache.catalina.core.StandardService startInternal

INFO: Starting service Catalina

05.08.2013 14:05:58 org.apache.catalina.core.StandardEngine startInternal

INFO: Starting Servlet Engine: Apache Tomcat/7.0.39

05.08.2013 14:05:58 org.apache.catalina.startup.HostConfig deployWAR

INFO: Deploying web application archive C:\demo\apache-tomcat-7.0.39\webapps\camunda-quickstart-embedded-spring-rest-7.0.0-SNAPSHOT.war

05.08.2013 14:05:59 org.springframework.web.context.ContextLoader initWebApplicationContext

INFO: Root WebApplicationContext: initialization started

05.08.2013 14:05:59 org.springframework.context.support.AbstractApplicationContext prepareRefresh

INFO: Refreshing Root WebApplicationContext: startup date [Mon Aug 05 14:05:59 CEST 2013]; root of context hierarchy

05.08.2013 14:05:59 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions

INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]

05.08.2013 14:06:00 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons

INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@91f005: defining beans [dataSource,transactionManager,processEngineConfiguration,processEngine,repositoryService,runtimeService,taskService,historyService,managementService,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.camunda.bpm.example.loanapproval.Starter#0,calculateInterestService,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0]; root of factory hierarchy

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.db.DbSqlSession executeSchemaResource

INFO: performing create on engine with resource org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.db.DbSqlSession executeSchemaResource

INFO: performing create on history with resource org/camunda/bpm/engine/db/create/activiti.h2.create.history.sql

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.db.DbSqlSession executeSchemaResource

INFO: performing create on identity with resource org/camunda/bpm/engine/db/create/activiti.h2.create.identity.sql

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.db.DbSqlSession checkHistoryLevel

INFO: No historyLevel property found in database.

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.db.DbSqlSession dbCreateHistoryLevel

INFO: Creating historyLevel property in database with value: audit

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.ProcessEngineImpl <init>

INFO: ProcessEngine default created

05.08.2013 14:06:00 org.camunda.bpm.engine.impl.bpmn.deployer.BpmnDeployer deploy

INFO: Processing resource C:\demo\apache-tomcat-7.0.39\webapps\camunda-quickstart-embedded-spring-rest-7.0.0-SNAPSHOT\WEB-INF\classes\loanApproval.bpmn

Spring Bean invoked.

05.08.2013 14:06:01 org.springframework.web.context.ContextLoader initWebApplicationContext

INFO: Root WebApplicationContext: initialization completed in 1356 ms

688 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Deploying javax.ws.rs.core.Application: class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

692 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding provider class org.camunda.bpm.engine.rest.exception.RestExceptionHandler from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

693 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding provider class org.codehaus.jackson.jaxrs.JsonParseExceptionMapper from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

693 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding provider class org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

694 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding class resource org.camunda.bpm.engine.rest.impl.ProcessEngineRestServiceImpl from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

694 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding provider class org.camunda.bpm.engine.rest.mapper.JacksonConfigurator from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

694 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding provider class org.codehaus.jackson.jaxrs.JacksonJsonProvider from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

695 [localhost-startStop-1] INFO org.jboss.resteasy.spi.ResteasyDeployment - Adding provider class org.camunda.bpm.engine.rest.exception.ProcessEngineExceptionHandler from Application class org.camunda.bpm.example.loanapproval.rest.RestProcessEngineDeployment

05.08.2013 14:06:01 org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory C:\demo\apache-tomcat-7.0.39\webapps\docs

05.08.2013 14:06:01 org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory C:\demo\apache-tomcat-7.0.39\webapps\examples

05.08.2013 14:06:01 org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory C:\demo\apache-tomcat-7.0.39\webapps\host-manager

05.08.2013 14:06:01 org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory C:\demo\apache-tomcat-7.0.39\webapps\manager

05.08.2013 14:06:01 org.apache.catalina.startup.HostConfig deployDirectory

INFO: Deploying web application directory C:\demo\apache-tomcat-7.0.39\webapps\ROOT

05.08.2013 14:06:01 org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["http-bio-8080"]

05.08.2013 14:06:01 org.apache.coyote.AbstractProtocol start

INFO: Starting ProtocolHandler ["ajp-bio-8009"]

05.08.2013 14:06:01 org.apache.catalina.startup.Catalina start

INFO: Server startup in 2940 ms

 

Cheers,

Daniel

Steffen Heublein

unread,
Aug 6, 2013, 2:32:06 AM8/6/13
to Daniel Meyer, camunda-...@googlegroups.com
Hi Daniel,

I was using my Eclipse installation for starting Tomcat, I hope that this is not a problem. As well, I do not have a running workflow yet (if I see correctly, you are running the loan approval example) as I wanted to get it running first.

My Tomcat log looks like this:

Aug 06, 2013 7:31:50 AM org.apache.catalina.core.AprLifecycleListener init
Information: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1_7_0_x64\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\ThinkPad\Bluetooth Software\;C:\Program Files\ThinkPad\Bluetooth Software\syswow64;;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\2.0\bin\x64;C:\Program Files\Common Files\Lenovo;C:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Lenovo\Access Connections\;C:\SWTOOLS\ReadyApps;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\Program Files (x86)\Common Files\Lenovo;D:\Java\jdk1_6_0_24_x64\BIN;D:\Programme\TortoiseSVN\bin;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\apache-maven-3.0.5\bin;.
Aug 06, 2013 7:31:50 AM org.apache.tomcat.util.digester.SetPropertiesRule begin
Warnung: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:camunda-quickstart-embedded-spring-rest' did not find a matching property.
Aug 06, 2013 7:31:50 AM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["http-bio-8080"]
Aug 06, 2013 7:31:50 AM org.apache.coyote.AbstractProtocol init
Information: Initializing ProtocolHandler ["ajp-bio-8009"]
Aug 06, 2013 7:31:50 AM org.apache.catalina.startup.Catalina load
Information: Initialization processed in 571 ms
Aug 06, 2013 7:31:50 AM org.apache.catalina.core.StandardService startInternal
Information: Starting service Catalina
Aug 06, 2013 7:31:50 AM org.apache.catalina.core.StandardEngine startInternal
Information: Starting Servlet Engine: Apache Tomcat/7.0.42
Aug 06, 2013 7:31:53 AM org.apache.catalina.core.ApplicationContext log
Information: No Spring WebApplicationInitializer types detected on classpath
Aug 06, 2013 7:31:53 AM org.apache.catalina.core.ApplicationContext log
Information: Initializing Spring root WebApplicationContext
Aug 06, 2013 7:31:53 AM org.springframework.web.context.ContextLoader initWebApplicationContext
Information: Root WebApplicationContext: initialization started
Aug 06, 2013 7:31:53 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
Information: Refreshing Root WebApplicationContext: startup date [Tue Aug 06 07:31:53 CEST 2013]; root of context hierarchy
Aug 06, 2013 7:31:53 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
Information: Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
Aug 06, 2013 7:31:53 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
Information: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@10cf9d51: defining beans [dataSource,transactionManager,processEngineConfiguration,processEngine,repositoryService,runtimeService,taskService,historyService,managementService]; root of factory hierarchy
Aug 06, 2013 7:31:54 AM org.camunda.bpm.engine.impl.db.DbSqlSession executeSchemaResource
Information: performing create on engine with resource org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql
Aug 06, 2013 7:31:54 AM org.camunda.bpm.engine.impl.db.DbSqlSession executeSchemaResource
Information: performing create on history with resource org/camunda/bpm/engine/db/create/activiti.h2.create.history.sql
Aug 06, 2013 7:31:54 AM org.camunda.bpm.engine.impl.db.DbSqlSession executeSchemaResource
Information: performing create on identity with resource org/camunda/bpm/engine/db/create/activiti.h2.create.identity.sql
Aug 06, 2013 7:31:54 AM org.camunda.bpm.engine.impl.db.DbSqlSession checkHistoryLevel
Information: No historyLevel property found in database.
Aug 06, 2013 7:31:54 AM org.camunda.bpm.engine.impl.db.DbSqlSession dbCreateHistoryLevel
Information: Creating historyLevel property in database with value: audit
Aug 06, 2013 7:31:54 AM org.camunda.bpm.engine.impl.ProcessEngineImpl <init>
Information: ProcessEngine default created
Aug 06, 2013 7:31:54 AM org.springframework.web.context.ContextLoader initWebApplicationContext
Information: Root WebApplicationContext: initialization completed in 1515 ms
Aug 06, 2013 7:31:54 AM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler ["http-bio-8080"]
Aug 06, 2013 7:31:54 AM org.apache.coyote.AbstractProtocol start
Information: Starting ProtocolHandler ["ajp-bio-8009"]
Aug 06, 2013 7:31:54 AM org.apache.catalina.startup.Catalina start
Information: Server startup in 4226 ms

As far as I can see, Rest-Easy is not deployed. I've attached a screenshot where I compared both logs for differences.

Maybe I could give you some more information on my approach:
I was doing your Quickstart on top of the Spring Guide from your documentation and changed the relevant bits. In some cases I was not sure if I did it correctly. I created the classes RestProcessEngineDeployment and RestProcessEngineProvider as pointed out in your guide and put them into src/main/java.

Where I was unsure was this part:

"Add a file named: src/main/resources/META-INF/services/org.camunda.bpm.engine.rest.spi.ProcessEngineProvider Which contains the name of the provider: org.camunda.bpm.example.loanapproval.rest.RestProcessEngineProvider."

Has the file to be named org.camunda.bpm.engine.rest.spi.ProcessEngineProvider or is it a file name ProcessEngineProvider in a packacge org.camunda.bpm.engine.rest.spi? And where does the providername come from? I have not done the loanapproval example and wonder how this name has to be in other cases.

Thank you for your patience,
Best,
Steffen



2013/8/5 Daniel Meyer <daniel...@camunda.com>
LogComparison.png

Daniel Meyer

unread,
Aug 7, 2013, 3:25:21 AM8/7/13
to Steffen Heublein, camunda-...@googlegroups.com

Hi Steffen,

 

Has the file to be named org.camunda.bpm.engine.rest.spi.ProcessEngineProvider or is it a file name ProcessEngineProvider in a packacge org.camunda.bpm.engine.rest.spi?

 

The file needs to be named org.camunda.bpm.engine.rest.spi.ProcessEngineProvider

 

See here:

https://github.com/camunda/camunda-quickstarts/tree/master/deployment/embedded-spring-rest/src/main/resources/META-INF/services

 

Cheers,

Daniel Meyer

Steffen Heublein

unread,
Aug 13, 2013, 2:56:37 AM8/13/13
to Daniel Meyer, camunda-...@googlegroups.com
Hi Daniel,

everything works now, thank you. I overlooked that you provided the sourcecode which helped a great deal in setting this up.

Best,
Steffen


2013/8/7 Daniel Meyer <daniel...@camunda.com>

dewald....@gmail.com

unread,
Jul 28, 2014, 8:53:02 AM7/28/14
to camunda-...@googlegroups.com, daniel...@camunda.com, steffen....@gmail.com
Thank you so much! Helped me a lot :)
Reply all
Reply to author
Forward
0 new messages