9 Replies Latest reply on Mar 11, 2015 7:53 AM by Paul Ferraro

    Lookup CommandDispatcherFactory

    Juliano Carlos da Silva Newbie

      Paul said to me to use

      @Resource(lookup = "java:jboss/clustering/dispatcher/web")
      private CommandDispatcherFactory factory = null;
      
      
      
      
      
      
      
      

       

      But i need to do manual lookup because i will run the APP in STANDALONE and HA too.

      if i run with @Resource in a standlone it does not start app with error at @Resource

      in standalone-ha it works fine and lookup manual works just if have @Resource, but without it no lookup (Exception naming not found)

       

      how I can manual lookup it? for standalone and standlone-ha work fine

       

      Its very simple what I want.

        Properties p = new Properties();
        p.put(Context.URL_PKG_PREFIXES, "org.jboss.as.naming.interfaces:org.jboss.ejb.client.naming");
        CommandDispatcherFactory factory = (CommandDispatcherFactory) new InitialContext(p).lookup("java:jboss/clustering/dispatcher/web");
      
      

       

      But

      Why dont work without @Resource?