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
stuck within UaClient#connect()
February 13, 2024
17:14, EET
Avatar
broessl
Member
Members
Forum Posts: 3
Member Since:
February 13, 2024
sp_UserOfflineSmall Offline

Hi everyone

so I am using client SDK in Version 4.10.6-24 and observe a very strange behavior when connecting to a S7-1500 OPC UA Server.
So first of all, my code using/calling the prosys library is packaged into a jar-library (“lib A”) and this library is embedded in a specific application (“app A”), which works fine using whatever combination of connection parameterization.
In another application (“app B”), using the exact same library “lib A”, it fails.
But it fails only when using the combination User+SignAndEncrypt+Basic256Sha256, anonymous and “just user” works fine.
The initial assumption was that there were problems with certificates, but we were able to rule that out because we used the same certificate and the same truststore. Also the S7 was configured to trust any certificate.
The most bizarre part is that the S7 logs show that the session is created, but after 30 seconds it times out and gets removed from the server. (30 seconds session timeout is configured on server side).
From the client-side logs I could observe that the whole 30 seconds, the code is seemingly stuck within UaClient#connect().

I can only assume that it is related to some crypto library. My “lib A” jar comes with bouncycastle 1.71 and spongycastle 1.58.0.0.
So my question is:
1. why and how can the connect() get stuck after the session has been created?
2. can i figure out which crypto-library the sdk uses?

Thanks for any hints!

February 14, 2024
9:34, EET
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 983
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Did you see any stacktrace (maybe in standard error output?)? Any option to send a thread-dump to uajava-support@prosysopc.com (assuming below doesn’t help)?

You would only use SpongyCastle on android, I assume this is not the case here, so you can just remove that.

BouncyCastle jars are signed and cannot basically be modified. You cannot include them in an “uber jar” (there could be exceptions, but this is the general advice).

BC requires all of its jars to be from the same versions and “flavor”.
Depending on the other libs of the apps you might have BouncyCastle accidentally more than once, which wont work. If a class is present multiple times on a classpath, it is random which is used. Output classpath in some way and check how many BC jars are there. SDK zip comes with “-jdk15to18-” “flavor” of BC, others could be ‘jdk15on’ (Java 1.5 onwards; which to my knowledge isn’t anymore in latest releases) and ‘jdk18on’ (Java 1.8 i.e. 8+) (and there was some LTS one as well). SDK should work with any of these (except maybe with the LTS), but please ensure that you only have one of these “flavors” (but all 3 jars of that specific one, and in same version).

P.S. The -jdk15to18- does work also in later Java versions, at least on the classpath (modulepath untested). The jdk18on might not work on all Java 8 environments, as it is a so called multi-release jar (which is a feature introduced in Java 9).

February 29, 2024
17:09, EET
Avatar
broessl
Member
Members
Forum Posts: 3
Member Since:
February 13, 2024
sp_UserOfflineSmall Offline

Okay, I think we can close this. It was a deployment issue.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 518

Currently Online:
12 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

fred: 41

Member Stats:

Guest Posters: 0

Members: 682

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1467

Posts: 6261

Newest Members:

karrimacvitie5, graciela2073, sagarchau, elviralangwell4, Donnavek, Eddiefauth, DonaldPooma, fidelduke938316, Jan-Pfizer, DavidROunc

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