Skip to Content
0
Former Member
Jul 04, 2005 at 07:45 AM

RFC Destination in WAS sp12

16 Views

Hi All,

I am using WAS 6.4 with sp12 which supports RFC destination.

I have created a EJb which is internally using JCo to connect to SAP R/3. I am using RFC Destination for passing login information to SAP R/3. I have exposed this EJb as web service.

Now in EJb i have following code

<b>InitialContext ctx = new InitialContext();

obj = ctx.lookup(DestinationService.JNDI_KEY);

<i>DestinationService dstService = (DestinationService) obj;</i>

RFCDestination dst = (RFCDestination) dstService.getDestination("RFC", "<System ID>");

Properties jcoProperties = dst.getJCoProperties();

JCO.Client client = JCO.createClient(jcoProperties);

</b>

But when i execute the code it give Exeception in EJb that in could not type cast the obj into DestinationService Object. when i check the Object return by ctx.lookup it is of type proxy

I have taken above code from the location

http://help.sap.com/saphelp_nw04/helpdata/en/17/d609b48ea5f748b47c0f32be265935/content.htm

Why am not able to type cast the object?.