1 Reply Latest reply on Jan 16, 2005 1:58 AM by deepakjois

    Problem in Jboss 4.0 AS Guide Examples (Chapter 2 Example 1)

    deepakjois

      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


      Which I assume means that the MBean service was successfully deployed on the server.

      I write the following on a windows client machine and compile it


       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");
      


      and I get the following error :

      Exception in thread "main" java.lang.ClassCastException: javax.naming.Reference
       at genvea.test.TestJNDIMap.main(TestJNDIMap.java:25)
      


      The error occurs at the last line of the attached sample code.

      There is a similar post earlier in this forum, and also in the JBoss mailing list. But I did not understand the explanation about the example using org.jboss.naming.NonSerializableFactory to bind the Object and hence the problem. Could anyone please elaborate, and also explain how I can solve this problem.

      Thanks in advance

      Deepak