I am having an issue setting up an external JNDI context in my local filesystem. I have followed the instructions in chapter 3 of the JBoss 4 documentation. I am currently using JBoss 4.0.2.
My MBean definition looks like this:
<mbean code="org.jboss.naming.ExternalContext" name="jboss.jndi:service=ExternalContext,jndiName=external/fs/ctx">
<attribute name="JndiName">external/fs/ctx</attribute>
<attribute name="Properties">
java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
java.naming.provider.url=file:///jboss-4.0.2/ctx
</attribute>
<attribute name="InitialContext">javax.naming.InitialContext</attribute>
</mbean>
As it stands, I am fairly sure that JBoss if finding the context appropriately.
The hierarchy of the JNDI context (in the jmx-console) looks like this:
+- external
| +- fs
| | +- ctx (proxy: $Proxy50 implements interface javax.naming.Context)
| | | +- .bindings
| | | +- DummyTopic
| | | +- JBossPocTCF
| | | +- JBossPocQCF
Notice that the ctx level is marked as a proxy. Now... on my client side code, I do the following:
InitialContext iniCtx = new InitialContext();
Context ctx = (Context) iniCtx.lookup("external/fs/ctx");
When I run this code, I get a
ClassCastException. If I print out the type that is being returned, I get a
javax.naming.Reference object. Obviously, I cannot lookup other references below this level if I am not getting a Context back when i do this lookup.
I have seen other posts on the forum regarding similar situations, but I have not encoutered a valid solution. I was hoping this would be easier, as I would imagine it is fairly common to federate an external JNDI. Am I missing a specific attribute or property in my
MBean definition?
My client side code currently has these dependencies (among others):
jboss-common-client.jar
jbossall-client.jar
jnp-client.jar
jboss-j2ee.jar
jbosssx-client.jar
jboss-transaction-client.jar
How can I resolve the class type on my client side? Any pointers in the right direction or any solutions would greatly be appreciated.