Please consider registering

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —

— Match —

— Forum Options —

Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed Topic RSS sp_TopicIcon
Bad_NodeIdUnknown when readvalues
July 2, 2020
8:00, EET
New Member
Forum Posts: 1
Member Since:
July 2, 2020
sp_UserOfflineSmall Offline

Hi all, I just execute the sampleclient to read some values. The method readValue can retrieve correct value from simulator,but when I change it to readValues it seems doesn’t work. I got status_code “Bad_NodeIdUnknown” in response.
I wonde Is there a known issue or something wrong with my code ? Thanks in advance.

sdk version : Prosys OPC UA SDK for Java v4.3.0-1075

code :
public static void main(String[] args) throws Exception {
UaClient client = new UaClient(“opc.tcp://”);
DataValue value = client.readValue(Identifiers.Server_ServerStatus_State);



DataValue v2 = client.readValue(metrics.get(0));
// v2 returned correct value. DataValue(value=1.0453014, statusCode=GOOD (0x00000000) “”, sourceTimestamp=07/02/20 04:09:01.0000000 GMT, sourcePicoseconds=0, serverTimestamp=07/02/20 04:09:01.9120000 GMT, serverPicoseconds=0)

// values and values2 both return “Bad_NodeIdUnknown”
DataValue[] values = client.readValues(new ExpandedNodeId[metrics.size()], null, TimestampsToReturn.Both, 0d);
for (DataValue data : values) {
DataValue[] values2 = client.readValues(new NodeId[metrics2.size()], null, TimestampsToReturn.Both, 0d);
for (DataValue data : values2) {

// metrics structure
public static List metrics = new ArrayList();
public static List metrics2 = new ArrayList();

I found the problem, nothing to do with sdk. It’s a code issue.Smile

July 2, 2020
11:43, EET
Matti Siponen

Forum Posts: 72
Member Since:
February 11, 2020
sp_UserOfflineSmall Offline


Based on this code, it seems that you’re using empty arrays of ExpandedNodeId and NodeId in client.readValues calls for values and values2. After creating an array you must add entries to it with metrics.toArray(metricsArray), where metricsArray is

ExapndedNodeId[] metricsArray = new ExpandedNodeId[(metrics.size()]

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
12 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 103

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 38

Rainer Versteeg: 32

Thomas Reuther: 31

Member Stats:

Guest Posters: 0

Members: 1160

Moderators: 15

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1048

Posts: 4416

Newest Members:

jonas.rahm, sophiekohler, zqecortney, adeletoscano947, forestgenders23, auroratrumper, ericmclain04, rblu, starlowery23194, dakotadalgety82

Moderators: Jouni Aro: 853, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 579, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Teppo Uimonen: 21, Markus Johansson: 24, Matti Siponen: 72, Lusetti: 0

Administrators: admin: 1