0 Replies Latest reply on Feb 15, 2003 12:08 PM by fabboco

    Environment Variable Problem

    fabboco

      Hi,

      I am trying to get the value of an environment entry without any success.

      This is the ejb-jar.xml fragment:


      Entity Bean ( CMP )
      <display-name>Document</display-name>
      <ejb-name>Document</ejb-name>
      <local-home>mypackage1.DocumentLocalHome</local-home>
      mypackage1.DocumentLocal
      <ejb-class>mypackage1.impl.DocumentBean</ejb-class>
      <persistence-type>Container</persistence-type>
      <prim-key-class>java.lang.String</prim-key-class>
      False
      <cmp-version>2.x</cmp-version>
      <abstract-schema-name>Document</abstract-schema-name>
      <cmp-field>
      <field-name>id</field-name>
      </cmp-field>
      ….
      <env-entry>
      <env-entry-name>RepPath</env-entry-name>
      <env-entry-type>java.lang.String</env-entry-type>
      <env-entry-value>c:\</env-entry-value>
      </env-entry>

      In a JSP page have used the following code:

      InitialContext context = new InitialContext();
      Context context = (Context) context.lookup(‘java:comp/env’);
      String path = (String) context.lookup(‘RepPath’);

      but I get the following error:

      javax.naming.NameNotFoundException: RepPath not bound

      Any idea?

      Thanks

      Fabrizio Boco