[jboss-user] [EJB 3.0] - inject beans from a remote server with annotations

SunFire do-not-reply at jboss.com
Tue Jun 23 06:31:44 EDT 2009


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

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4239341#4239341

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4239341



More information about the jboss-user mailing list