I don't understand why you are trying to ClassLoader.loadClass() the EJBHome you find 
in
ejb-jar.xml.  You should only parse ejb-jar.xml to get the available JNDI names 
(although
I would recommend retrieving available JNDI names from a separate list/file for 
security
issues.)

Once you have the JNDI name, look the actual EJBHome, THEN do introspection on that
Object.getClass() to get the appropriate Method object to perform the invocation.  
There
should be no classloader issue if done this way.

btw, my ejb-reflection framework is running on WL 6.1 sp3.

Gene


--- Joel Riedesel <[EMAIL PROTECTED]> wrote:
> Interesting.
>
> It is from the EJBHome object.
> I use the ejb-jar.xml to figure out what the EJBHome object is.
> Do a classloader.loadClass for it and use that to find the
> create method I want to call.  Straightforward.
>
> But, when I use the JNDI name to 'lookup' the home object
> and actuall 'invoke' the method on it... I get an invalid object
> exception (not an instance of the method's class).
>
> In this particular case, it is Weblogic 6.1SP2, which is returning
> a ClusterableRemoteObject which also happens to be a proxy object.
> (I introspected it as well, which bought me nothing.)
>
> So.... am I being dense about something?  What app server is
> this working for you?  And is your EJB object that you
> looked up local or remote?
>
> Thanks,
>
> Joel
>
>
> ----- Original Message -----
> From: "Gene Chuang" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, September 04, 2002 5:30 PM
> Subject: Re: Reflection and EJB lookups?
>
>
> >
> > I use reflection for all my ejb invocations, so theres no reason why this
> doesn't work.
> > Why are you grabbing the Method object from your dynamically constructed
> class, and not from the EJBHome object class itself?
> >  Joel Riedesel wrote:How can one dynamically figure out what EJBs exist
> > in an app server and make calls on them (presumably,
> > using reflection)?
> >
> > One approach is to read the ejb-jar.xml descriptor.
> > Using that, one can use their own class loader with the
> > jar that the ejb-jar.xml came in and load the home and
> > ejb classes and determine the methods for 'create' and
> > for the actual bean methods.
> >
> > But, when one does a lookup to retrieve a home, and then
> > attempts to make a method.invoke call, it doesn't work because
> > in this case the classloader for the method being used
> > is different than the classloader of the object that came
> > from the lookup. (This presumes that the classes you
> > are dynamically introspecting aren't directly in your classpath,
> > thus the classloader trick above.)
> >
> >
> > So this approach appears not to work.
> >
> > Is there another approach to this?
> > Or is this just a lost cause (I can't imagine doing reflection
> > on the results of a lookup to a home as that can be 'bout
> > anything - a 'proxy' object for instance)?
> >
> > Are there and EJB generic ways to doing this or would it
> > be completely appserver specific?
> >
> > Thanks,
> >
> > Joel
> >
> >
> ===========================================================================
> > 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".
> >
> >
> >
> > ---------------------------------
> > Do You Yahoo!?
> > Yahoo! Finance - Get real-time stock quotes
>


__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

===========================================================================
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".

Reply via email to