Discussions

EJB programming & troubleshooting: How can I get infomation deployed in the ejb env-entry

  1. Hi,everyone!

    I have develop a ejb , and I have some infomation deployed in the ejb deployment description as follows,
      <env-entry>
          <description />
          <env-entry-name>SERVICE_1</env-entry-name>
          <env-entry-type>java.lang.String</env-entry-type>
          <env-entry-value>SmsStyle</env-entry-value>
      </env-entry>

    I have tried to use the SessionContext.getEnvironment() to get these infomations , but I failed, Are there some body can help me ?

    Thanks ahead !
  2. Hi,

     You can read this env-entry using this code

    Context ctx = new InitialContext();
    String val = (String)ctx.lookup("java:comp/env/SERVICE_1");


    Bye

    Arun
  3. Thank you very much ,It seems to be that SessionContext.getEnvironment is deprived in ejb2.0 and replaced by the way you prive to me .