18:41, EET
September 25, 2013
Hi,
I’m working to update my Java OSGi based application developed with Prosys OPC UA SDK Client 2.0.0-194 to SDK version 2.2.0-552.
I incurred in a strange error.
During the startup, my code performs this operation :
//…..some code….
Subscription subscription =new Subscription();
for(ReferenceDescription rd:itemList){
String itemName=rd.getNodeId().getValue().toString();
if(StringUtils.isNotNullNotEmptyNotWhiteSpace(itemName) && group.getItemByName(itemName)!=null){
NodeId nd=client.getNamespaceTable().toNodeId(rd.getNodeId());
MonitoredDataItem mi=new MonitoredDataItem(nd, Attributes.Value, MonitoringMode.Reporting);
mi.setSamplingInterval(300);
mi.setDataChangeListener(cacheListener);
//CRASH!
subscription.addItem(mi);
subscription.setPublishingInterval(300);
}
}
//…..
When the subscription.addItem(mi) is invoked, i had this exception :
2016-03-04 16:38:42,902 ERROR – [osgi.tkdata.services.impl.opcuadriverimpl] FrameworkEvent ERROR
org.osgi.framework.BundleException: Exception in osgi.tkdata.services.impl.opcuadriverimpl.Activator.start() of bundle osgi.tkdata.services.impl.opcuadriverimpl.
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
at org.eclipse.osgi.container.Module.doStart(Module.java:571)
at org.eclipse.osgi.container.Module.start(Module.java:439)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1498)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
Caused by: java.lang.NoSuchMethodError: com.prosysopc.ua.client.Subscription.addItem(Lcom/prosysopc/ua/client/MonitoredItem;)V
at osgi.tkdata.services.impl.opcuadriverimpl.OPCUaAsyncDriverImpl.addIOGroup(OPCUaAsyncDriverImpl.java:404)
at osgi.tkdata.services.impl.opcuadriverimpl.support.OPCDriverInitializer.initializeForUse(OPCDriverInitializer.java:35)
at osgi.tkdata.services.impl.opcuadriverimpl.OPCUaDriverFactory.createDriverList(OPCUaDriverFactory.java:335)
at osgi.tkdata.services.impl.opcuadriverimpl.Activator.loadConfiguration(Activator.java:141)
at osgi.tkdata.services.impl.opcuadriverimpl.Activator.activate(Activator.java:71)
at org.eclipse.soda.sat.core.framework.BaseBundleActivator$1.activate(BaseBundleActivator.java:435)
at org.eclipse.soda.sat.core.internal.framework.bundle.BundleActivationManager.activate(BundleActivationManager.java:290)
at org.eclipse.soda.sat.core.internal.framework.bundle.BundleActivationManager.performActivation(BundleActivationManager.java:1589)
at org.eclipse.soda.sat.core.internal.framework.bundle.BundleActivationManager.access$2(BundleActivationManager.java:1574)
at org.eclipse.soda.sat.core.internal.framework.bundle.BundleActivationManager$3.acquired(BundleActivationManager.java:573)
This is incomprehensible for me : i can compile my code….but i can’t execute it.
The strange thing is that i had the same behaviour if i try to migrate from 2.0.0-194 to SDK version Prosys-OPC-UA-Java-SDK-Client-Binary-2.1.2-478.
I’m working with Java SDK 1.8.0.66.
Can you help me?
thanks
10:15, EET
April 17, 2013
17:51, EET
September 25, 2013
19:20, EET
September 25, 2013
Ok, i repeated the test.
I changed my code in this way :
//…
MonitoredItemCreateResult micr = subscription.addItem(mi);
System.err.println(“registerGroup [“+group.getGroupName()+”] => ” + (micr==null?”MICR is NULL”:micr.toString()));
subscription.setPublishingInterval(300);
//….
I tried to connet to UaDemoServer (from UnifiedAutomation, my test server) and to Kepware v5.18 (my production server).
All worked fine : i can connect, read and write with both servers.
I noticed only one strange thing : my code always print the message :
registerGroup [group name] => MICR is NULL
The MonitoredItemCreateResult returned is always null…from javadoc, this could be a problem linked with server connection error….or not?
thanks
9:54, EET
April 17, 2013
10:14, EET
September 25, 2013
10:47, EET
April 17, 2013
Hi again,
Looking at the original post again, it looks like the subscription is created by calling
As you confirmed, the client is connected to the server, but the subscription is not yet created in the server, which causes the subscription.addItem to always return null. You need to call
to get the subscription created in the server. After this, the subscription.addItem method should return normal MonitoredItemCreateResults.
For more subscription related settings and methods, please see the method createSubscription() in SampleConsoleClient.
Most Users Ever Online: 1919
Currently Online:
14 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