Unable to find environment properties in WebLogic8

Discussions

EJB programming & troubleshooting: Unable to find environment properties in WebLogic8

  1. Unable to find environment properties in WebLogic8 (5 messages)

    Following is part of my deployment descriptor:

    <session>
      <display-name>UserManager</display-name>
      <ejb-name>UserManager</ejb-name>
      <home>IRSystem.bean.UserManagerHome</home>
      <remote>IRSystem.bean.UserManager</remote>
      <ejb-class>IRSystem.bean.UserManagerBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <env-entry>
        <description />
        <env-entry-name>UserManager/student</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>users/student.xml</env-entry-value>
      </env-entry>
    </session>



    Here is my code to lookup properties:

    Context ctx = new InitialContext();
    String path = (String) ctx.lookup("UserManager/student");


    but the above code doesn't work, the property cannot be found? What's wrong with my work? I need your help!
    Thanks!

    Threaded Messages (5)

  2. ENC[ Go to top ]

    Hello

    All EJB environment entries are "rooted" at "java:comp/env", the so called ENC (Environment Naming Context).

    Thus

    Context ctx = new InitialContext();
    String path = (String) ctx.lookup("java:comp/env/UserManager/student");

    Note that this will only work within the EJB that defines the environment entry - i.e. the environment entry is not available outside of the EJB in question (e.g. not from a seperate client JVM).

    Hope this helps
  3. ENC[ Go to top ]

    thx! But I had tried to lookup the environment properties by using the following code:

    Context ctx = new InitialContext();
    String path = (String) ctx.lookup("java:comp/env/UserManager/student");

    but NameNotFoundException is thrown out and the server prints:
    " Resolved ; Remaining 'comp/env/UserManager/student' unresolved "

    and if I use ctx.lookup("java:comp/env/UserManager"), NameNotFoundException is thrown out, too! But if I use ctx.lookup("UserManager"), it works. My server is WebLogic8.1, is it because of this?

    thx for your help!
  4. Confuse about this also[ Go to top ]

    Do you guys know whether those naming are vendor specific??

    Websphere is not using such naming converesion for looking up
    local objects.

    for example, it use
    xxx.lookup("local:/ejb/xxxxx")

    I think Sun should better strict this naming convention in the next
    specification.

    Harvey
  5. Confuse about this also[ Go to top ]

    thx! If so, any body knows how to find EJB environment properties in WebLogic8?
  6. Confuse about this also[ Go to top ]

    anybody knows it?

    Thanks for your help!!