Kbase P137624: How can I detect if a NoAvailableSessions exception in my Java Open Client application was caused by
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  21/11/2008 |
|
Status: Unverified
GOAL:
How can I detect if a NoAvailableSessions exception in my Java Open Client application was caused by a RETURN ERROR "SomeString" statement in my connect procedure?
GOAL:
When an AppServer connect procedure issues a RETURN ERROR "SomeString" statement, how can I detect this in my Java Open Client application?
FACT(s) (Environment):
All Supported Operating Systems
OpenEdge 10.x
FIX:
When you are connecting from a Java Open Client based application to an AppServer which has a connect procedure defined and the connect procedure can possibly reject the connection attempt by issuing a RETURN ERROR "SomeString" statement, they way to detect this is by code similar to the following in a try/catch block:
Myproxy appServerConnection = null;
try
{
appServerConnection = new MyProxy("AppServer://localhost:5162/asbroker1", "", "", "");
}
catch (NoAvailableSessionsException e)
{
if (e.hasProcReturnString())
{
System.out.println("AppServer Connect Procedure Rejected Connection Attempt");
System.out.print("Return String: ");
System.out.println(e.getProcReturnString());
}
}
Any connection failure, whether caused by a RETURN ERROR "SomeString" statement or because the client was simply not able to connect to the AppServer, will cause a NoAvailableSessionException to be generated. The hasProcReturnString() and getProcReturnString() methods of the exception object must be used to determine whether the exception was caused by the RETURN ERROR "SomeString" statement.