2 Replies Latest reply on Jun 24, 2009 2:17 PM by Thorsten Kunz

    inject beans from a remote server with annotations

    Thorsten Kunz Novice

      HI,
      I am looking for a way to inject EJB's from a remote server. Usually I would do something like this to handle the situation in code:

      Properties properties = new Properties()
      properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      properties.put(Context.PROVIDER_URL, "remoteserver.domain.com:1099");
      
      InitialContext initialContext = new InitialContext(properties);
      BeanI bean = (BeanI) initialContext.lookup("some/bean/remote"));
      

      But with the all nice EJB3 dependency infection annotations I wonder if there is a way to tell e.g. the @EJB or the @Resource annotation to go to a different server for only one or two specific beans/resources for injection?

      Thanks