You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2026/04/26 10:39:29 UTC
(streampipes) branch improve-opc-ua-startup-errors created (now 33ffce980b)
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a change to branch improve-opc-ua-startup-errors
in repository https://gitbox.apache.org/repos/asf/streampipes.git
at 33ffce980b chore: Improve user message upon failed startup of opc ua adapter
This branch includes the following new commits:
new 33ffce980b chore: Improve user message upon failed startup of opc ua adapter
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(streampipes) 01/01: chore: Improve user message upon failed startup of opc ua adapter
Posted by ri...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
dominikriemer pushed a commit to branch improve-opc-ua-startup-errors
in repository https://gitbox.apache.org/repos/asf/streampipes.git
commit 33ffce980b58a0d8bcd6d7093301d24163edb0b6
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Sun Apr 26 12:39:15 2026 +0200
chore: Improve user message upon failed startup of opc ua adapter
---
.../connectors/opcua/adapter/OpcUaAdapter.java | 30 +++++++++++++++++++---
.../AdapterStateChangeOperationHandler.java | 3 ++-
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java
index 20218feeed..e08df19a47 100644
--- a/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java
+++ b/streampipes-extensions/streampipes-connectors-opcua/src/main/java/org/apache/streampipes/extensions/connectors/opcua/adapter/OpcUaAdapter.java
@@ -139,16 +139,38 @@ public class OpcUaAdapter implements StreamPipesAdapter, IPullAdapter, SupportsR
this.allNodes.forEach(node -> this.nodeIdToLabelMapping
.put(node.nodeInfo().getNodeId().toString(), node.nodeInfo().getDisplayName()));
-
} catch (Exception e) {
- LOG.debug(
- "The connection to the OPC UA server {} could not be established for selected nodes {}",
+ var errorMessage = buildStartupErrorMessage(e);
+ LOG.error(
+ "OPC UA adapter startup failed for server {} and selected nodes {}: {}",
opcUaAdapterConfig.getOpcServerURL(),
opcUaAdapterConfig.getSelectedNodeNames(),
+ errorMessage,
e
);
- throw new AdapterException("The Connection to the OPC UA server could not be established.", e);
+ throw new AdapterException(errorMessage, e);
+ }
+ }
+
+ private String buildStartupErrorMessage(Exception exception) {
+ var rootCause = getRootCause(exception);
+ var rootMessage = rootCause.getMessage();
+
+ if (rootMessage == null || rootMessage.isBlank()) {
+ rootMessage = rootCause.getClass().getSimpleName();
}
+
+ return "Could not start OPC UA adapter: " + rootMessage;
+ }
+
+ private Throwable getRootCause(Throwable throwable) {
+ var current = throwable;
+
+ while (current.getCause() != null && current.getCause() != current) {
+ current = current.getCause();
+ }
+
+ return current;
}
@Override
diff --git a/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java b/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java
index 97ac22c5c8..1b35a0f071 100644
--- a/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java
+++ b/streampipes-nats-extensions/src/main/java/org/apache/streampipes/nats/extensions/operation/connect/AdapterStateChangeOperationHandler.java
@@ -91,10 +91,11 @@ public class AdapterStateChangeOperationHandler implements ExtensionBrokerOperat
adapterDescription.getElementId(),
e
);
+ var responseException = new AdapterException(e.getMessage());
return new ExtensionServiceBrokerResponseEnvelope(
request.getRequestId(),
ExtensionBrokerResponseFactory.HTTP_STATUS_INTERNAL_SERVER_ERROR,
- objectMapper.writeValueAsString(e),
+ objectMapper.writeValueAsString(responseException),
new ExtensionServiceBrokerErrorEnvelope(e.getClass().getSimpleName(), e.getMessage())
);
}