cancel
Showing results for 
Search instead for 
Did you mean: 

ClassCastException while calling ejb module

0 Kudos

Hello everybody!

I have error when trying to call SOAP module. The initial context returns $Proxy514 object instead of ModuleHome

Object obj = initialContext.lookup( "localejbs/sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean" );

I noticed that this module (com.sap.aii.adapter.soap.ejb.jar) XISOAPAdapterBean has 2 interfaces:

Interface : [0] = com.sap.aii.af.lib.mp.module.ModuleHome

Interface : [1] = com.sap.engine.services.ejb3.runtime.ComponentInterface

This is what I get if pass just "sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean" and than output this this object.toString into file.

I discovered that this is classloader issue, but didn't find any solution how to solve it. In NetWeaver Admin I can see this module and it's interfaces and they are Module, ModuleLocal, ModuleHome etc. But when I call lookup it gives me following class instance:

com.sap.engine.services.ejb3.runtime.impl.DefaultEJBProxyInvocationHandler@27f7c54f

Need any help.

PS: run PI 7.11EP6

Accepted Solutions (0)

Answers (2)

Answers (2)

0 Kudos

Hello everybody.

I was trying to make the all possible methods. First I tried to call EJB directly, then through reflection interface, but still I can't call the required method.

What I do now is:

Context ctx = new InitialContext();

modulename = "ejb:/sap.com/com.sap.aii.adapter.soap.app/LOCAL/XISOAPAdapterBean/com.sap.aii.af.lib.mp.module.Module";

Object o = ctx.lookup(modulename);

Method create = o.getClass().getMethod("process",new Class[] {ModuleContext.class, ModuleData.class});

Proxy op = (Proxy) o;

InvocationHandler ih = Proxy.getInvocationHandler(op);

Object mod = ih.invoke(o, create, new Object[] {moduleContext, moduleData});

After this operator I have an error

Throwable exception: Cannot locate invocation chain for method public final com.sap.aii.af.lib.mp.module.ModuleData $Proxy1005.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException from interface interface com.sap.aii.af.lib.mp.module.Module

As I understand through my log lookup I receive $Proxy, that has methods including

public final com.sap.aii.af.lib.mp.module.ModuleData $Proxy1005.process(com.sap.aii.af.lib.mp.module.ModuleContext,com.sap.aii.af.lib.mp.module.ModuleData) throws com.sap.aii.af.lib.mp.module.ModuleException

This I receive from MethodList of proxy object.

But I still can't perform the required operation.

Probably I need to connect this proxy with EJB instance somehow?

Does anybody know thomething about this issue?

Edited by: Yaroslav Isachenko on Jun 17, 2011 4:48 PM

0 Kudos

Hello. I found out that probably reason of this issue is that my EAR file that I deploy to server containing resources jar files (also com.sap.aii.af.lib.mod.jar and com.sap.aii.adapter.soap.ejb.jar). I can deploy them through NWDS but I didn't find how to remove this jars. What is the required config of Java Build Path not to include them into deployed EAR file?