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
Problems accessing ValueHistory
May 1, 2016
14:17, EEST
Avatar
Karri Kumara
Member
Members
Forum Posts: 3
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

I am using mostly unaltered versions of the MyHistorian and ValueHistory included in the SDK samples.
I am trying to implement a way to manually insert values into the ValueHistory. I created this function :

class ValueHistory {

public boolean manualInsert(DataValue[] newValues)
{
System.out.println(” YOU GOT HERE!”);
return true;
}

}

Which I access through calling the client’s historyUpdateData:

@Override
public void onUpdateData(ServiceContext serviceContext, Object dataset,
NodeId nodeId, UaNode node, DataValue[] updateValues,
PerformUpdateType performInsertReplace,
StatusCode[] operationResults, DiagnosticInfo[] operationDiagnostics)
throws StatusException {
if(performInsertReplace == PerformUpdateType.Insert)
{
if(variableHistories == null)
{
System.out.println(” VARIABLEHISTORIES WAS NULL”);
} else if (variableHistories.get(node) == null){
System.out.println(” VARIABLEHISTORY WAS NULL”);
} else
System.out.println(” RIGHT PLACE!”);
variableHistories.get(node).manualInsert(updateValues);
} else
throw new StatusException(StatusCodes.Bad_HistoryOperationUnsupported);
}

However, for some reason, even though the manualInsert function does essentially nothing, calling it gives me an error:

05/01/2016 14:13:20.729 ERROR While handling HistoryUpdateRequest (id=449012442)
HistoryUpdateDetails=class org.opcfoundation.ua.builtintypes.ExtensionObject[1]
[0]={class org.opcfoundation.ua.builtintypes.ExtensionObject}UpdateDataDetails: UpdateDataDetails (id=546516673)
PerformInsertReplace=PerformUpdateType (id=1880919416)
value=1
ordinal=0
name=Insert
UpdateValues=class org.opcfoundation.ua.builtintypes.DataValue[10]
[0]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=(null), statusCode=GOOD (0x00000000) “”, sourceTimestamp=null, sourcePicoseconds=0, serverTimestamp=null, serverPicoseconds=0)
[1]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=1.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:01.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:01.0000000 GMT, serverPicoseconds=0)
[2]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=2.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:02.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:02.0000000 GMT, serverPicoseconds=0)
[3]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=3.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:03.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:03.0000000 GMT, serverPicoseconds=0)
[4]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=4.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:04.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:04.0000000 GMT, serverPicoseconds=0)
[5]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=5.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:05.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:05.0000000 GMT, serverPicoseconds=0)
[6]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=6.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:06.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:06.0000000 GMT, serverPicoseconds=0)
[7]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=7.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:07.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:07.0000000 GMT, serverPicoseconds=0)
[8]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=8.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:08.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:08.0000000 GMT, serverPicoseconds=0)
[9]={class org.opcfoundation.ua.builtintypes.DataValue}DataValue(value=9.0, statusCode=GOOD (0x00000000) “”, sourceTimestamp=01/31/16 22:00:09.0000000 GMT, sourcePicoseconds=0, serverTimestamp=01/31/16 22:00:09.0000000 GMT, serverPicoseconds=0)
NodeId={class org.opcfoundation.ua.builtintypes.NodeId}ns=2;s=SetPoint9b56f455-0275-40ec-aca1-3adcda644779

RequestHeader=RequestHeader (id=365817744)
TimeoutHint={class org.opcfoundation.ua.builtintypes.UnsignedInteger}30000
ReturnDiagnostics={class org.opcfoundation.ua.builtintypes.UnsignedInteger}0
Timestamp={class org.opcfoundation.ua.builtintypes.DateTime}05/01/16 11:13:20.7250000 GMT
AdditionalHeader=null
AuthenticationToken={class org.opcfoundation.ua.builtintypes.NodeId}i=1812299361
RequestHandle={class org.opcfoundation.ua.builtintypes.UnsignedInteger}810
AuditEntryId=null

ServiceFault: Bad_InternalError (0x80020000) “An internal error occurred as a result of a programming or configuration error.”
Diagnostic Info: java.lang.NullPointerException
at fi.opc.ua.server.MyHistorian.onUpdateData(MyHistorian.java:284)
at com.prosysopc.ua.server.HistoryManager.historyUpdate(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.historyUpdate(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.updateNodeHistory(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.historyUpdate(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.onHistoryUpdate(Unknown Source)
at sun.reflect.GeneratedMethodAccessor6.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 fi.opc.ua.server.MyHistorian.onUpdateData(MyHistorian.java:284)
at com.prosysopc.ua.server.HistoryManager.historyUpdate(Unknown Source)
at com.prosysopc.ua.server.NodeManagerTable.historyUpdate(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.updateNodeHistory(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.historyUpdate(Unknown Source)
at com.prosysopc.ua.server.AttributeServiceHandler.onHistoryUpdate(Unknown Source)
at sun.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
… 11 more

What could be the cause of this? Where should I begin fixing this?

May 2, 2016
13:41, EEST
Avatar
Heikki Tahvanainen
Member
Members
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hei Karri,

The NullPointer seems to be coming from the row

variableHistories.get(node).manualInsert(updateValues);

This is odd because you are checking the possible null value in line

variableHistories.get(node) == null

So, the first thing is to find out what causes the NPE. I suggest that you add logging to find out what variableHistories.get(node) returns.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
15 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: 738

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1524

Posts: 6450

Newest Members:

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

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

Administrators: admin: 1