on 10-31-2012 4:11 PM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.