camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: .....

1.环境;

win10,camunda7.17.0,jdk11, idea 2022.2.3

利用springboot项目重新构建camunda-engine,用mysql5.7数据库。

2.camunda数据库;

据说可以在启动引擎端spring boot项目的时候自动创建数据库;此处是手动导入创建的。

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第1张图片camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第2张图片

3.camunda引擎端;

https://camunda.com/download/https://camunda.com/download/camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第3张图片camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第4张图片

 修改后pom.xml内容如下;



  4.0.0
  
    org.springframework.boot
    spring-boot-starter-parent
    2.6.4
  
  com.forestlake.workflow
  camunda-engine
  1.0.0-SNAPSHOT

  
    UTF-8
    11
    11
  

  
    
      
        org.springframework.boot
        spring-boot-dependencies
        2.6.4
        pom
        import
      

      
        org.camunda.bpm
        camunda-bom
        7.17.0
        import
        pom
      
    
  

  
    
      org.camunda.bpm.springboot
      camunda-bpm-spring-boot-starter-rest
    

    
      org.camunda.bpm.springboot
      camunda-bpm-spring-boot-starter
      7.17.0
    

    
      org.camunda.bpm.springboot
      camunda-bpm-spring-boot-starter-webapp
    

    
      org.camunda.bpm
      camunda-engine-plugin-spin
    

    
      org.camunda.spin
      camunda-spin-dataformat-all
    

    
      mysql
      mysql-connector-java
      8.0.30
    

    
      org.springframework.boot
      spring-boot-starter-jdbc
    

    
    
      org.codehaus.groovy
      groovy-all
      3.0.13
      pom
    

    
    
      org.codehaus.groovy.modules.http-builder
      http-builder
      0.7.1
    
    
      org.camunda.bpm
      camunda-engine-plugin-connect
      7.17.0
    

    
      org.camunda.connect
      camunda-connect-connectors-all
      1.5.5
    

  

  
    
      
        org.springframework.boot
        spring-boot-maven-plugin
        2.6.4
      
    
  

application.yaml修改如下;

spring:
  datasource:
    url: jdbc:mysql://127.0.0.1:3306/camunda?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&nullCatalogMeansCurrent=true
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: root

 camunda引擎端启动正常;

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第5张图片

4.spring boot 外部任务客户端;

根据官网文档创建外部任务客户端;

外部任务客户端 Spring Boot Starter | docs.camunda.orgCamunda流程平台中文站、中文文档camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第6张图片http://camunda-cn.shaochenfeng.com/user-guide/ext-client/spring-boot-starter/camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第7张图片

 将camunda版本改为7.17.0;

pom.xml如下;



	4.0.0
	com.tjm
	camunda-external-task-java
	0.0.1-SNAPSHOT
	camunda-external-task-java
	camunda外部任务
	
		11
		UTF-8
		UTF-8
		8
		8
	

	
		
			
				org.springframework.boot
				spring-boot-dependencies
				2.6.4
				pom
				import
			
		
	

	
		
			org.camunda.bpm.springboot
			camunda-bpm-spring-boot-starter-external-task-client
			7.17.0
		

		
			org.springframework.boot
			spring-boot-starter-web
		

		
			org.springframework.boot
			spring-boot-starter
		

	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				2.6.4
			
		
	


application.properties如下;

server.port=8083

spring.application.name=external-task

camunda.bpm.client.base-url=http://localhost:8080/engine-rest

camunda.bpm.client.async-response-timeout=20000

camunda.bpm.client.max-tasks=50

camunda.bpm.client.lock-duration=10000

camunda.bpm.client.worker-id=java-client

外部任务订阅类如下;

package com.tjm.externaltask;

import org.camunda.bpm.client.spring.annotation.ExternalTaskSubscription;
import org.camunda.bpm.client.task.ExternalTaskHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @description: 外部任务订阅主题
 * @author: tjm 
 * @date: 2022/11/8 10:03
 * @param: 
 * @return: 
 **/
@Configuration
public class ShoppingService {

