[jboss-user] [JBoss Seam] - Re: Injecting Remote EJBs

cavani do-not-reply at jboss.com
Mon Jan 7 09:59:17 EST 2008


Something like this:


  | @Name("managedRemoteServer")
  | @Scope(ScopeType.STATELESS)
  | public class ManagedRemoteServer
  | {
  | 
  | 	@Unwrap
  | 	public ManagementService getRemoteServer()
  | 	{
  | 		try
  | 		{
  | 			Properties env = new Properties();
  | 			env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  | 			env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
  | 			env.put(Context.PROVIDER_URL, "jnp://192.168.1.1:1099");
  | 
  | 			Context ctx = new InitialContext(env);
  | 
  | 			return (ManagementService) ctx.lookup("tlon/ManagementServiceBean/remote");
  | 		}
  | 		catch (Exception e)
  | 		{
  | 			e.printStackTrace();
  | 		}
  | 
  | 		return null;
  | 	}
  | 
  | }
  | 

And:


  | 
  | 	@In
  | 	private ManagementService remoteServer;
  | 
  | 

Obs.: I didn't test this...

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

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



More information about the jboss-user mailing list