Java Camunda Docs可执行进程添加ChargeCardWorker.class时出现问题

Java Camunda Docs可执行进程添加ChargeCardWorker.class时出现问题,java,camunda,Java,Camunda,运行ChargeCardWorker.class代码时发生此错误 org.camunda.bpm.client.impl.EngineClientException: TASK/CLIENT-02001 Request 'POST http://localhost:8080/engine-rest/external-task/fetchAndLock HTTP/1.1' returned error: status code '404' - message: status code: 404,

运行ChargeCardWorker.class代码时发生此错误

org.camunda.bpm.client.impl.EngineClientException: TASK/CLIENT-02001 Request 'POST http://localhost:8080/engine-rest/external-task/fetchAndLock HTTP/1.1' returned error: status code '404' - message: status code: 404, reason phrase: <!doctype html><html lang='zh'><title>HTTP Status 404</title><h3>Apache Tomcat/8.5.50</h3></html>
    at org.camunda.bpm.client.impl.EngineClientLogger.exceptionWhileReceivingResponse(EngineClientLogger.java:30)
    at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:97)
    at org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
    at org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:78)
    at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.fetchAndLock(TopicSubscriptionManager.java:135)
    at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:101)
    at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:87)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.http.client.HttpResponseException: status code: 404, reason phrase: <!doctype html><html lang='zh'>HTTP Status 404<h3>Apache Tomcat/8.5.50</h3></body></html>
    at org.camunda.bpm.client.impl.RequestExecutor$1.handleResponse(RequestExecutor.java:146)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:223)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:165)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:140)
    at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:88)
    ... 6 more
org.camunda.bpm.client.impl.EngineClientException:任务/client-02001请求“发布”http://localhost:8080/engine-rest/external task/fetchAndLock HTTP/1.1'返回错误:状态代码“404”-消息:状态代码:404,原因短语:HTTP状态404 Apache Tomcat/8.5.50
在org.camunda.bpm.client.impl.EngineClientLogger.Exception接收响应时(EngineClientLogger.java:30)
位于org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:97)
位于org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
位于org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:78)
位于org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.fetchAndLock(TopicSubscriptionManager.java:135)
位于org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.acquire(TopicSubscriptionManager.java:101)
位于org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.run(TopicSubscriptionManager.java:87)
运行(Thread.java:748)
原因:org.apache.http.client.HttpResponseException:状态代码:404,原因短语:http状态404 apache Tomcat/8.5.50
位于org.camunda.bpm.client.impl.RequestExecutor$1.handleResponse(RequestExecutor.java:146)
在org.apache.http.impl.client.CloseableHttpClient.execute上(CloseableHttpClient.java:223)
在org.apache.http.impl.client.CloseableHttpClient.execute上(CloseableHttpClient.java:165)
在org.apache.http.impl.client.CloseableHttpClient.execute上(CloseableHttpClient.java:140)
位于org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:88)
... 还有6个

我不认为我在遵循教程的过程中犯了错误。如何解决这个问题?

404错误表示无法通过客户端使用的URL访问API

检查worker(~第12行)中定义的baseUrl是否与服务器公开REST-API的url匹配,例如。
baseUrl(“http://localhost:8080/engine-rest“

端口正确吗?是否部署了restapi? 在浏览器中对此进行验证,例如访问

服务器端的可能原因:

  • 服务器未启动
  • 未部署Camunda
  • 部署失败(请检查服务器日志)
  • 部署中不包括REST-API(spring boot starter)
根据您使用的Camunda版本和部署模型,rest api可以在不同的URL下访问

老年人:

从7.13开始:


也尝试http://localhost:8080/engine/process-定义/

旧的spring引导路径不是“rest”不是“engine”吗?
spring-boot -> /rest
non-spring-boot -> /engine-rest
only /engine-rest