Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why ejbPassivate and ejbRemove are not called by weblogic container?

 
Shodhan Shah
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys
I am running test set up on weblogic 8.1 for stateful session Beans.
Test clients run fine.
But for stateful session bean I am not able to passivate or remove the beans inspite of setting max-beans-in-cache ,idle-timeout-seconds(i.e. on Bean class ejbPassivate or ejbRemove methods are not invoked by container even after long time.).

I am usiing following configuration for weblogic-ejb-jar.xml.
Can anyone tell why ejbPassivate and ejbRemove callbacks are not called by container though clients are idle for an hour.??

<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>AdviceBeanStateful</ejb-name>
<stateful-session-descriptor>
<stateful-session-cache>
<max-beans-in-cache>2</max-beans-in-cache>
<idle-timeout-seconds>30</idle-timeout-seconds>
<cache-type>NRU</cache-type>
</stateful-session-cache>
</stateful-session-descriptor>
<jndi-name>headfirst/AdviceBeanStateful</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
 
Andreas Schaefer
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not a Weblogic expert but I would think that you cannot enforce an ejb passivation because this is up to the app server and is only done when the need arise due to resource constraints.

-Andy
 
Shodhan Shah
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andreas
You are right that this depends on container implementation.
But for this specific Weblogic container , here I found solution.
There are two types of passivation. 1) lazy and 2) eager.
We can choose by selecting cache type NRU -(lazy) or LRU - eager .
I changed cache type and it worked.

Thanks
Shodhan
 
Shrinivas Mujumdar
Ranch Hand
Posts: 328
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shodhan & Andy
What you are saying is correct.Especially Shodhan, weblogic or any other server for that matter could provide you such facilities however this is not a Standard J2EE.
To achive the same effect i would suggest you a simple solution which will work for all application servers & its as Simple as writing a Multithreaded client which will send say around 15+ request when you execute it. Make sure you keep <max-bean-in-cache> value as low as possible (value '2' will do)..If you are using evaluation copy of any app. sever there could be exception stating Can't create Instance etc....


Regards
Shriniwas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic