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
NoSuchMethodError updating to Prosys-OPC-UA-Java-SDK-Client-Binary-2.2.0-552
March 11, 2016
18:41, EET
Avatar
d.zinato
Member
Members
Forum Posts: 9
Member Since:
September 25, 2013
sp_UserOfflineSmall Offline

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

March 14, 2016
10:15, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

Weird error indeed. The return value of the addItem method has changed from void to MonitoredItemCreateResult. Is it maybe possible that the compilation and running is somehow made with different SDK versions?

March 22, 2016
17:51, EET
Avatar
d.zinato
Member
Members
Forum Posts: 9
Member Since:
September 25, 2013
sp_UserOfflineSmall Offline

Hello Heikki,

thank you for your response.
I can verify again the compilation process, forcing the MonitoredItemCreateResult as return type…..so I can understand better the situation.

March 22, 2016
19:20, EET
Avatar
d.zinato
Member
Members
Forum Posts: 9
Member Since:
September 25, 2013
sp_UserOfflineSmall Offline

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

March 23, 2016
9:54, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

As a first step, it would be good to double check that the client is definitely connected to the server. Could you add the following printing and report the results.

System.err.println("client.isConnected()=" + client.isConnected());
March 23, 2016
10:14, EET
Avatar
d.zinato
Member
Members
Forum Posts: 9
Member Since:
September 25, 2013
sp_UserOfflineSmall Offline

Ok, the client is connected to server, this is the message :

client.isConnected()=true

March 23, 2016
10:47, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi again,

Looking at the original post again, it looks like the subscription is created by calling

Subscription subscription =new Subscription();

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

client.addSubscription(subscription);

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.

March 23, 2016
13:04, EET
Avatar
d.zinato
Member
Members
Forum Posts: 9
Member Since:
September 25, 2013
sp_UserOfflineSmall Offline

Thank you Heikki,

you were right, now all works fine.Smile

March 23, 2016
13:16, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hi,

Nice to hear. Please contact us if you have more questions.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
15 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

rocket science: 77

Ibrahim: 76

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 683

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

digitechroshni, LouieWreve, Kickbiche, karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma

Moderators: Jouni Aro: 1010, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 983, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 321, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1