Advertisement
DanecSVK

Untitled

May 7th, 2017
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. context = createRemoteEjbContext("localhost", "8080"); //toto je defaultna hodnota
  2. remoteRequestBean = (RequestBeanRemote) context.lookup("ejb:Ear/Server//RequestBean!server.RequestBeanRemote");
  3. //Ear je názov enterprise java projectu, ked žiadny neni a máš na servery hodene priamo EJB tak sa to tam nepíše
  4. //Server je názov EJB
  5. //RequestBean je názov beany v tom EJB
  6. //server.RequestBeanRemote server je package v ktorom je v Apičku remote na beanu
  7.  
  8.  
  9. private static Context createRemoteEjbContext(String host, String port) throws NamingException {
  10. //tu sa nič nemeni tomuto nerozumie ani sám boh
  11.         Hashtable<Object, Object> props = new Hashtable<Object, Object>();
  12.         props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
  13.         props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
  14.  
  15.         props.put("jboss.naming.client.ejb.context", false);
  16.         props.put("org.jboss.ejb.client.scoped.context", true);
  17.  
  18.         props.put("endpoint.name", "client-endpoint");
  19.         props.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", false);
  20.         props.put("remote.connections", "default");
  21.         props.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", false);
  22.  
  23.         props.put(Context.PROVIDER_URL, "http-remoting://" + host + ":" + port);
  24.         props.put("remote.connection.default.host", host);
  25.         props.put("remote.connection.default.port", port);
  26.  
  27.         return new InitialContext(props);
  28.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement