1 Reply Latest reply on Jun 26, 2008 4:53 AM by milind chaudhari

    [ram] registration is not done -> stop

    Nagaraju Telukuntla Newbie

      Hi ,
      I am creating topic dynamicaaly. and immidietlly iam lookup the same topic that time its showing , topic in not bounded.

      please find the code bellow

      creating dynamic topic:

      private boolean createJbossTopic(String topicName) throws Exception
      {
      boolean createStatus=false;
      Topic topic=null;
      RMIAdaptor server=null;
      Hashtable env = new Hashtable();
      Context ctx=null;
      env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      String PROVIDER_URL = "jnp://192.168.0.71:1099";
      env.put(Context.PROVIDER_URL,PROVIDER_URL);
      try {
      ctx = new InitialContext(env);
      }
      catch(Exception e){
      System.out.println("InitialContext problem::"+ e.getMessage());
      }
      try
      {
      server = (RMIAdaptor)ctx.lookup("jmx/invoker/RMIAdaptor");
      }
      catch(Exception es){
      System.out.println("jmx/invoker/RMIAdaptor problem::"+ es.getMessage());
      }


      server.invoke(destinationManager, "createTopic", new Object[]{topicName,"topic/"+topicName+""},new String[]{String.class.getName(), String.class.getName()});
      topic = (Topic) ctx.lookup("topic/"+topicName);
      createStatus=true;

      // System.out.println("Got topic--> " + ctx.toString());


      return createStatus;
      }


      // here i am lookup the same topic
      public boolean dummy(String sender)
      {
      boolean result=false;
      System.out.println(":: Begin Dummy methode");
      TopicConnectionFactory cf;
      Hashtable env = new Hashtable();
      env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
      // env.put(Context.PROVIDER_URL, "localhost");
      env.put(Context.PROVIDER_URL, "jnp://192.168.0.170:1099");
      try{
      System.out.println("Before Thread sleep");
      Thread.sleep(300);
      System.out.println("After Thread sleep");
      }catch (Exception e) {
      System.out.println("Exception Thread sleep-->"+e.getMessage());
      }
      try{
      // Thread.yield();
      Context ctx = new InitialContext(env);
      cf = (TopicConnectionFactory) ctx.lookup("/ConnectionFactory");
      Topic destination = (Topic)ctx.lookup("topic/"+sender);
      System.out.println("Found Topic");
      result=true;
      System.out.println("After Topic checking-->"+result);
      }catch (Exception e) {
      System.out.println("Exception Checking topic sleep-->"+e.getMessage());
      }

      return result;
      }

      because this topic has to be refer by the flex client.
      for us front end is flex.

      Please clarify me , its very urgent for us