Advertisement
Guest User

Untitled

a guest
May 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @Override
  2. public void contextInitialized(ServletContextEvent event) {
  3.  
  4. Properties props = new Properties();
  5. props.put("java.naming.factory.url.pkgs","org.jboss.ejb.client.naming");
  6.  
  7. try {
  8. InitialContext ic = new InitialContext(props);
  9.  
  10. String ejbUrl = "ejb:ShopEarFinal/ShopEarFrontControllerEJB//"+FrontController.class.getSimpleName()+"!"+FrontComponentRemote.class.getName();
  11.  
  12.  
  13. FrontComponentRemote frontController = (FrontComponentRemote) ic.lookup(ejbUrl);
  14.  
  15. ServletContext context = event.getServletContext();
  16. context.setAttribute(FRONT_CONTROLLER_ATTRIBUTE, frontController);
  17.  
  18. } catch (NamingException e) {
  19. e.printStackTrace();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement