EJB Caching

2002-05-01 Thread Derek Akers

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!!!
   }







Re: EJB Caching

2002-04-13 Thread Curt Smith

Assuming this Q is regarding a stateless session bean, does Orion's 
deployer/bean validator
allow bean's with static attributes to be deployed?   A lightly loaded 
system that did not pool
bean instances after each method call and only occassionally had two+ 
instances active at the
same time who used static variable and ran into concurancy problems 
might exibit behavior
that would cause a question like this??

Else it sounds imposible for a properly designed SLSB method to return 
same state
as a previous method?  Hmmm.  

Perhaps the bean code and more details are necessary here?

curt

Derek Akers wrote:

 Our application running on Orion uses a stateless EJB instance to 
 invoke threads that execute application logic.   We are having a 
 problem with these EJBs chaching themselves and returning values 
 from previously executed calls rather than executing the thread 
 desired by the present call.  This does not happen all the time, but 
 often enough to be worrisome.  Question is, is there any way to stop 
 this behaviour?

  

 Derek Akers

 Director of Product Development

 Eldan Software Limited

 (416) 341-0070

 www.eldan.com http://www.eldan.com/

 -

 We build software for people, not computers


-- 

Curt Smith
[EMAIL PROTECTED]
(h) 404-294-6686
(w) 404-463-0973








EJB Caching

2002-04-12 Thread Derek Akers
Title: Message



Our 
application running on Orion uses a stateless EJB instance to invoke threads 
that execute application logic. We are having a problem with these 
EJBs chaching themselves and returning values frompreviously executed 
calls rather than executing the thread desired by the present call. This 
does not happen all the time, but often enough to be worrisome. Question 
is, is there any way to stop this behaviour?

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