Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /**
  2. *
  3. * @author Remi
  4. */
  5. public class main {
  6.  
  7. public void main(String args[]){
  8. try{
  9. //Contexte de nommage pour l'accès à l'annuaire JNDI du serveur Glassfish
  10. Properties jNDIProperties = new Properties();
  11. jNDIProperties.setProperty("java.naming.factory.initial","com.sun.enterprise.naming.SerialInitContextFactory");
  12. jNDIProperties.setProperty("org.omg.CORBA.ORBInitialHost", "localhost");
  13. jNDIProperties.setProperty("org.omg.CORBA.ORBInitialPort", "3700");
  14. InitialContext namingContext = new InitialContext(jNDIProperties);
  15. //Récupération d'un accès à l'EJB distant
  16. String uri = "lien_distant_ejb";
  17. ServiceCollaborateursRemote collabRemoteSvc =
  18. (ServicesCollaborateursRemote) namingContext.lookup(uri);
  19. }catch(NamingException ex){
  20. System.out.println("Erreur");
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement