Hi all,
I'm using reflection in order to
call an unknown bean at developement
time. I'm able to get the home interface
and call the create method using reflection.
However when I try to call the desired
method I get an exception. Below is
the main code i use :
home = ( EJBHome )javax.rmi.PortableRemoteObject.narrow( objRef,
ejbMetaData.getHomeInterfaceClass() );
classData = home.getClass();
try {
methodToInvoke = classData.getMethod( "create", methodCreateTypes );
EJBObject beanInstance = ( EJBObject )methodToInvoke.invoke(
home, argsCreateMethod );
// These two lines won't work either.
// Object narrowObj = javax.rmi.PortableRemoteObject.narrow(
beanInstance, ejbMetaData.getRemoteInterfaceClass() );
// classData = narrowObj.getClass();
classData = beanInstance.getClass();
// The above call returns my _xxx_stub class
// The following line causes the NoSuchMethodException exception
Method methodToInvoke = classData.getMethod(
mappedData.sMethodName, methodBeanTypes );
return ( ( String )methodToInvoke.invoke( beanInstance, argsBeanMethod ) );
}
If i put a debug code which prints the available
methods in beanInstance I can see the desired
method with the desired parameters, again using
reflection, so the method is there, but i just can't
call it. The code is called from a servlet, the same
code works fine when called from a regular class,
does this makes sense ?
Any ideas ?
Thanks in advance,
eyal.
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".