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
Strange NullpointerException connecting to Server
August 13, 2013
5:30, EEST
Avatar
infraview.schmidt
Member
Members
Forum Posts: 7
Member Since:
August 13, 2013
sp_UserOfflineSmall Offline

Hello,

I get a strange exception in my OPC UA Client:

java.lang.NullPointerException
at org.opcfoundation.ua.transport.UriUtil.getSocketAddress(Unknown Source)
at org.opcfoundation.ua.transport.UriUtil.getSocketAddress(Unknown Source)
at org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp.initialize(Unknown Source)
at org.opcfoundation.ua.transport.tcp.io.SecureChannelTcp.initialize(Unknown Source)
at org.opcfoundation.ua.application.Client.createSecureChannel(Unknown Source)
at com.prosysopc.ua.client.UaClient.discoverEndpoints(Unknown Source)
at com.prosysopc.ua.client.UaClient.k(Unknown Source)
at com.prosysopc.ua.client.UaClient.p(Unknown Source)
at com.prosysopc.ua.client.UaClient.connect(Unknown Source)
at de.spektra.infraview.conformance.OpcUaTestSuite.connect(OpcUaTestSuite.java:216)

It doesn’t show up every time i try to connect, but very often. My code looks like this:

destClient = new UaClient(url);
final PkiFileBasedCertificateValidator validator = new PkiFileBasedCertificateValidator();
destClient.setCertificateValidator(validator);
ApplicationDescription appDescription = new ApplicationDescription();
appDescription.setApplicationName(new LocalizedText(APP_NAME,
Locale.ENGLISH));
appDescription
.setApplicationUri(“urn:localhost:spektra.com:infraview:OpcUaClient”);
appDescription.setProductUri(“urn:spektra.de:infraview:OpcUaClient”);
appDescription.setApplicationType(ApplicationType.Client);
final ApplicationIdentity identity = ApplicationIdentity
.loadOrCreateCertificate(appDescription, “spektra”,
null, //Private Key Password
new File(“”, “private”), //Key File Path
true); //Enable renewing the certificate
destClient.setApplicationIdentity(identity);
destClient.setLocale(Locale.GERMAN);
destClient.setTimeout(1000 * 60 * 2);
destClient.setSecurityMode(SecurityMode.NONE);
destClient.setUserIdentity(null);

destClient.connect();

The NullpointerException appears at the destClient.connect() command. Any help would be appreciated.

Felix

August 13, 2013
6:48, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 846
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

It looks like your URL for the server is probably invalid, although there are a few checks to validate it already. What does your URL look like when you get this error?

August 13, 2013
7:38, EEST
Avatar
infraview.schmidt
Member
Members
Forum Posts: 7
Member Since:
August 13, 2013
sp_UserOfflineSmall Offline

Thank you for the quick answer!

I can’t tell you the url because the device behind it is already in use. maybe i can pm, but i have to check that beforehand

The strange thing about it is that it sometimes works, and sometimes not with the same url.

Can i do more checks to identify invalid urls?

The application is a conformance test for opc ua servers which helps providers to create a valid server. So it would be very good if i could identify the exact source of the error. At the moment i can only tell them that the url produces a NullPointerException somewhere in the OPC Connection logic.

August 13, 2013
8:17, EEST
Avatar
Jouni Aro
Moderator
Moderators
Forum Posts: 846
Member Since:
December 21, 2011
sp_UserOfflineSmall Offline

Sounds odd if the same URL sometimes works and sometimes not. There is some logic that tries to catch all possible errors so it’s odd that some get through. If you could email it to uajava-support at prosysopc.com, I could just check if there is something obvious in it or we can investigate this further.

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 267

Currently Online:
10 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 100

pramanj: 86

ibrahim: 70

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 37

Rainer Versteeg: 32

Thomas Reuther: 26

Member Stats:

Guest Posters: 0

Members: 1058

Moderators: 14

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 981

Posts: 4145

Newest Members:

mats989, Sebastien Petitrenaud, sting2005, Ron Hoppe, Seb, p.devito, g.ilengo, MohamedLazrek, brittr83165991, martintinsley9

Moderators: Jouni Aro: 846, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 523, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 20, Markus Johansson: 18, Matti Siponen: 31, Lusetti: 0

Administrators: admin: 0