Relativel new to JBoss. Please let me know if you need further details.
1. I compiled the example 1, chapter 2 from the JBoss 4.0 Application Server Guide.
2. Started JBoss with run.sh
3. I copied the .sar to the $JBOSS_HOME/server/default/deploy folder. The
display on the server was
02:44:00,960 INFO [STDOUT] fullName=inmemory/maps/MapTest
Hashtable props = new Hashtable(); props.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory"); props.put(Context.PROVIDER_URL,"jnp://mecca:1099/"); props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces"); InitialContext ctx = new InitialContext(props); HashMap map = (HashMap)ctx.lookup("inmemory/maps/MapTest");
Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference at genvea.test.TestJNDIMap.main(TestJNDIMap.java:25)
After going round in hops, I finally found the solution here.
http://www.jboss.org/wiki/Wiki.jsp?page=HowDoIGetRemoteAccessToMyMBean
Could the book example be made clearer in this regard, since it seems to be misleading.
Thanks
Deepak