Skip to Content
0
Former Member
Aug 12, 2004 at 07:31 AM

SAP Connector Service

31 Views

Hello,

according to the SAP-SDN-publication "not to use JCO any more" I'm trying to switch to the SAP Connectior Framework.

- Unfortunately with NO success -

I always retrieve a NullPointerException in my connection Object.

Here is a code-snippet:

IConnection connection = null;

//this.setSapSystem(myProfile.getProperty("SAPSystem"));

IConnectionFactory connectionFactory = null;

Context initctx;

try {

Hashtable env = null;

initctx = new InitialContext(env);

connectionFactory =

(IConnectionFactory) initctx.lookup(

"EISConnections/SAPFactory");

} catch (Exception e) {

System.out.println("dsdsdsd1");

}

try {

IConnectionSpec spec = connectionFactory.getConnectionSpec();

spec.setPropertyValue("Language", "DE");

spec.setPropertyValue("SysMsgSvr", "someWhat");

spec.setPropertyValue("R3Name", "someWhat");

spec.setPropertyValue("Client", "someWhat");

spec.setPropertyValue("LogonGroup", "someWhat");

spec.setPropertyValue("SysAppSvr", "");

spec.setPropertyValue("UserName", "someWhat");

spec.setPropertyValue("Password", "someWhat");

spec.setPropertyValue("SysNumber", "someWhat");

connection = connectionFactory.getConnectionEx(spec);

System.out.println("fdfdfdf");

connection.close();

} catch (Exception e) {

System.out.println("dsdsdsd1");

}

As I mentioned before the connection object:

connection = connectionFactory.getConnectionEx(spec);

is null.

Any answer would be highly appreciated

WALTER