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
NoClassDefFoundError after updating to 5.2.4-147
September 9, 2024
16:48, EEST
Avatar
iivanov
Member
Members
Forum Posts: 6
Member Since:
August 11, 2023
sp_UserOfflineSmall Offline

Hi, hope you are well!

After we updated to the latest version 5.2.4-147, we are getting:
java.lang.NoClassDefFoundError: org/bouncycastle/operator/OperatorCreationException

at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:421)
at java.base/java.lang.Class.forName(Class.java:412)
at com.prosysopc.ua.stack.utils.CertificateUtils.getCertificateProvider(SourceFile:511)
at com.prosysopc.ua.stack.utils.CertificateUtils.a(SourceFile:1151)
at com.prosysopc.ua.stack.utils.CertificateUtils.a(SourceFile:1138)
at com.prosysopc.ua.stack.utils.CertificateUtils.createApplicationInstanceCertificate(SourceFile:147)
at com.prosysopc.ua.ApplicationIdentity.createKeyPair(SourceFile:321)
at com.prosysopc.ua.ApplicationIdentity.createCertificate(SourceFile:213)
at com.prosysopc.ua.ApplicationIdentity.createCertificate(SourceFile:124)
at com.prosysopc.ua.ApplicationIdentity.createCertificate(SourceFile:96)
at com.connectedcooking.opcua.dynamicnodemanager.adaptor.prosys.ProsysServerITTest.setup(ProsysServerITTest.java:71)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
Caused by: java.lang.ClassNotFoundException: org.bouncycastle.operator.OperatorCreationException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
… 14 more

Bouncy castle was already updated to 1.78.1 prior to the SDK update. Is this something known already?

September 10, 2024
9:54, EEST
Avatar
Bjarne Boström
Moderator
Moderators
Forum Posts: 1032
Member Since:
April 3, 2012
sp_UserOfflineSmall Offline

Hi,

Most likely the root cause is similar to: https://forum.prosysopc.com/forum/opc-ua-java-sdk/stuck-within-uaclientconnect
Though that is not related to SDK updates per se. At least not directly though you didn’t specify from which version did you update.

Basically you must ensure there is exactly one “flavor” and version of BouncyCastle on the classpath. If you have more than one set of jars for BC, it is random which of the classes would be picked when Java tries to resolve a class (thus e.g. one version of BC tries to start and fails to see classes it expects from the other of its jars).

Thus, if you use the flavor that we ship, ensure you have exactly:
bcpkix-jdk15to18-1.78.1.jar
bcprov-jdk15to18-1.78.1.jar
bcutil-jdk15to18-1.78.1.jar
on the classpath and none other (BC jars). These are the ones that would be used if you use the maven integration.

P.S.
Though note that depending on your application etc. other libraries you might be using some other flavor, such as the ‘jdk18on’, in which case you wouldn’t add those ‘jdk15to18’ jars (SDK should work with the jdk18on as well, just that it includes a modulepath descriptor that might fail on JDK8). If you use the Maven intergration that comes with the SDK, then either modify the pom before running the install or exclude the BC dependencies in your application pom.xml (or equivalent). Or if you updated anything else please check that e.g. that one didn’t e.g. change it’s flavor of BC.

P.S.2
we did change to the ‘jdk15to18’ flavor from ‘jdk15on’ somewhere in 4.x since BC changed things, so if you updated from before that the change of artifactIds for maven integration would explain it.

September 10, 2024
15:52, EEST
Avatar
iivanov
Member
Members
Forum Posts: 6
Member Since:
August 11, 2023
sp_UserOfflineSmall Offline

Thanks for the quick reply!

We only had dependency to:
bcprov-jdk15to18-1.78.1.jar

So after adding the other two all seems okay. Thank you!

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 1919

Currently Online:
46 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: 726

Moderators: 7

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1529

Posts: 6471

Newest Members:

gabriellabachus, Deakin, KTP25Zof, Wojciech Kubala, efrennowell431, wilfredostuart, caitlynfajardo, jeromechubb7, franciscagrimwad, adult_gallery

Moderators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0

Administrators: admin: 1