cancel
Showing results for 
Search instead for 
Did you mean: 

java.lang.ClassCastException exception in my JRA program

Former Member
0 Kudos

Hi, experts:

I write a JRA method to call a R3 RFM in a session bean.

the code looks like below:


...
import javax.naming.InitialContext;
import javax.resource.cci.Connection;
import javax.resource.cci.ConnectionFactory;
import javax.resource.cci.Interaction;
import javax.resource.cci.MappedRecord;
import javax.resource.cci.RecordFactory;
import javax.resource.cci.ResultSet;
...
InitialContext initialcontext = new InitialContext();
ConnectionFactory connectionfactory = (ConnectionFactory) initialcontext.lookup(CONN_FACTORY_NAME);
...

I write above code based on the SAP online help

http://help.sap.com/saphelp_nwce711core/helpdata/en/83/c70242e5216324e10000000a1550b0/frameset.htm

but when program running, an exception happen.


java.lang.ClassCastException: class com.sap.engine.services.jndi.implclient.ClientContext:service:naming @ com.sap.engine.boot.loader.ResourceMultiParentClassLoader @ 26f04d94 @ alive incompatible with interface javax.resource.cci.ConnectionFactory:library:j2eeca @ com.sap.engine.boot.loader.ResourceMultiParentClassLoader @ 1cf38f09@alive

It seems error happen in the second line, but I don't know what else class I can use to replace ConnectionFactory class.

Any reply would be very appreciated.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

I found the error was caused by given wrong JNDI string.

I should specify to the deepest in the JNDI tree.