Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- context = createRemoteEjbContext("localhost", "8080"); //toto je defaultna hodnota
- remoteRequestBean = (RequestBeanRemote) context.lookup("ejb:Ear/Server//RequestBean!server.RequestBeanRemote");
- //Ear je názov enterprise java projectu, ked žiadny neni a máš na servery hodene priamo EJB tak sa to tam nepíše
- //Server je názov EJB
- //RequestBean je názov beany v tom EJB
- //server.RequestBeanRemote server je package v ktorom je v Apičku remote na beanu
- private static Context createRemoteEjbContext(String host, String port) throws NamingException {
- //tu sa nič nemeni tomuto nerozumie ani sám boh
- Hashtable<Object, Object> props = new Hashtable<Object, Object>();
- props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
- props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
- props.put("jboss.naming.client.ejb.context", false);
- props.put("org.jboss.ejb.client.scoped.context", true);
- props.put("endpoint.name", "client-endpoint");
- props.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", false);
- props.put("remote.connections", "default");
- props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", false);
- props.put(Context.PROVIDER_URL, "http-remoting://" + host + ":" + port);
- props.put("remote.connection.default.host", host);
- props.put("remote.connection.default.port", port);
- return new InitialContext(props);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement