When trying to connect to Glassfish v3 from a swing application, it is very slow for the first time. It takes 4-10 seconds. On the client side:
public void myMethod(){ NewSessionBeanRemote facade; try { InitialContext ic = new InitialContext(); facade = (NewSessionBeanRemote) ic.lookup(NewSessionBeanRemote.class.getName()); target.setText(facade.businessMethod()); } catch (NamingException ex) { ex.printStackTrace(); } }
On the server side:
@Stateless public class NewSessionBean implements NewSessionBeanRemote { @Override public String businessMethod() { return String.valueOf(Math.random() + 121 + 300); } } @Remote public interface NewSessionBeanRemote { String businessMethod(); }
What do I need to change in the environment?
source share