Thanks, that solved the class cast exception, but I am not getting anything for
the EntityContext's environment.  I get an empty Hashtable back.

I guess a better question would be:  To set the principal and credential in the
EntityContext's environment, does that have to go through a SessionBean, or can
any Java Object set it in the JNDI Context?






Conrad Chan <[EMAIL PROTECTED]> on 07/05/2000 10:35:29 AM

To:   PETER V MINEARO/TheSphereHQ@TheSphereHQ
cc:

Subject:  RE: EntityContext Environment



I believe you should type-cast it to javax.naming.Context instead of
InitialContext.  I.e. Context ctx = ic1.lookup("java:comp/env")

Conrad

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 05, 2000 9:46 AM
To: Orion-Interest
Subject: EntityContext Environment


I am trying to get the EntityContext's environment .  Since Sun deprecated the
getEnvironment() method.  I have to use the JNDI interface.

My code looks like this:

try {
     InitialContext ic1 = new InitialContext();
     InitialContext ic2 = (InitialContext)ic1.lookup("java:comp/env");
     Hashtable env = ic2.getEnvironment();
     Enumeration keys = env.keys();

     while(keys.hasMoreElements()) {
          Object key = keys.nextElement();
          Object value = env.get(key);
          System.err.println(key.toString() + " = " + value.toString());
     }

} catch (Exception e) {
}

My problem is that I am getting an Exception

java.lang.ClassCastException: com.evermind.util.r
     at
com.tsis.utils.net.JNDIEnvironment.showEnvironment(JNDIEvironment.java:32)
     ....
     ....
     ....


on the line:

InitialContext ic2 = (InitialContext)ic1.lookup("java:comp/env");

I looked in the orion.jar file and that file is there.  Not sure what to make of
this.  Does anybody have any idea what is going on??






Reply via email to