How to Connect to State Free AppServer Using Java operatingM

Posted by Admin on 01-Oct-2008 09:07

I am having a problem I am hoping someone can help with.

I am trying to connect to an AppServer using Java.

"config" is a Java class that I generated in ProxyGen, which will run Progress procedures on an appServer.

The following connect statement works fine for AppServers that are NOT State Free.

config cc = new config("AppServer://server2.curtiscooper.com:5162/appserver2", "", "", null);

However, when connecting to a State Free Appserver, I get the following error:

"SessionPool : NoAvailableSessions"

I have tried adding -sessionModel Session-free to the Appserver-info parameter (the last one that is passed as 'null'", I have tried using Progress KB P94831 that uses VB .NET examples that changes the connection object's SessionModel attribute, but nothing is working and I cannot find a Java example.

Does anyone out there have any experience with this?

All Replies

Posted by rstanciu on 01-Oct-2008 09:30

This error is a normal because the state-free is dedicated to Web-Services.

For a Java/.Net proxy you have to use a appserver running in stateless mode.

Posted by Admin on 01-Oct-2008 09:37

At least .NET proxies and ABL clients support session-free appserver connections as well (I simply have not experience with Java to tell this without reading)!

For .NET proxies, set the static property:

Progress.Open4GL.RunTimeProperties.SessionModel = 1; // Not session managed

or

Progress.Open4GL.RunTimeProperties.SessionModel = 0; // Session managed

to set the session mode of the AppServer.

Posted by rstanciu on 01-Oct-2008 09:45

Bingo ...

String appServerURL = "AppServer://rs:5163/asws";

System.out.println("Starting connection");

connObj = new Connection(appServerURL, "", "", "");

connObj.setSessionModel(1);

=====================

/** TestClientJavaProxy.java **/

import com.progress.open4gl.*;

import com.progress.common.ehnlog.IAppLogger;

import com.progress.common.ehnlog.LogUtils;

import com.progress.open4gl.dynamicapi.IPoolProps;

import com.progress.open4gl.javaproxy.Connection;

import com.progress.message.jcMsg;

import java.math.BigDecimal;

import java.util.Date;

import java.sql.ResultSet;

import java.io.IOException;

public class TestClientJavaProxy

{

public static void main(String[] args) throws Exception, ProDataException

{

ProDataGraphHolder dgHolder = new ProDataGraphHolder();

ProDataGraph dg = null, chgDG = null, origDG = null;

WSTKRPCEncoded appObj;

Connection connObj;

ProChangeSummary chgSumm;

String appServerURL = "AppServer://rs:5163/asws";

int ret = 0;

try // To catch all exceptions

{

System.out.println("Starting connection");

connObj = new Connection(appServerURL, "", "", "");

connObj.setSessionModel(1);

appObj = new WSTKRPCEncoded(connObj);

System.out.println("Connected to AppServer OK");

StringHolder cCustomerName = new StringHolder();

appObj.getCustomerName(5, cCustomerName);

System.out.println("Name: " + cCustomerName.getStringValue());

appObj._release();

} // try to catch all unexpected exceptions

catch (ProDataException e)

{

System.out.println("Exception Message: " + e.getMessage());

}

catch (Exception e)

{

System.out.println("Exception Message: " + e.getMessage());

}

} // main()

} // class TestClientJavaProxy

Message was edited by:

Rares Stanciulescu

Posted by Admin on 01-Oct-2008 11:18

Great! Thanks everyone!

This thread is closed