OPCFoundation / UA-Java-Legacy

This repository is provided by OPC Foundation as legacy support for an Java version for OPC UA.
https://github.com/OPCFoundation/UA-.NETStandard
Other
355 stars 227 forks source link

#Issue with SampleClient.java failed with ExceptionInInitializerError #191

Closed yoenkol closed 5 years ago

yoenkol commented 5 years ago

Hey all, i am trying to run the UA-Java-Legacy Samples in a new project. I did a maven "package and install", and then importet this in my new project to my pom.xml. This is all fine. Now I try to run one of the Samples, that are given with the stack -> SampleClient.java. The issue is every time I run this mentioned class the line 94 errors with the exception:

Exception in thread "main" java.lang.ExceptionInInitializerError at SampleClient.main(SampleClient.java:94) Caused by: java.lang.NullPointerException at org.opcfoundation.ua.examples.certs.ExampleKeys.(ExampleKeys.java:218) ... 1 more.

The getCert-method from ExampleKeys is where something goes wrong. The certificates have something wrong in it. The method in line 94 for the KeyPair is not jumping to getCert(...) in ExampleKeys, instead it goes to static{....}. After that it error in line 218 in ExampleKeys. Has any one of you ever seen such a error or an idea how to solve it ? Thank you.

This is the SampleClient.java: screenshot 4

This is the ExampleKeys.java screenshot 5