    /**
     * @description: 物流发货
     * @author: tjm 
     * @date: 2022/11/8 10:08
     * @param: []
     * @return: org.camunda.bpm.client.task.ExternalTaskHandler
     **/
    @Bean
    @ExternalTaskSubscription(topicName = "deliver_goods", processDefinitionKeyIn = {"Process_shopping"}, lockDuration = 50000)
    public ExternalTaskHandler deliverGoods() {

        return (externalTask, externalTaskService) -> {
            System.out.println("商家已经发货");
            externalTaskService.complete(externalTask);
        };
    }

    /**
     * @description: 收货
     * @author: tjm
     * @date: 2022/11/8 10:08
     * @param: []
     * @return: org.camunda.bpm.client.task.ExternalTaskHandler
     **/
    @Bean
    @ExternalTaskSubscription(topicName = "receive_goods")
    public ExternalTaskHandler receiveGoods() {

        return (externalTask, externalTaskService) -> {
            System.out.println("顾客收到物品");
            externalTaskService.complete(externalTask);
        };
    }
}

启动类入口;

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第8张图片

 5.camunda modler设计流程bpmn文件;

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第9张图片

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第10张图片

6.外部任务客户端spring boot项目启动失败;

"D:\Program Files\Java\jdk-11.0.6\bin\java.exe" "-javaagent:D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.3\lib\idea_rt.jar=57595:D:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2022.2.3\bin" -Dfile.encoding=UTF-8 -classpath D:\TJM-SpringCloud-WorkSpace\camunda实战课程源码--【2022-11-1】\camunda-external-task-java-error\target\classes;D:\localRepository\org\camunda\bpm\springboot\camunda-bpm-spring-boot-starter-external-task-client\7.17.0\camunda-bpm-spring-boot-starter-external-task-client-7.17.0.jar;D:\localRepository\org\camunda\bpm\camunda-external-task-client-spring\7.17.0\camunda-external-task-client-spring-7.17.0.jar;D:\localRepository\org\camunda\bpm\camunda-external-task-client\7.17.0\camunda-external-task-client-7.17.0.jar;D:\localRepository\org\camunda\commons\camunda-commons-logging\1.10.0\camunda-commons-logging-1.10.0.jar;D:\localRepository\org\camunda\commons\camunda-commons-typed-values\7.17.0\camunda-commons-typed-values-7.17.0.jar;D:\localRepository\org\camunda\commons\camunda-commons-utils\1.10.0\camunda-commons-utils-1.10.0.jar;D:\localRepository\org\apache\httpcomponents\httpclient\4.5.13\httpclient-4.5.13.jar;D:\localRepository\org\apache\httpcomponents\httpcore\4.4.15\httpcore-4.4.15.jar;D:\localRepository\commons-codec\commons-codec\1.15\commons-codec-1.15.jar;D:\localRepository\org\springframework\boot\spring-boot-autoconfigure\2.6.4\spring-boot-autoconfigure-2.6.4.jar;D:\localRepository\org\springframework\boot\spring-boot-starter-web\2.6.4\spring-boot-starter-web-2.6.4.jar;D:\localRepository\org\springframework\boot\spring-boot-starter-json\2.6.4\spring-boot-starter-json-2.6.4.jar;D:\localRepository\com\fasterxml\jackson\core\jackson-databind\2.13.1\jackson-databind-2.13.1.jar;D:\localRepository\com\fasterxml\jackson\core\jackson-annotations\2.13.1\jackson-annotations-2.13.1.jar;D:\localRepository\com\fasterxml\jackson\core\jackson-core\2.13.1\jackson-core-2.13.1.jar;D:\localRepository\com\fasterxml\jackson\datatype\jackson-datatype-jdk8\2.13.1\jackson-datatype-jdk8-2.13.1.jar;D:\localRepository\com\fasterxml\jackson\datatype\jackson-datatype-jsr310\2.13.1\jackson-datatype-jsr310-2.13.1.jar;D:\localRepository\com\fasterxml\jackson\module\jackson-module-parameter-names\2.13.1\jackson-module-parameter-names-2.13.1.jar;D:\localRepository\org\springframework\boot\spring-boot-starter-tomcat\2.6.4\spring-boot-starter-tomcat-2.6.4.jar;D:\localRepository\org\apache\tomcat\embed\tomcat-embed-core\9.0.58\tomcat-embed-core-9.0.58.jar;D:\localRepository\org\apache\tomcat\embed\tomcat-embed-el\9.0.58\tomcat-embed-el-9.0.58.jar;D:\localRepository\org\apache\tomcat\embed\tomcat-embed-websocket\9.0.58\tomcat-embed-websocket-9.0.58.jar;D:\localRepository\org\springframework\spring-web\5.3.16\spring-web-5.3.16.jar;D:\localRepository\org\springframework\spring-beans\5.3.16\spring-beans-5.3.16.jar;D:\localRepository\org\springframework\spring-webmvc\5.3.16\spring-webmvc-5.3.16.jar;D:\localRepository\org\springframework\spring-aop\5.3.16\spring-aop-5.3.16.jar;D:\localRepository\org\springframework\spring-context\5.3.16\spring-context-5.3.16.jar;D:\localRepository\org\springframework\spring-expression\5.3.16\spring-expression-5.3.16.jar;D:\localRepository\org\springframework\boot\spring-boot-starter\2.6.4\spring-boot-starter-2.6.4.jar;D:\localRepository\org\springframework\boot\spring-boot\2.6.4\spring-boot-2.6.4.jar;D:\localRepository\org\springframework\boot\spring-boot-starter-logging\2.6.4\spring-boot-starter-logging-2.6.4.jar;D:\localRepository\ch\qos\logback\logback-classic\1.2.10\logback-classic-1.2.10.jar;D:\localRepository\ch\qos\logback\logback-core\1.2.10\logback-core-1.2.10.jar;D:\localRepository\org\slf4j\slf4j-api\1.7.36\slf4j-api-1.7.36.jar;D:\localRepository\org\apache\logging\log4j\log4j-to-slf4j\2.17.1\log4j-to-slf4j-2.17.1.jar;D:\localRepository\org\apache\logging\log4j\log4j-api\2.17.1\log4j-api-2.17.1.jar;D:\localRepository\org\slf4j\jul-to-slf4j\1.7.36\jul-to-slf4j-1.7.36.jar;D:\localRepository\jakarta\annotation\jakarta.annotation-api\1.3.5\jakarta.annotation-api-1.3.5.jar;D:\localRepository\org\springframework\spring-core\5.3.16\spring-core-5.3.16.jar;D:\localRepository\org\springframework\spring-jcl\5.3.16\spring-jcl-5.3.16.jar;D:\localRepository\org\yaml\snakeyaml\1.29\snakeyaml-1.29.jar com.tjm.ExternalTaskApplication
   ____                                           _             ____    _           _      __
  / ___|   __ _   _ __ ___    _   _   _ __     __| |   __ _    |  _ \  | |   __ _  | |_   / _|   ___    _ __   _ __ ___
 | |      / _` | | '_ ` _ \  | | | | | '_ \   / _` |  / _` |   | |_) | | |  / _` | | __| | |_   / _ \  | '__| | '_ ` _ \
 | |___  | (_| | | | | | | | | |_| | | | | | | (_| | | (_| |   |  __/  | | | (_| | | |_  |  _| | (_) | | |    | | | | | |
  \____|  \__,_| |_| |_| |_|  \__,_| |_| |_|  \__,_|  \__,_|   |_|     |_|  \__,_|  \__| |_|    \___/  |_|    |_| |_| |_|

  _____          _                                   _     _____                 _         ____   _   _                  _
 | ____| __  __ | |_    ___   _ __   _ __     __ _  | |   |_   _|   __ _   ___  | | __    / ___| | | (_)   ___   _ __   | |_
 |  _|   \ \/ / | __|  / _ \ | '__| | '_ \   / _` | | |     | |    / _` | / __| | |/ /   | |     | | | |  / _ \ | '_ \  | __|
 | |___   >  <  | |_  |  __/ | |    | | | | | (_| | | |     | |   | (_| | \__ \ |   <    | |___  | | | | |  __/ | | | | | |_
 |_____| /_/\_\  \__|  \___| |_|    |_| |_|  \__,_| |_|     |_|    \__,_| |___/ |_|\_\    \____| |_| |_|  \___| |_| |_|  \__|

  Spring-Boot:  (v2.6.4)
  Camunda Platform: (v7.17.0)
2022-11-08 10:29:23.271  INFO 1800 --- [           main] com.tjm.ExternalTaskApplication          : Starting ExternalTaskApplication using Java 11.0.6 on tjm-12426 with PID 1800 (D:\TJM-SpringCloud-WorkSpace\camunda实战课程源码--【2022-11-1】\camunda-external-task-java-error\target\classes started by DELL in D:\TJM-SpringCloud-WorkSpace\camunda实战课程源码--【2022-11-1】\camunda-external-task-java-error)
2022-11-08 10:29:23.275  INFO 1800 --- [           main] com.tjm.ExternalTaskApplication          : No active profile set, falling back to 1 default profile: "default"
2022-11-08 10:29:24.428  INFO 1800 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8083 (http)
2022-11-08 10:29:24.439  INFO 1800 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2022-11-08 10:29:24.439  INFO 1800 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.58]
2022-11-08 10:29:24.528  INFO 1800 --- [           main] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2022-11-08 10:29:24.528  INFO 1800 --- [           main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1192 ms
2022-11-08 10:29:24.992  INFO 1800 --- [           main] org.camunda.bpm.client                   : TASK/CLIENT-01026 Discovered data format provider: org.camunda.bpm.client.variable.impl.format.json.JacksonJsonDataFormatProvider[name = application/json]
2022-11-08 10:29:24.994  INFO 1800 --- [           main] org.camunda.bpm.client                   : TASK/CLIENT-01025 Discovered data format: org.camunda.bpm.client.variable.impl.format.json.JacksonJsonDataFormat[name = application/json]
2022-11-08 10:29:24.995  INFO 1800 --- [           main] org.camunda.bpm.client                   : TASK/CLIENT-01026 Discovered data format provider: org.camunda.bpm.client.variable.impl.format.serializable.SerializableDataFormatProvider[name = application/x-java-serialized-object]
2022-11-08 10:29:24.995  INFO 1800 --- [           main] org.camunda.bpm.client                   : TASK/CLIENT-01025 Discovered data format: org.camunda.bpm.client.variable.impl.format.serializable.SerializableDataFormat[name = application/x-java-serialized-object]
2022-11-08 10:29:24.995  INFO 1800 --- [           main] org.camunda.bpm.client                   : TASK/CLIENT-01026 Discovered data format provider: org.camunda.bpm.client.variable.impl.format.xml.DomXmlDataFormatProvider[name = application/xml]
2022-11-08 10:29:24.996  WARN 1800 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deliverGoodsSubscription': Unsatisfied dependency expressed through field 'client'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalTaskClient': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
2022-11-08 10:29:24.999  INFO 1800 --- [           main] o.apache.catalina.core.StandardService   : Stopping service [Tomcat]
2022-11-08 10:29:25.010  INFO 1800 --- [           main] ConditionEvaluationReportLoggingListener : 

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-11-08 10:29:25.027 ERROR 1800 --- [           main] o.s.boot.SpringApplication               : Application run failed

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'deliverGoodsSubscription': Unsatisfied dependency expressed through field 'client'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalTaskClient': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:659) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:953) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.16.jar:5.3.16]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.16.jar:5.3.16]
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.4.jar:2.6.4]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.4.jar:2.6.4]
	at com.tjm.ExternalTaskApplication.main(ExternalTaskApplication.java:17) ~[classes/:na]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'externalTaskClient': FactoryBean threw exception on object creation; nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:176) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:101) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1884) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getObjectForBeanInstance(AbstractAutowireCapableBeanFactory.java:1284) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:345) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1389) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.16.jar:5.3.16]
	at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.16.jar:5.3.16]
	... 20 common frames omitted
Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
	at org.camunda.bpm.client.variable.impl.format.xml.DomXmlDataFormatProvider.createInstance(DomXmlDataFormatProvider.java:31) ~[camunda-external-task-client-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.impl.ExternalTaskClientBuilderImpl.lookupProvider(ExternalTaskClientBuilderImpl.java:306) ~[camunda-external-task-client-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.impl.ExternalTaskClientBuilderImpl.lookupCustomDataFormats(ExternalTaskClientBuilderImpl.java:297) ~[camunda-external-task-client-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.impl.ExternalTaskClientBuilderImpl.lookupDataFormats(ExternalTaskClientBuilderImpl.java:285) ~[camunda-external-task-client-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.impl.ExternalTaskClientBuilderImpl.initVariableMappers(ExternalTaskClientBuilderImpl.java:247) ~[camunda-external-task-client-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.impl.ExternalTaskClientBuilderImpl.build(ExternalTaskClientBuilderImpl.java:185) ~[camunda-external-task-client-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.spring.impl.client.ClientFactory.getObject(ClientFactory.java:92) ~[camunda-external-task-client-spring-7.17.0.jar:7.17.0]
	at org.camunda.bpm.client.spring.impl.client.ClientFactory.getObject(ClientFactory.java:36) ~[camunda-external-task-client-spring-7.17.0.jar:7.17.0]
	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:169) ~[spring-beans-5.3.16.jar:5.3.16]
	... 29 common frames omitted
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) ~[na:na]
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ~[na:na]
	... 38 common frames omitted


Process finished with exit code 1

7.问题分析及解决方法;

核心错误信息如下;

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第11张图片

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第12张图片

 处理问题思路如下:

1.根据控制台错误提示信息,应该是名称为"deliverGoodsSubscription"的bean创建失败,于是全项目搜索"deliverGoodsSubscription",并没有发现有该bean名称的声明或者定义;

2.又在camunda-engine引擎端,全文检索"deliverGoodsSubscription",也未发现有该bean名称;

3.又清理了camunda数据库,重新导入脚本;

4.又换jdk8;

5.又换spring boot 版本;

6.又更换项目路径,不放到中文路径下面。

一一尝试后,问题依然没解决,仍然提示"deliverGoodsSubscription"的bean创建失败,问题肯定出在客户端了,根据命名,最接近的源头就是"com.tjm.externaltask.ShoppingService#deliverGoods"。于是继续查阅官方文档,发现问题的根源如下:

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第13张图片

 说明是订阅任务的方法出了问题,关注点回到了下面地方:

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第14张图片

 8.终极解决方法;

 问题的根本原因是:高版本的JDK中不包含javax.xml.bind相关包。

 解决方法:加入低版本的依赖包。


			javax.xml.bind
			jaxb-api
		
		
			com.sun.xml.bind
			jaxb-impl
			4.0.1
		
		
			com.sun.xml.bind
			jaxb-core
			4.0.1
		

客户端完整的pom.xml内容如下:



	4.0.0
	com.tjm
	camunda-external-task-java
	0.0.1-SNAPSHOT
	camunda-external-task-java
	camunda外部任务
	
		11
		UTF-8
		UTF-8
		8
		8
	

	
		
			
				org.springframework.boot
				spring-boot-dependencies
				2.6.4
				pom
				import
			
		
	

	
		
			org.camunda.bpm.springboot
			camunda-bpm-spring-boot-starter-external-task-client
			7.17.0
		

		
			org.springframework.boot
			spring-boot-starter-web
		

		
			org.springframework.boot
			spring-boot-starter
		
		
		
			javax.xml.bind
			jaxb-api
		
		
			com.sun.xml.bind
			jaxb-impl
			4.0.1
		
		
			com.sun.xml.bind
			jaxb-core
			4.0.1
		

	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				2.6.4
			
		
	


客户端正常启动如下:

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第15张图片

9.测试如下;

camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第16张图片

 camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第17张图片

 camunda-external-task-java外部任务项目启动失败,Error creating bean with name ‘externalTaskClient‘: ....._第18张图片

你可能感兴趣的:(springboot,camunda)