Can we dynamically know the servername?


EJB design: Can we dynamically know the servername?

  1. Can we dynamically know the servername? (1 messages)

    private InitialContext getInitialcontext() throws NamingException
    Properties env = new Properties();

    }catch(Exception e){
    System.out.print("Connection to the weblogic server is not there. " +
    e );
    return new InitialContext(env);

    this is how u get the InitialContext for doing the jndi lookup.
    here we have hard coded the url as "t3://localhost:7001"
    but there is some way through which we can dynamically
    know the servername
  2. I dont' know if this works in weblogic or not, but in other EJB servers, you can place a file in the same directory as your executable called, which is basically a properties file that sets the values that you are setting explicitly here.