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
NullPointerException during ConditionRefresh
October 19, 2017
10:23, EEST
Avatar
Thomas Reuther
Member
Members
Forum Posts: 33
Member Since:
September 18, 2017
sp_UserOfflineSmall Offline

Hi there,

I’m using SDK 2.3.2 Eval and try my first alarm.
I used UA Modeler to create an instance of LimitAlarmType. I use the loadModel() method to load the XML file. When I start my server I can see all members of this alarm in address space in UA Expert.
Now, when I drag the Server object to Event view I can see an error message in the servers log:

[log]
10/18/2017 17:09:19.474 INFO Session activated: (ID=ns=1;g=df671245-7745-4e40-999e-7d26e3fa20dc Token=i=805829953 Channel=(SecureChannelId=1 State=Open URL=opc.tcp://localhost:4999/OPCUA/TestServer SecurityPolicy=http://opcfoundation.org/UA/SecurityPolicy#None RemoteAddress=/127.0.0.1:52410))
10/18/2017 17:09:41.301 ERROR While handling CallRequest
RequestHeader=RequestHeader
AuthenticationToken=i=805829953
Timestamp=10/18/17 15:09:41.2851154 GMT
RequestHandle=1002664
ReturnDiagnostics=0
AuditEntryId=null
TimeoutHint=10000
AdditionalHeader=null
MethodsToCall=class org.opcfoundation.ua.core.CallMethodRequest[1]
[0]=CallMethodRequest
ObjectId=i=2782
MethodId=i=3875
InputArguments=class org.opcfoundation.ua.builtintypes.Variant[1]
[0]=2

ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: java.lang.NullPointerException
at com.prosysopc.ua.server.EventManagerUaNode.refreshItem(Unknown Source)
at com.prosysopc.ua.server.EventManager.refreshItems(Unknown Source)
at com.prosysopc.ua.server.EventManager.refresh(Unknown Source)
at com.prosysopc.ua.server.EventManager.onCall(Unknown Source)
at com.prosysopc.ua.server.EventManagerUaNode.onCall(Unknown Source)
at com.prosysopc.ua.server.MethodManagerUaNode.fireCall(Unknown Source)
at com.prosysopc.ua.server.MethodManagerUaNode.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManager.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.call(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.onCall(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition$1.serve(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition.serve(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerSecureChannel.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection$4.onMessageComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.fireComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.setMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

at org.opcfoundation.ua.application.ServiceHandlerComposition$1.serve(Unknown Source)
at org.opcfoundation.ua.application.ServiceHandlerComposition.serve(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerSecureChannel.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection.handleSecureMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.OpcTcpServerConnection$4.onMessageComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.fireComplete(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder.setMessage(Unknown Source)
at org.opcfoundation.ua.transport.tcp.nio.SecureInputMessageBuilder$1.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at com.prosysopc.ua.server.EventManagerUaNode.refreshItem(Unknown Source)
at com.prosysopc.ua.server.EventManager.refreshItems(Unknown Source)
at com.prosysopc.ua.server.EventManager.refresh(Unknown Source)
at com.prosysopc.ua.server.EventManager.onCall(Unknown Source)
at com.prosysopc.ua.server.EventManagerUaNode.onCall(Unknown Source)
at com.prosysopc.ua.server.MethodManagerUaNode.fireCall(Unknown Source)
at com.prosysopc.ua.server.MethodManagerUaNode.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManager.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.callMethod(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.call(Unknown Source)
at com.prosysopc.ua.server.NodeManagementServiceHandler.onCall(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
… 11 more
[/log]

It seems it belongs to a method call of object “i=2782” (=ConditionType) and method “i=3875” (=ConditionRefresh).
So far I did not add any custom code (no EventManagerListener or other).
I wonder that my alarm has no method “ConditionRefresh” although it is defined by condition type. But it has other methods like “Enable”, “Disable”, “Acknowledge” and “AddComment”.
Second I wonder that each method got a new NodeId. They are all in namespace “1”. I expect that every method would have the same node id as defined by the type.

Now I manually add a reference to ConditionRefresh:
[XML]
<UAObject NodeId=”ns=1;i=5008″ BrowseName=”1:MyAlarm”>
<DisplayName>MyAlarm</DisplayName>
<References>
<Reference ReferenceType=”HasComponent”>i=3875</Reference>
</References>
</UAObject>
[/XML]
I can see this method in address space using UA Expert. But when I put the Server object again into Event view the same NullPointerException occurs.

Remarks:
UA Experts tells everything is alright (“Call ConditionRefresh returned Good for ServerId TestServer.”) There are also two events in list: RefreshStartEvent and RefreshEndEvent. So, from a client’s point of view everything is alright. But there is this error message in the server’s log.

Thomas

October 19, 2017
11:56, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1026
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

The current best practice has been that the types are defined in UaModeler, the exported NodeSet is codegenerated and then loaded to the server.
The actual instances of the types are then made by calling NodeManagerUaNode.createInstance methods.

In theory loading instances from the model works, as long as they do not need any special instantiation, however alarm types and few others do. Currently it is expected that some optional nodes are always instantiated. In addition some nodes must be initialized to correct values, mostly TwoStateVariableType.Id boolean value must be init either to true or false. The standard model does not define the state, i.e. the value is null in the standard NodeSets, the backed field is Boolean but the SDK api uses boolean as it shall be either true/false after initialization (therefore it will NPE if not set).

And we also have a known issue that even with NodeManagerUaNode.createInstance it works only if instantiating an alarm type directly, i.e. not part of a larger type.

The model loading system does not yet recognize typestructures of the nodes. The end goal would be that loading the model would give the same result as creation via .createInstance.

– Bjarne

October 19, 2017
12:33, EEST
Avatar
Thomas Reuther
Member
Members
Forum Posts: 33
Member Since:
September 18, 2017
sp_UserOfflineSmall Offline

Hi Bjarne,

thank you for information!

Thomas

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
8 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

Heikki Tahvanainen: 402

hbrackel: 144

rocket science: 88

pramanj: 86

Francesco Zambon: 83

Ibrahim: 78

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

Member Stats:

Guest Posters: 0

Members: 737

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

fannielima, kristiewinkle8, rust, christamcdowall, redaahern07571, nigelbdhmp, travistimmons, AnnelCib, dalenegettinger, howardkennerley

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1026, Jimmy Ni: 26, Matti Siponen: 346, Lusetti: 0

Administrators: admin: 1