14:17, EEST
May 1, 2016
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-3adcda644779RequestHeader=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=nullServiceFault: 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?
13:41, EEST
April 17, 2013
Hei Karri,
The NullPointer seems to be coming from the row
This is odd because you are checking the possible null value in line
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.
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: 730
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemae, gabriellabachusModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1