0 Replies Latest reply on Nov 16, 2004 9:06 AM by Antonio Sant

    Confused by JNDI and Env

    Antonio Sant Newbie

      Hi there!

      I'm deploying a WAR "created for" Tomcat 4.1.29 on JBOSS 4.0.0.

      I want to set up JBOSS, so the following code will work:

      private static String getEnviroment(String variableName) {
      String value="";
      try {
      Context ctx = new InitialContext();
      if (ctx == null)
      throw new Exception("No Context");
      value = (String) ctx.lookup("java:comp/env/" + variableName);
      } catch (Exception e) {e.printStackTrace(System.out);}
      return value;
      }


      String my_server_ip = getEnviroment("MY_SERVER_IP");

      On Tomcat MY_SERVER_IP was defined using the Admin console as Environment Entries

      How can I do?

      TX!