Embed Rest API - Wildfly 10.10

I’m trying to follow this tutorial

https://docs.camunda.org/manual/7.6/reference/rest/overview/embeddability/

I’m using Wildfly 10.10 and Camunda Engine 7.6.0 and this is the console output:

10:51:46,105 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0013: Operation ("full-replace-deployment") failed - address: ([]) - failure description: {
    "WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host.\"/bpms.rest\"" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host.\"/bpms.rest\": java.lang.NoClassDefFoundError: org/camunda/bpm/engine/rest/impl/CamundaRestResources
    Caused by: java.lang.NoClassDefFoundError: org/camunda/bpm/engine/rest/impl/CamundaRestResources
    Caused by: java.lang.ClassNotFoundException: org.camunda.bpm.engine.rest.impl.CamundaRestResources from [Module \"deployment.bpms.rest.war:main\" from Service Module Loader]"},
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host.\"/bpms.rest\""],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => undefined

If I deploy just the Rest API war I can use it, but I can’t package on my application! What I doing wrong?

Follows my pom:

	<dependencyManagement>
	<dependencies>
		<dependency>
			<groupId>org.wildfly.bom</groupId>
			<artifactId>wildfly-javaee7-with-tools</artifactId>
			<version>${version.jboss.bom}</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
		<dependency>
			<groupId>org.camunda.bpm</groupId>
			<artifactId>camunda-bom</artifactId>
			<version>${version.camunda.api}</version>
			<type>pom</type>
			<scope>import</scope>
		</dependency>
	</dependencies>
</dependencyManagement>

<dependencies>
	<dependency>
		<groupId>org.camunda.bpm</groupId>
		<artifactId>camunda-engine-rest</artifactId>
		<classifier>classes</classifier>
	</dependency>
	<dependency>
		<groupId>org.camunda.bpm</groupId>
		<artifactId>camunda-engine</artifactId>
		<scope>provided</scope>
	</dependency>
	<dependency>
		<groupId>org.camunda.bpm.javaee</groupId>
		<artifactId>camunda-ejb-client</artifactId>
		<scope>compile</scope>
	</dependency>
	<dependency>
		<groupId>org.jboss.spec</groupId>
		<artifactId>jboss-javaee-6.0</artifactId>
		<version>3.0.3.Final</version>
		<type>pom</type>
		<exclusions>
			<exclusion>
				<artifactId>xalan</artifactId>
				<groupId>org.apache.xalan</groupId>
			</exclusion>
		</exclusions>
	</dependency>
	<dependency>
		<groupId>javax.servlet</groupId>
		<artifactId>servlet-api</artifactId>
		<version>2.5</version>
		<scope>provided</scope>
	</dependency>
</dependencies>

Hi @edgarberlinck,

do I understand correctly that you have shared engine configured in your wildfly and you want now to embed camunda-rest into your application?

Cheers,
Askar

Hi,

Could you please attach the output of mvn dependency:tree of your project.

Cheers,
Christian

