[jboss-user] [JNDI and Naming] - $Proxy60 - returned by JBOSS JNDI Context

Anand Krishnan do-not-reply at jboss.com
Fri Jun 11 06:56:00 EDT 2010


Anand Krishnan [http://community.jboss.org/people/anandhakrishnank] created the discussion

"$Proxy60 - returned by JBOSS JNDI Context"

To view the discussion, visit: http://community.jboss.org/message/547544#547544

--------------------------------------------------------------
Hi All,

          I am facing a strange ERROR, infact it is not an error thats how
the jboss returns the object. JBOSS returns $Proxy60, when i try to
retrieve object from Context. Please find the details below.

MBEAN DEFN:
<server>
<mbean code="org.jboss.naming.ExternalContext"

name="jboss.jndi:service=ExternalContext,jndiName=external/ldap/jboss">
    <attribute name="JndiName">java:external/ldap/jboss</attribute>
    <attribute name="Properties">

java.naming.factory.initial=org.jnp.interfaces.LocalOnlyContextFactory
    </attribute>
    <attribute
name="InitialContext">javax.naming.ldap.InitialLdapContext</attribute>
    <attribute name="RemoteAccess">false</attribute>
</mbean>
</server>

The Mbean is JBOSS Class, I am testing this with JBoss standards and not
with my customClass.

[step A]Context envContext = (Context)ctx.lookup("java:");
[step B]Object ldapCtx = (Object)envContext.lookup("jndi/externalLDAP");

In step A, I could retieve the Initial Context.
But, in step B, It returns me $Proxy60 and I am unable to typecast this
object.

Here s my code again:

[1]Context ctx = new InitialContext();
[2]Context envContext = (Context)ctx.lookup("java:");
[3]Object ldapCtx = (Object)envContext.lookup("jndi/externalLDAP");
[4]System.out.println("Class name:- "+ldapCtx .getClass().getName());
[5]System.out.println("Object value:- "+ldapCtx.toString());

The output is as follows
[line 4: prints this value] Class name:- $Proxy60
[line 5: prints this value] Object value:-
javax.naming.InitialContext at b3826f

IF I type caste to InitialContext, it gives me ClassCastException.

Any suggestion, how to use this object?

Thanks,
Anand

--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/547544#547544]

Start a new discussion in JNDI and Naming at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2083]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20100611/63c8243e/attachment-0001.html 


More information about the jboss-user mailing list