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
catching ConnectException
March 13, 2016
15:34, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Hi,

I am trying to start the client application without having a connection to the OPC Server. It giives ConnectException but I am unable to catch this exception and exit gracefully by giving warning.

com.prosysopc.ua.client.ConnectException: Failed to retrieve endpoints. The server is not available: opc.tcp://LAPTOP-RLSQD170:4096/iaopcua/None ServiceResult=Bad_ConnectionRejected (0x80AC0000) “Could not establish a network connection to remote server.”
Caused by: org.opcfoundation.ua.common.ServiceResultException: Bad_ConnectionRejected (code=0x80AC0000, description=”2158755840, LAPTOP-RLSQD170″)

I added the exceptions ConnectException and ServiceResultException in the initialize method in sampleClinet and my try catch block in my calling method but it gives syntax error for the ConnectException try block!

How to capture this error (no server connected).

PRAMANJ

March 14, 2016
10:19, EET
Avatar
Heikki Tahvanainen
Moderator
Members

Moderators
Forum Posts: 402
Member Since:
April 17, 2013
sp_UserOfflineSmall Offline

Hello,

I suggest that you should find out why the syntax error is reported for the ConnectException. Also, see SampleConsoleClient for examples how to continue program execution when ConnectException is thrown.

March 14, 2016
18:06, EET
Avatar
pramanj
Member
Members
Forum Posts: 86
Member Since:
October 21, 2014
sp_UserOfflineSmall Offline

Ok fine, I will probe it further. I am just trying to ensure my application doesnot crash when its unable to connect to or find the server.
regards
PRAMANJ

Forum Timezone: Europe/Helsinki

Most Users Ever Online: 119

Currently Online:
16 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

hbrackel: 91

pramanj: 86

ibrahim: 68

kapsl: 57

gjevremovic: 49

TimK: 41

Fransua33: 39

fred: 36

Rainer Versteeg: 32

peterrob45: 25

Member Stats:

Guest Posters: 0

Members: 897

Moderators: 12

Admins: 1

Forum Stats:

Groups: 3

Forums: 14

Topics: 898

Posts: 3787

Newest Members:

thojermaine, Lukas, lbtsheldon, dpto.informatica, nolazky8119, peter.jakubik, amaralesbeltateresa@yahoo.com, amaralesbeltateresa@gmail.com, esbeltateresaamaral@yahoo.com.br, doanphan111

Moderators: Jouni Aro: 833, Otso Palonen: 32, Tuomas Hiltunen: 5, janimakela: 0, Pyry: 1, Terho: 0, Petri: 0, Bjarne Boström: 422, Heikki Tahvanainen: 402, Jukka Asikainen: 1, Teppo Uimonen: 16, Markus Johansson: 1

Administrators: admin: 0