Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Camunda外部客户端:建立请求连接时任务/客户端-02002异常_Java_Spring Boot_Camunda - Fatal编程技术网

Java Camunda外部客户端:建立请求连接时任务/客户端-02002异常

Java Camunda外部客户端:建立请求连接时任务/客户端-02002异常,java,spring-boot,camunda,Java,Spring Boot,Camunda,我们从实施基于camunda的工作流解决方案开始。 此时,设置如下所示: Subscribe client for: approveLoan Subscription done Subscribe client for: waitTask Subscription done pojo before: ObjectValue [value=ExamplePojo [num=123, textVal=some text], isDeserialized=true, serializationData

我们从实施基于camunda的工作流解决方案开始。 此时,设置如下所示:

Subscribe client for: approveLoan
Subscription done
Subscribe client for: waitTask
Subscription done
pojo before: ObjectValue [value=ExamplePojo [num=123, textVal=some text], isDeserialized=true, serializationDataFormat=application/x-java-serialized-object, objectTypeName=org.camunda.bpm.example.tasks.ExamplePojo, serializedValue=156 chars, isTransient=false]
pojo changed: ObjectValue [value=ExamplePojo [num=123, textVal=external changed], isDeserialized=true, serializationDataFormat=application/x-java-serialized-object, objectTypeName=org.camunda.bpm.example.tasks.ExamplePojo, serializedValue=156 chars, isTransient=false]
The External Task 28 has been completed!
The External Task 32 has been completed! (done = false)
The External Task 39 has been completed! (done = false)
The External Task 46 has been completed! (done = true)
149038 [TopicSubscriptionManager] ERROR org.camunda.bpm.client - TASK/CLIENT-03001 Exception while fetch and lock task.
org.camunda.bpm.client.impl.EngineClientException: TASK/CLIENT-02002 Exception while establishing connection for request 'POST http://localhost:8080/rest/external-task/fetchAndLock HTTP/1.1'
at org.camunda.bpm.client.impl.EngineClientLogger.exceptionWhileEstablishingConnection(EngineClientLogger.java:36)
at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:101)
at org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
at org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:72)
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.NoHttpResponseException: localhost:8080 failed to respond
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
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
  • 带有嵌入式camunda BPM的spring boot应用程序(通过camunda BPM spring boot starter rest和camunda BPM spring boot starter webapp)
  • 带有外部任务客户端的spring引导应用程序(通过camunda外部任务客户端)
  • 到目前为止一切正常。我们的工作流程正在运行,外部客户正在执行他的工作。。。 但过了一段时间(当外部客户机无事可做时),会在外部任务客户机的日志中看到异常:

    15:49:09.692 [E] [TopicSubscripti] client.logError:70 - TASK/CLIENT-03001 Exception while fetch and lock task.
    org.camunda.bpm.client.impl.EngineClientException: TASK/CLIENT-02002 Exception while establishing connection for request 'POST http://localhost:8080/enrichmentservice/api/rest/1.0/rest/external-task/fetchAndLock HTTP/1.1'
    at org.camunda.bpm.client.impl.EngineClientLogger.exceptionWhileEstablishingConnection(EngineClientLogger.java:36)
    at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:101)
    at org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
    at org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:72)
    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.NoHttpResponseException: localhost:8080 failed to respond
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
    at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
    at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:165)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
    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)
    at org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
    at org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:72)
    at org.camunda.bpm.client.topic.impl.TopicSubscriptionManager.fetchAndLock(TopicSubscriptionManager.java:135)
    
    这可能是什么原因? 服务器或客户端中可能存在配置错误? 备注:外部任务执行缓慢(如10-30秒)

    更新: 我创建了一个完整的示例:

    要创建错误场景,您必须:

  • 在spring boot项目中启动ExampleApplication
  • 在Spring引导客户端项目内启动ExternalClientApp
  • 等几分钟
  • 外部客户端的日志输出应如下所示:

    Subscribe client for: approveLoan
    Subscription done
    Subscribe client for: waitTask
    Subscription done
    pojo before: ObjectValue [value=ExamplePojo [num=123, textVal=some text], isDeserialized=true, serializationDataFormat=application/x-java-serialized-object, objectTypeName=org.camunda.bpm.example.tasks.ExamplePojo, serializedValue=156 chars, isTransient=false]
    pojo changed: ObjectValue [value=ExamplePojo [num=123, textVal=external changed], isDeserialized=true, serializationDataFormat=application/x-java-serialized-object, objectTypeName=org.camunda.bpm.example.tasks.ExamplePojo, serializedValue=156 chars, isTransient=false]
    The External Task 28 has been completed!
    The External Task 32 has been completed! (done = false)
    The External Task 39 has been completed! (done = false)
    The External Task 46 has been completed! (done = true)
    149038 [TopicSubscriptionManager] ERROR org.camunda.bpm.client - TASK/CLIENT-03001 Exception while fetch and lock task.
    org.camunda.bpm.client.impl.EngineClientException: TASK/CLIENT-02002 Exception while establishing connection for request 'POST http://localhost:8080/rest/external-task/fetchAndLock HTTP/1.1'
    at org.camunda.bpm.client.impl.EngineClientLogger.exceptionWhileEstablishingConnection(EngineClientLogger.java:36)
    at org.camunda.bpm.client.impl.RequestExecutor.executeRequest(RequestExecutor.java:101)
    at org.camunda.bpm.client.impl.RequestExecutor.postRequest(RequestExecutor.java:74)
    at org.camunda.bpm.client.impl.EngineClient.fetchAndLock(EngineClient.java:72)
    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.NoHttpResponseException: localhost:8080 failed to respond
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:141)
    at org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:56)
    at org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:259)
    at org.apache.http.impl.DefaultBHttpClientConnection.receiveResponseHeader(DefaultBHttpClientConnection.java:163)
    at org.apache.http.impl.conn.CPoolProxy.receiveResponseHeader(CPoolProxy.java:157)
    at org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:273)
    at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:125)
    at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:272)
    at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
    at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:221)
    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
    

    在不同的机器/jdk/OS上测试后,问题似乎只出现在windows7机器上

    我认为错误原因如下所述:

    因此服务器正在终止http会话,因为它已经很久没有被使用了

    我的解决方法是在客户端配置不同的备份策略,到目前为止,我没有任何错误:

    tldr:我认为这是外部客户端中的一个bug,只发生在Win7上,但我找到了一个解决方法:

        ExternalTaskClient client = ExternalTaskClient.create().baseUrl(baseUrl).backoffStrategy(new ExponentialBackoffStrategy(500L, 2, 30000L)).
                build();
    

    PS我报告它是一个bug:

    在不同的机器/jdk/OS上测试后,问题似乎只出现在Windows7机器上

    我认为错误原因如下所述:

    因此服务器正在终止http会话,因为它已经很久没有被使用了

    我的解决方法是在客户端配置不同的备份策略,到目前为止,我没有任何错误:

    tldr:我认为这是外部客户端中的一个bug,只发生在Win7上,但我找到了一个解决方法:

        ExternalTaskClient client = ExternalTaskClient.create().baseUrl(baseUrl).backoffStrategy(new ExponentialBackoffStrategy(500L, 2, 30000L)).
                build();
    

    PS我将其报告为错误:

    这是暂时的异常吗?您看到的错误表明应用服务器本身——在本例中是Spring Boot中的嵌入式Tomcat应用服务器——没有响应HTTP请求,至少在很短的一段时间内没有响应。我包括了一个完整的示例。这是一个可靠的测试用例吗?换句话说,每次几分钟后,您是否会始终看到此异常?另一个非常重要的问题:当您看到此异常时,您是否能够通过现成的REST API直接连接到Camunda BPM?我每次都会看到它。外部客户端仍在工作,并获得新的作业。唯一的问题是日志中的重复异常,当没有什么要做时,这听起来像是外部任务客户端中的错误。也许你应该报告这个bug并将测试zip文件发送给Camunda?你可以在这里报告:这是暂时的异常吗?您看到的错误表明应用服务器本身——在本例中是Spring Boot中的嵌入式Tomcat应用服务器——没有响应HTTP请求,至少在很短的一段时间内没有响应。我包括了一个完整的示例。这是一个可靠的测试用例吗?换句话说,每次几分钟后,您是否会始终看到此异常?另一个非常重要的问题:当您看到此异常时,您是否能够通过现成的REST API直接连接到Camunda BPM?我每次都会看到它。外部客户端仍在工作,并获得新的作业。唯一的问题是日志中的重复异常,当没有什么要做时,这听起来像是外部任务客户端中的错误。也许你应该报告这个bug并将测试zip文件发送给Camunda?你可以在这里报告: