Avatar
Please consider registering
guest
sp_LogInOut Log Insp_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 RSSsp_TopicIcon
Java SDK Cast Error
December 1, 2016
19:00, EET
Avatar
dhooper
Connecticut
Member
Members
Forum Posts: 6
Member Since:
December 1, 2016
sp_UserOfflineSmall Offline

Hello,

I am getting an unknown error in our client built on top of the Prosys Java stack. We are attempting to add nodes to a subscription, so we do the following:

for(SubscriptionNode node : nodesToAdd) {

AbstractMonitoredItemFactory factory =
node.isAlarmEvent() ? new MonitoredEventItemFactory() : new MonitoredDataItemFactory();

// unserialize our node id
NodeId nodeId = NodeUtilities.unserializeNodeId(node.getNodeId(), subscription.getClient(), “Subscriptions”);

// create the new monitored item
MonitoredItem monitoredItem = factory.createMonitoredItem(
nodeId, node.getAttribute(), node.getDeadbandType(),
node.getDeadbandValue(), node.getPublishingInterval()
);

if(subscription.getNotificationListeners().length == 0) {
subscription.addNotificationListener(
new EmpriseSubscriptionListener(serverId, serverDescription, serverIp));
}

// add it to the subscription
try {
MonitoredItemCreateResult result = subscription.addItem(monitoredItem);
node.setMonitoredItemId(result.getMonitoredItemId());
node.setNodeStatus(“Complete”);
node.setLastOperation(“Subscribed”);
} catch (ServiceException | StatusException e) {
log.error(“Subscriptions : {}@{} : Unable to add node- {} to subscription {}”,
serverDescription, serverIp, nodeId, subscription, e);
node.setNodeStatus(“Error”);
}
}
}

However, upon reaching “MonitoredItemCreateResult result = subscription.addItem(monitoredItem);”, we get the error:
java.lang.ClassCastException: org.opcfoundation.ua.core.DataChangeFilter cannot be cast to org.opcfoundation.ua.core.MonitoringFilterResult

I realize this has to do with the OPC UA stack, but this error is generated in com.prosysopc.ua.client.Subscription.createMonitoredItems. Does anyone know what might cause this? We are using KepServerEx 6 and UAGateway for in-house simulations. We recently upgraded to KepServerEx 6 from 5, so that could be a source of the problem, but if someone sees something that can be done programatically, locally, that would be a huge help.

December 2, 2016
11:03, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1044
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

We’ve just got the same report from another customer using KepServerEx. And it seems it has a bug that it is returning the DataChangeFilter back in the response message instead of a MonitoringFilterResult as defined by the OPC UA Specification. I suggest that you contact Kepware about this issue in their server.

December 2, 2016
20:42, EET
Avatar
dhooper
Connecticut
Member
Members
Forum Posts: 6
Member Since:
December 1, 2016
sp_UserOfflineSmall Offline

Thank you for the reply and help. I will reach out to Kepware now, and if they have a solution, I will post it here for anyone interested.

December 14, 2016
15:53, EET
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 1044
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

We just got a confirmation from Kepware that this is now fixed and a patch should be available. Please contact Kepware support to get the patch.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 98
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 100
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 773
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1558
Posts: 6567
Newest Members:
aracelyhaley4, raphaelschonell, Ashmag, kathyreimann56, brittanylemos, dorthycundiff76, PromotionToold, CHHinrichs, rodricklienhop, jose_Wanderlei
Moderators: Jouni Aro: 1039, Pyry: 1, Petri: 1, Bjarne Boström: 1054, Jimmy Ni: 26, Matti Siponen: 359, Lusetti: 0
Administrators: admin: 1