英文:
A problem in Camunda Docs Executable Process Add the ChargeCardWorker.class
问题
这个错误发生在我运行 ChargeCardWorker.class
代码时:
org.camunda.bpm.client.impl.EngineClientException: 任务/客户端-02001 请求 'POST http://localhost:8080/engine-rest/external-task/fetchAndLock HTTP/1.1' 返回错误:状态码 '404' - 消息:状态码:404,原因短语:<!doctype html><html lang='zh'><title>HTTP 状态 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: 状态码:404,原因短语:<!doctype html><html lang='zh'>HTTP 状态 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
我认为我按照教程做得没有错。如何解决这个问题?
英文:
This error occurs when I run the code 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
I don't think I made a mistake by following the tutorial.How to solve this problem?
答案1
得分: 0
404错误表示客户端使用的URL无法访问API。
请检查您的工作程序中是否定义了baseUrl(大约在第12行),并且它是否与服务器公开REST API的URL匹配,例如:
baseUrl("http://localhost:8080/engine-rest")
端口号是否正确?REST API是否已部署?
可以通过在浏览器中访问以下链接来验证:
http://localhost:8080/engine-rest/process-definition/
服务器端可能的原因:
- 服务器未启动
- Camunda未部署
- 部署失败(请检查服务器日志)
- REST API(spring boot starter)未包含在部署中
根据您使用的Camunda版本和部署模型,rest-api可能可以通过不同的URL访问。
较早版本:
> spring-boot -> /rest
> non-spring-boot -> /engine-rest
从7.13版本开始:
> 仅 /engine-rest
还可以尝试访问 http://localhost:8080/engine/process-definition/
英文:
The 404 error indicates that the API cannot be reached under the URL the client is using.
Check if the baseUrl defined in your worker (~line 12) is matches the url under which the server is exposing the REST-API e.g.
baseUrl("http://localhost:8080/engine-rest")
Is the port correct? Is the REST API deployed?
Validate this in your browser e.g. by accessing
http://localhost:8080/engine-rest/process-definition/
Possible causes on the server-side:
- the server is not started
- Camunda is not deployed
- the deployment failed (check server log)
- the REST-API (spring boot starter) was not included in the deployment
Depending on which Camunda version and deployment model you are using the rest-api may be accessible under a different URL.
Older:
> spring-boot -> /rest
> non-spring-boot -> /engine-rest
From 7.13 onward:
> only /engine-rest
Also try http://localhost:8080/engine/process-definition/
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论