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
NullPointerException in 'com.prosysopc.ua.client.UaClient.z(SourceFile:5228)' during connect to Rockwell OpcUa Server
June 12, 2019
23:24, EEST
Avatar
rocket science
Member
Members
Forum Posts: 105
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Hi.

we have some Problem when connecting to a Rockwell OpcUa Server using the Client SDK 3.1.2
Security Mode is BASIC128RSA15_SIGN_ENCRYPT
The Server accepts Anonymous conecction so we do not have a UserIdentity set.

The last logging we see from the SDK is ‘UaClient|DEBUG|connect’ – after this logging, the NPE occurs.

2019-06-12 07:57:15,742|OpcUaService |INFO |Using ServerURI opc.tcp://somehostname:4990/FactoryTalkLinxGateway1
2019-06-12 07:57:15,921|UaApplication |INFO |Prosys OPC UA Java SDK v3.1.2-488
2019-06-12 07:57:16,122|UaApplication |DEBUG|java.home=C:\Program Files (x86)\Java\jre1.8.0_161
2019-06-12 07:57:16,581|OpcUaService |INFO |Using SecurityMode BASIC128RSA15_SIGN_ENCRYPT
2019-06-12 07:57:16,828|UaClient |DEBUG|connect
java.lang.NullPointerException
at com.prosysopc.ua.client.UaClient.z(SourceFile:5228)
at com.prosysopc.ua.client.UaClient.connect(SourceFile:769)

Can you tell what the UaClient does in connect(SourceFile:769) and z(SourceFile:5228)

Is it possibly a problem with the Application certificate?

In other cases (where everything works), the log continues with the CrytoUtil after UaClient.connect

2019-06-12 21:13:51,025|UaClient |DEBUG|connect
2019-06-12 21:13:55,347|CryptoUtil |DEBUG|CryptoUtil init

Thanks for your help!

June 13, 2019
10:04, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1068
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

That is a really old version of the SDK, please update to 4.0.2 if possible.

Do you have this problem if you use the SampleConsoleClient sample of the SDK zip? If not then most likely it is a problem with your code and you can compare it to the samples to find out the difference.

June 13, 2019
10:38, EEST
Avatar
rocket science
Member
Members
Forum Posts: 105
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Thanks for your reply.

In the short way it’s not possible to update to 4.0.2.

One of our customers reported the problem when he uses our application to make a connection to this server. It is not easy to test it directly at the customer because of several IT security restrictions.

I’ve tested it with same security settings (but using a different application certificate and private key) against the Prosys Simulation Server and in this case, the connection works without problems. So in general there seems to be not a problem in our code.

Do you have the possibility to find out what exactly can cause the NPE at com.prosysopc.ua.client.UaClient.z(SourceFile:5228) ?

June 13, 2019
12:35, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1068
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

That would seem to happen if the ApplicationIdentity of the UaClient is set to null (the method in question initializes the lower layer client object which is used to send requests to the server with the getKeys() from the ApplicationIdentity). That is somewhat weird as it is non-null by default nor it should never be set to null, but if you have for some reason called UaClient.setApplicationIdentity(null) it would give that error.

If that didn’t resolve the case, could you try logging with the TRACE log level for both the SDK (com.prosysopc.ua) and the Stack layer (org.opcfoundation.ua). Note that the log can be quite large so it is best to redirect it to a file and send that to us via email (uajava-support@prosysopc.com), if possible.

June 13, 2019
17:00, EEST
Avatar
rocket science
Member
Members
Forum Posts: 105
Member Since:
March 16, 2017
sp_UserOfflineSmall Offline

Thank you!

I guess the customer is using a private key which is not an ‘RSAPrivateKey’. In this case our load method to load the private key from the key store will return null for the ApplicationIdentity.

I’m pretty sure that this will be the problem and check with out customer.

Forum Timezone: Europe/Helsinki
Most Users Ever Online: 1919
Currently Online:
Guest(s) 83
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