my dog learned polymorphism*
The moose likes EJB and other Java EE Technologies and the fly likes Why ejbPassivate and ejbRemove are not called by weblogic container? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Why ejbPassivate and ejbRemove are not called by weblogic container?" Watch "Why ejbPassivate and ejbRemove are not called by weblogic container?" New topic
Author

Why ejbPassivate and ejbRemove are not called by weblogic container?

Shodhan Shah
Greenhorn

Joined: Apr 27, 2006
Posts: 18
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

Joined: Feb 13, 2006
Posts: 63
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

Joined: Apr 27, 2006
Posts: 18
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

Joined: Aug 27, 2004
Posts: 328
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why ejbPassivate and ejbRemove are not called by weblogic container?
 
Similar Threads
EJB Passivate and EJB Remove for stateful Bean are not called by weblogic
setting pool size for ejb ???????????
need to change weblogic-ejb-jar.xml to jboss.xml
Tune stateful EJB configurations
how do we specify the max stateful beans in the pool