users@glassfish.java.net

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

From: <glassfish_at_javadesktop.org>
Date: Tue, 18 Sep 2007 23:32:24 PDT

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