[INFO] br.com.inflor:bpms.rest:war:0.0.1-SNAPSHOT
[INFO] ± org.camunda.bpm:camunda-engine-rest:jar:classes:7.6.0:compile
[INFO] | - org.camunda.bpm:camunda-engine-rest-core:jar:7.6.0:compile
[INFO] | - com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.6.3:compile
[INFO] | ± com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.6.3:compile
[INFO] | ± com.fasterxml.jackson.core:jackson-core:jar:2.6.3:compile
[INFO] | ± com.fasterxml.jackson.core:jackson-databind:jar:2.6.3:compile
[INFO] | | - com.fasterxml.jackson.core:jackson-annotations:jar:2.6.0:compile
[INFO] | - com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.6.3:compile
[INFO] ± org.camunda.bpm:camunda-engine:jar:7.6.0:provided
[INFO] | ± org.camunda.bpm.model:camunda-bpmn-model:jar:7.6.0:provided
[INFO] | | - org.camunda.bpm.model:camunda-xml-model:jar:7.6.0:provided
[INFO] | ± org.camunda.bpm.model:camunda-cmmn-model:jar:7.6.0:provided
[INFO] | ± org.camunda.bpm.dmn:camunda-engine-dmn:jar:7.6.0:provided
[INFO] | | ± org.camunda.commons:camunda-commons-utils:jar:1.4.0:provided
[INFO] | | ± org.camunda.bpm.model:camunda-dmn-model:jar:7.6.0:provided
[INFO] | | ± org.camunda.bpm.dmn:camunda-engine-feel-api:jar:7.6.0:provided
[INFO] | | - org.camunda.bpm.dmn:camunda-engine-feel-juel:jar:7.6.0:provided
[INFO] | ± org.camunda.commons:camunda-commons-logging:jar:1.4.0:provided
[INFO] | | - org.slf4j:slf4j-api:jar:1.7.7:provided
[INFO] | ± org.camunda.commons:camunda-commons-typed-values:jar:1.4.0:provided
[INFO] | ± org.apache.commons:commons-email:jar:1.2:provided
[INFO] | ± org.mybatis:mybatis:jar:3.2.8:provided
[INFO] | ± org.springframework:spring-beans:jar:3.1.2.RELEASE:provided
[INFO] | | - org.springframework:spring-core:jar:3.1.2.RELEASE:provided
[INFO] | | ± org.springframework:spring-asm:jar:3.1.2.RELEASE:provided
[INFO] | | - commons-logging:commons-logging:jar:1.1.1:provided
[INFO] | - joda-time:joda-time:jar:2.1:provided
[INFO] ± org.jboss.spec:jboss-javaee-6.0:pom:3.0.3.Final:compile
[INFO] | ± javax.activation:activation:jar:1.1.1:compile
[INFO] | ± javax.enterprise:cdi-api:jar:1.2:compile
[INFO] | ± javax.inject:javax.inject:jar:1:compile
[INFO] | ± javax.jws:jsr181-api:jar:1.0-MR1:compile
[INFO] | ± javax.mail:mail:jar:1.4.4:compile
[INFO] | ± javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | ± org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.ejb:jboss-ejb-api_3.1_spec:jar:1.0.2.Final:compile
[INFO] | ± org.jboss.spec.javax.el:jboss-el-api_2.2_spec:jar:1.0.2.Final:compile
[INFO] | ± org.jboss.spec.javax.enterprise.deploy:jboss-jad-api_1.2_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.faces:jboss-jsf-api_2.1_spec:jar:2.0.9.Final:compile
[INFO] | ± org.jboss.spec.javax.interceptor:jboss-interceptors-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.management.j2ee:jboss-j2eemgmt-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.resource:jboss-connector-api_1.6_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.rmi:jboss-rmi-api_1.0_spec:jar:1.0.5.Final:compile
[INFO] | ± org.jboss.spec.javax.security.jacc:jboss-jacc-api_1.4_spec:jar:1.0.2.Final:compile
[INFO] | ± org.jboss.spec.javax.security.auth.message:jboss-jaspi-api_1.0_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.xml.registry:jboss-jaxr-api_1.0_spec:jar:1.0.2.Final:compile
[INFO] | ± org.jboss.spec.javax.jms:jboss-jms-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.servlet:jboss-servlet-api_3.0_spec:jar:1.0.2.Final:compile
[INFO] | ± org.jboss.spec.javax.servlet.jsp:jboss-jsp-api_2.2_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.servlet.jstl:jboss-jstl-api_1.2_spec:jar:1.1.3.Final:compile
[INFO] | | ± org.jboss.spec.javax.el:jboss-el-api_3.0_spec:jar:1.0.7.Final:compile
[INFO] | | ± org.jboss.spec.javax.servlet:jboss-servlet-api_3.1_spec:jar:1.0.0.Final:compile
[INFO] | | - org.jboss.spec.javax.servlet.jsp:jboss-jsp-api_2.3_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.ws.rs:jboss-jaxrs-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.xml.bind:jboss-jaxb-api_2.2_spec:jar:1.0.4.Final:compile
[INFO] | ± org.jboss.spec.javax.xml.rpc:jboss-jaxrpc-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | ± org.jboss.spec.javax.xml.soap:jboss-saaj-api_1.3_spec:jar:1.0.3.Final:compile
[INFO] | - org.jboss.spec.javax.xml.ws:jboss-jaxws-api_2.2_spec:jar:2.0.3.Final:compile
[INFO] ± javax.servlet:servlet-api:jar:2.5:provided
[INFO] ± commons-fileupload:commons-fileupload:jar:1.3.2:compile
[INFO] | - commons-io:commons-io:jar:2.2:compile
[INFO] - org.apache.tomcat.embed:tomcat-embed-jasper:jar:7.0.50:test
[INFO] ± org.apache.tomcat.embed:tomcat-embed-core:jar:7.0.50:test
[INFO] - org.eclipse.jdt.core.compiler:ecj:jar:4.3.1:test

Yes. I have a Engine working on my wildfly and I need to embed the rest service on my Project because I need to do some customizations.

@edgarberlinck, I think if you set scope of camunda-engine to provided, then it should be provided as a shared library on wildfly classpath. Could you please try it out?

Cheers,
Askar

It already done

[INFO] ± org.camunda.bpm:camunda-engine:jar:7.6.0:provided

Did you mean camunda-engine-rest?

@edgarberlinck I mean, you have to configure it in your wildfly application server. And you are rather pointing to your maven project descriptor.

Does that make sense?
Askar

Two things:

  1. My process engine is ok and working.

  2. Yes, configure and provide the Rest engine on my wildfly makes sense, definetly. But how should I do it? That’s the question :slight_smile:

@aakhmerov to be more clear, I need a step-by-step. I’m not bad ass mother fckr wildfly pro. :slight_smile:

Should I deploy a rest engine? Should I use it as a module? Should I cry?

@edgarberlinck,

I think you should deploy rest as a separate web application to be honest. And if you need to make any changes to it, you should do it by cloning our repository, doing changes there, repackaging and deploying your adjusted version.

If you would like to read more about wildfly classloading please refer to https://docs.jboss.org/author/display/WFLY8/Class+Loading+in+WildFly.

Hope that helps,
Askar

Hi @edgarberlinck,

To embed the Engine-REST API on Wildfly, follow the guide you did, but additionally you need to:

  1. Add a dependency to the Camunda-Engine etc. to your WAR. This is done by adding following section to the <build> part of your maven pom:
<build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <configuration>
          <failOnMissingWebXml>false</failOnMissingWebXml>
          <archive>
            <manifestEntries>
              <!-- module dependencies for deployment on AS 7 / Wildfly  -->
              <Dependencies>org.camunda.bpm.camunda-engine,org.camunda.bpm.dmn.camunda-engine-dmn</Dependencies>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
...

Also shown here.

  1. Tell Wildfly to use the Jackson libs inside your WAR (pulled in by the REST API), because otherwise some parts of the REST API won’t work. This is done by adding a file named jboss-deployment-structure.xml to your WEB-INF directory. You can lookup the necessary content of that file here.

  2. Make sure you have a file named org.camunda.bpm.engine.rest.spi.ProcessEngineProvider with the same content as shown here.

Cheers,
Christian