How do I remove a particular EJB instance (SLSB) from orion's EJB cache?

I acquire a handle to the EJB through:

Context context = new InitialContext();
Object boundObject = context.lookup("MyEJB");
MyEJBHome myEjbh =
(MyEJBHome)PortableRemoteObject.narrow(boundObject,MyEJBHome.class);
MyEJBRemote myEjbr = procCon.create();

I then store this remote reference in the user session by:

session.setAttribute("myBean", myEjbr);

When I am finished with the EJB, I call:

session.removeAttribute("myBean");

This seems to work fine if the code handled by the EJB executes
properly.  However, if an error is encountered by the EJB, future
attempts to use this part of the application instead of a new EJB
instance being created for use, the former cached EJB is used, and it is
still in its error state.  Logging the user out and back in again seems
to have no effect.  Any ideas on how to remove this EJB (and only this
EJB) from orion's EJB container cache?

Derek Akers
Director of Product Development
Eldan Software LImited
(416) 341-0070
www.eldan.com
---------------------------------------------------------------------
"We build software for people, not computers"


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]] On Behalf Of Alex Paransky
Sent: Wednesday, May 01, 2002 11:06 AM
To: Orion-Interest
Subject: RE: Initial context problem.


Not sure if the code you pasted is correct, however, you are missing a
"new" keyword in front of the InitialContext().  Also, in your second
try/catch block you are missing a call to new InitialContext().  I might
be picky, but the source code you posted is not at all the source code
that you are using (unless are you using a strange version of the Java
Complier).

Can you isolate your problem into a small piece of code that works, and
try to post again?

Thanks.

-AP_
http://www.alexparansky.com
Java/J2EE Architect/Consultant
http://www.myprofiles.com/member/profile/apara_personal

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Jesper
Rasmussen
Sent: Wednesday, May 01, 2002 3:10 AM
To: Orion-Interest
Subject: Initial context problem.


Hi all,
Im trying to make an application which askes for the login and password
to connect to the application deployed on 1.5.4 orion server.

It works fine if i specify the correct login(admin). However if I uses
some wrong cridentials(admin1) i get an exception which also is fine.

HOWEVER when i try to login again, without restarting the application)
using the correct info I still get the old exception
(javax.naming.AuthenticationException: Invalid username/password for
beansApp (admin1)).

If i close the app and login again with the correct it works fine.

to me it seems like the enviroment i pass to the constructor of
InitialContext is ignored the second time.

I have tried to use close() to no avail.

Does anyone have a clue?? Thanks!

cheers
JEsper

----------more or less the code that cause the bug!
server="ormi://127.0.0.1/beansApp";
login="admin1";
password="123";
env = new java.util.Hashtable();
env.put("java.naming.provider.url",server);
env.put("java.naming.factory.initial","com.evermind.server.ApplicationCl
ientInitialContextFactory");
env.put("java.naming.security.principal",login);
env.put("java.naming.security.credentials",password);
InitialContext initial;

try {
   initial = InitialContext(env);
catch(NamingException e) {
   try {
      login="admin";
      env = new java.util.Hashtable();
      env.put("java.naming.provider.url",server);

env.put("java.naming.factory.initial","com.evermind.server.ApplicationCl
ientInitialContextFactory");
      env.put("java.naming.security.principal",login);
      env.put("java.naming.security.credentials",password);
   } catch(NamingException ex) {
        //ACK. chould not get here!!!
   }




Reply via email to