Avatar

Please consider registering
guest

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
Nullpointer Exception as trying to update an UaVariableNode on the server side during multiple accesses from clients
September 12, 2016
16:32, EEST
Avatar
zhicong_xian
Member
Members
Forum Posts: 3
Member Since:
September 12, 2016
sp_UserOfflineSmall Offline

Hello everyone,

i have one problem that often occurs as i try to run ProSys Java Evaluation Stack for a longer time period with multiple client session:

below is my code:

for the initialization of UaVariableNode:

private void createCartesianForceValues() throws StatusException {

CartesianForceValues = new UaVariableNode[3];

final String[] name = { “ForceInX”, “ForceInY”, “ForceInZ” };
final NodeId[] variableId = new NodeId[3];

variableId[0] = new NodeId(getNamespaceIndex(), name[0]);
variableId[1] = new NodeId(getNamespaceIndex(), name[1]);
variableId[2] = new NodeId(getNamespaceIndex(), name[2]);
CartesianForceValues[0] = new PlainVariable(this,
variableId[0], name[0], Locale.ENGLISH);
CartesianForceValues[0].setValue(Double.valueOf(0));
CartesianForceValues[0].setValueRank(-1);
CartesianForceValues[0].setBrowseName(new QualifiedName(name[0]));
CartesianForceValues[0].setAccessLevel(AccessLevel.READONLY);

CartesianForceValues[1] = new PlainVariable(this,
variableId[1], name[1], Locale.ENGLISH);
CartesianForceValues[1].setValue(Double.valueOf(0));
CartesianForceValues[1].setValueRank(-1);
CartesianForceValues[1].setBrowseName(new QualifiedName(name[1]));
CartesianForceValues[1].setAccessLevel(AccessLevel.READONLY);

CartesianForceValues[2] = new PlainVariable(this,
variableId[2], name[2], Locale.ENGLISH);
CartesianForceValues[2].setValue(Double.valueOf(0));
CartesianForceValues[2].setValueRank(-1);
CartesianForceValues[2].setBrowseName(new QualifiedName(name[2]));
CartesianForceValues[2].setAccessLevel(AccessLevel.READONLY);

this.addNodeAndReference(ExternalCartesianForceOnFlange,
CartesianForceValues[0], Identifiers.HasComponent);

this.addNodeAndReference(ExternalCartesianForceOnFlange,
CartesianForceValues[1], Identifiers.HasComponent);

this.addNodeAndReference(ExternalCartesianForceOnFlange,
CartesianForceValues[2], Identifiers.HasComponent);

}
To update the value of UaVariable Node
public void setCartesianForceValues(Vector forces) throws StatusException {

CartesianForceValues[0].updateValue(Double.valueOf(forces.getX()));
CartesianForceValues[1].updateValue(Double.valueOf(forces.getY()));
CartesianForceValues[2].updateValue(Double.valueOf(forces.getZ()));

Double[] force = { forces.getX(), forces.getY(), forces.getZ() };
Variant variant = new Variant(force);
DataValue dataValue = new DataValue(new Variant(new Double[3]));
dataValue.setValue(variant);
CartesianForceValuesInArray.updateValue(dataValue);
setCartesianForceManitude(forces.length());

}

At the code row:
“CartesianForceValues[0].updateValue(Double.valueOf(forces.getX()));” there is an Nullpointer Exception.

2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] java.lang.NullPointerException
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.MonitoredDataItem.isAccessible(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.MonitoredDataItem.notifyDataChange(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.MonitoredDataItem.notifyDataChange(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.j.onDataChange(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.nodes.ServerNode.fireDataChange(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.nodes.ServerNode.dataChange(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.nodes.UaVariableNode.setValue(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.nodes.UaVariableNode.updateValue(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.nodes.PlainVariable.updateValue(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at com.prosysopc.ua.server.nodes.UaVariableNode.updateValue(Unknown Source)
2016-09-12 14:09:42,175 ERROR [.. pool-1-thread-1] at server.LBRNodeManager.setCartesianForceValues(LBRNodeManager.java:1969)

September 13, 2016
12:24, EEST
Avatar
zhicong_xian
Member
Members
Forum Posts: 3
Member Since:
September 12, 2016
sp_UserOfflineSmall Offline

At the end i solved it by disconnecting the opc ua client and then reconnect it to the server. But it really seems that there is a bug in the ProSys Stacks..

September 13, 2016
13:12, EEST
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

I’m sorry to hear that you’re experiencing problems. It’s good to hear that you were able to solve the immediate issue by reconnecting the client but it would be good to find and solve the actual bug here.

I’m having some difficulty reproducing this issue and for this reason I would like to ask some more details.

You mention that the issue arises when you run the application “for a longer time period”? Is there some regular time period before the issue can be noticed? How long is this time period? Does the issue repeat itself all the time after this initial time period?

You mention that there’s multiple client session. How many clients are connected to the OPC UA server in question?

Thanks for reporting this.

September 14, 2016
18:12, EEST
Avatar
zhicong_xian
Member
Members
Forum Posts: 3
Member Since:
September 12, 2016
sp_UserOfflineSmall Offline

Heikki Tahvanainen said
Hello,

I’m sorry to hear that you’re experiencing problems. It’s good to hear that you were able to solve the immediate issue by reconnecting the client but it would be good to find and solve the actual bug here.

I’m having some difficulty reproducing this issue and for this reason I would like to ask some more details.

You mention that the issue arises when you run the application “for a longer time period”? Is there some regular time period before the issue can be noticed? How long is this time period? Does the issue repeat itself all the time after this initial time period?

You mention that there’s multiple client session. How many clients are connected to the OPC UA server in question?

Thanks for reporting this.  

Hello Mr. Tahvanainen,

one case i encountered is: the opc ua server went down as the client is still trying to connect to it. After a while, the ua server restarts again so the same client can now connect to the server automatically and read the data from the server. At this moment, the nullpointer exception pops out.

Another case would be, my ua client is connected to the server and reads 16 history variables cyclically and simultaneously it also subscribes to 9 ua variables and listening to events sourced to a ua object node, after a random time, the same nullpointer exception pops out.

Maybe some more details about my opc ua server would be helpful.

Basically i am abstracting the robot data using opc ua to build the opc ua server. In every cycle of my robot background tasks, the robot specific data would be polled and then updated to the opc ua server.

It seems to me now, the number of the client session are not relevant, and also the time period this error occurs is randomly…

If you have further questions, feel free to ask me 🙂

September 16, 2016
8:07, EEST
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

Thanks for the information. At the moment this sounds like a timing related bug.

Does this NPE reproduce in your system always when you run the software for a longer time?

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
17 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1