/** * Creates a context for connecting to remote ejbs * * @url url as string ip:port */ private static InitialContext createInitialContext(String url, boolean sslEnabled) throws NamingException { String urlParts[] = url.split(":"); Properties clientProperties = new Properties(); clientProperties.put("remote.connections", "default"); clientProperties.put("remote.connection.default.host", urlParts[0]); clientProperties.put("remote.connection.default.port", urlParts[1]); clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); clientProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false"); if (sslEnabled) { clientProperties.put("jboss.naming.client.remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "true"); clientProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SSL_STARTTLS", "true"); clientProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); } EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(clientProperties); ContextSelector<EJBClientContext> ejbContextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration); EJBClientContext.setSelector(ejbContextSelector); Properties jndiProperties = new Properties(); jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); jndiProperties.put("jboss.naming.client.ejb.context", true); jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); jndiProperties.put(Context.PROVIDER_URL, "remote://" + url); return new InitialContext(jndiProperties); }
Freitag, 15. August 2014
JBoss 7 Client context
Posted on 05:13 by Unknown
Abonnieren
Kommentare zum Post (Atom)
0 Kommentare:
Kommentar veröffentlichen