cancel
Showing results for 
Search instead for 
Did you mean: 

Error when assigning home interface of SAP standard EJB

Former Member
0 Kudos

Dear experts,

I am trying to develop an EJB client to comunicate with a SAP standard EJB delivered by SAP to read audit log entries from SAP PI messages and communication channels.

I am coming from ABAP world and I m such a beginner on java development so I am struggling with the way to achieve this. I would like to forward you a question. I have this piece of coding on which the call to context-lookup seems to be working....but I have an issue when assign the home interface of the EJB to my variable ahi on this line --> ahi = (AuditLogHI) PortableRemoteObject.narrow(obj,AuditLogHI.class);

It is returning an error of class not found.....no clue why 😞

This is the entire logic, please your help is greatly appreciated.

AuditLogHI ahi;

AuditLogBI ahb;


try {


Hashtable env = new Hashtable();


env.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

env.put(Context.PROVIDER_URL, "<SERVER>:<PORT>");

env.put(Context.SECURITY_PRINCIPAL, "XXXXXXX");

env.put(Context.SECURITY_CREDENTIALS, "XXXXXXXX");

env.put(Context.URL_PKG_PREFIXES, "com.sap.engine.services");

InitialContext initialcontext = new InitialContext(env);

Object obj = initialcontext.lookup("messaging.system.AuditLogBean");

if( obj != null ) {


ahi = (AuditLogHI) PortableRemoteObject.narrow(obj,AuditLogHI.class);

ahb = (AuditLogBI) ahi.create();

}

Kind regards

Accepted Solutions (0)

Answers (1)

Answers (1)

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Dear Fernando,

you surely should not try to refer to a class by using it's filename (AuditLogHI.class). Java is way more file oriented than ABAP, but surely not like you do it here. The class file is declared to a Java program via the declarations in the include statements.

You better get those basics first...

Regards,

Benny