Skip to Content
0
Former Member
Jul 27, 2005 at 02:11 PM

EJB call BAPI with JCA (problem)

19 Views

Hello all,

I've ventured into the world of EJB development and wanted to call a BAPI in R/3 using JCA.

I've written the Java code that does this in the enterprise portal but writing it for an EJB (which as you know runs on the J2EE server outwith the portal) is proving more difficult.

From a pdf that I found here on SDN I get the initial lines:

Context ctx = new InitialContext();
IConnectionFactory conFac = (IConnectionFactory)ctx.lookup("deployedAdapters/SAPFactory/shareable/SAPFactory");

This always throws a ClassCastExepction though.

Perhaps the fault lies with the types I'm using, the imports I'm using are:

import javax.naming.Context;
import javax.naming.InitialContext;
import com.sapportals.connector.connection.IConnectionFactory;

Is there something obvious I'm doing wrong?

Any and all help is greatly appreciated.

Thanks for your time,

Patrick.