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: 1009
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: 1009
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: 518

Currently Online:
23 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 135

pramanj: 86

Francesco Zambon: 81

ibrahim: 75

rocket science: 75

Sabari: 62

kapsl: 57

gjevremovic: 49

Xavier: 43

TimK: 41

Member Stats:

Guest Posters: 0

Members: 709

Moderators: 16

Admins: 1

Forum Stats:

Groups: 3

Forums: 15

Topics: 1465

Posts: 6252

Newest Members:

christi10l, ahamad1, Flores Frederick, ellenmoss, harriettscherer, shanonhumphreys, KupimotoblokfuB, tamhollander5, paulinafcf, bridgette18l

Moderators: Jouni Aro: 1009, Otso Palonen: 32, Tuomas Hiltunen: 5, Pyry: 1, Petri: 0, Bjarne Boström: 982, Heikki Tahvanainen: 402, Jukka Asikainen: 1, moldzh08: 0, Jimmy Ni: 26, Teppo Uimonen: 21, Markus Johansson: 42, Niklas Nurminen: 0, Matti Siponen: 319, Lusetti: 0, Ari-Pekka Soikkeli: 5

Administrators: admin: 1