Camunda Docs 可执行进程中的问题添加 ChargeCardWorker.class
A problem in Camunda Docs Executable Process Add the ChargeCardWorker.class
当我运行代码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.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
我不认为我按照tutorial.How解决这个问题的错误吗?
404错误表示在客户端使用的URL下无法访问API
检查您的 worker(~第 12 行)中定义的 baseUrl 是否与服务器公开 REST-API 的 url 相匹配,例如
baseUrl("http://localhost:8080/engine-rest")
端口是否正确?是否部署了 REST API?
在您的浏览器中验证这一点,例如通过访问
http://localhost:8080/engine-rest/process-definition/
server-side 上的可能原因:
- 服务器未启动
- Camunda 未部署
- 部署失败(检查服务器日志)
- 部署中未包含 REST-API(spring 启动程序)
根据您使用的 Camunda 版本和部署模型,rest-api 可能可以在不同的 URL 下访问。
年长者:
spring-boot -> /rest
non-spring-boot -> /engine-rest
从 7.13 开始:
only /engine-rest
也试试 http://localhost:8080/engine/process-definition/
当我运行代码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.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
我不认为我按照tutorial.How解决这个问题的错误吗?
404错误表示在客户端使用的URL下无法访问API
检查您的 worker(~第 12 行)中定义的 baseUrl 是否与服务器公开 REST-API 的 url 相匹配,例如
baseUrl("http://localhost:8080/engine-rest")
端口是否正确?是否部署了 REST API? 在您的浏览器中验证这一点,例如通过访问 http://localhost:8080/engine-rest/process-definition/
server-side 上的可能原因:
- 服务器未启动
- Camunda 未部署
- 部署失败(检查服务器日志)
- 部署中未包含 REST-API(spring 启动程序)
根据您使用的 Camunda 版本和部署模型,rest-api 可能可以在不同的 URL 下访问。
年长者:
spring-boot -> /rest non-spring-boot -> /engine-rest
从 7.13 开始:
only /engine-rest
也试试 http://localhost:8080/engine/process-definition/