Hi all,
when I run this code..I get the error
Could not lookup topic/testTopic
java.lang.ClassCastException: javax.naming.Reference 

does anybody now what is the reason?
thanks
srini

public static Context getInitialContext() throws NamingException{

      // Populate with needed propertis
      Hashtable props = new Hashtable();
      props.put(Context.INITIAL_CONTEXT_FACTORY,
                "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "localhost:1099");
      props.put("java.naming.rmi.security.manager", "yes");
      props.put(Context.URL_PKG_PREFIXES,  "org.jboss.naming");

      // Get initial context with given properties
      return new InitialContext(props);

   }

   /**
    * Test looking up a known topic, if no errors JNDI works.
    */
   public static void main(String[] args) {
      try {
         // Get the manually configured initial context
         Context context = ManualJNDI.getInitialContext();
        Logger.log("a");
         // Do the lookup
         Topic t = (Topic)context.lookup("topic/testTopic");
         Logger.log("b");
         System.out.println("Looing up topic/testTopic worked fine");
      }catch (Exception ex) {
         System.err.println("Could not lookup topic/testTopic");
         ex.printStackTrace();
      }
   }

} // ManualJNDI

_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to