users@glassfish.java.net

Re: Reflection problem with glass fish V2 (calling all reflection experts)

From: Sahoo <sahoo_at_sun.com>
Date: Wed, 19 Sep 2007 13:51:58 +0530

I think there are multiple class loaders coming into play here. The
class loader of the class whose method is being executed is loading its
own smarte.proxy.Proxy.class which is not same as what is being loaded
by reflectedClass's class loader.

How are you getting hold of reflectedClass? Where is
smarte.proxy.Proxy.class packaged in your application?

Thanks,
Sahoo
glassfish_at_javadesktop.org wrote:
> Hi
>
> I am having a problem running some reflection code on the glassfish V2 app server.
>
> This code works fine in a standard J2SE application. Heres some of the code
>
> String args = fdProvider.getProxyArgs();
>
> reflectedClassConstructor = reflectedClass.getConstructor(new Class[]{ String.class });
>
> providerProxy = reflectedClassConstructor.newInstance(new Object[]{args});
>
>
> Proxy providerProxyRef = (Proxy) providerProxy;
> //setup the container for this FD provider proxy
> proxyContainers.put(fdProvider.getFdProviderId(), new Container(providerProxyRef, fdProvider.getMaxConnections()));
> } catch (Exception ex) {
> String message = "Exception thrown while trying to Initialise proxy. Details, " + ex.getMessage();
> throw new ProxyManagementException(message);
> }
>
> This line throws the following exception, "smarte.proxy.Proxy cannot be cast to smarte.proxy.Proxy"
>
> Proxy providerProxyRef = (Proxy) providerProxy; //exception thrown from here
>
> Why cant this type be cast to its real type???
> [Message sent by forum member 'seatin23' (seatin23)]
>
> http://forums.java.net/jive/thread.jspa?messageID=235950
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>