• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Seting instance pool limit for stateful session bean

 
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody ran Ed Roman’s "Count" Stateful Session Bean example (Mastering EJB chapter 4) in weblogic 6.1 before ?
For this example, we need to limit the stateful session bean pool to only 2 beans so that we can simulate passivation and activation.
However, I don’t know how to set EJB instance pool limit for stateful EJB in WLS 6.1.
From Bea docs (ejb.pdf), only stateless session & message-driven beans’ pool can have instance limit.
<stateless-session-descriptor>
<pool>
<max-beans-in-free-pool>2</max-beans-in-free-pool>
</pool>
</stateless-session-descriptor>

So ???
Pls shed some light. Thanks.
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even I had the same question, but for Sun's RI. But I didn't receive any replies to my post last month.
 
Saloon Keeper
Posts: 3946
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
You guys both using wrong forum.
Did you read the forum title ?
 
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SFSB are not pooled.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mikalai,
U r right.Strictly speaking this question is more appropriate in the EJB forum and may be we could have even got some answers by now...
Pradeep,
What I meant was the Container's max pool size for SFSB, which I imagine is configurable for each App Server. Ed Roman's book pages, 123-130 has a good example code that shows passivation/activation for the SFSB beans, when this max limit is reached. We want to see this same example in action.
[ November 10, 2003: Message edited by: Vish Kumar ]
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vish Kumar,
you really understand my question, thanks. (But still no answer.. )
Mikalai Zaikin,
OK...strictly speaking, this is the wrong place. How can I transfer this to the EJB forum and yet still receive email notifications of updates ? The reason I accidentally posted it here is because I am also preparing for SCBCD exam... and I frequent here.

Roman's source code are meant to be run without (or little) modification to them. He provided compilation/deployment and even client test scripts... and when these are run they should show activation/passivation in action ...like what's printed in the book. But sadly it doesn't. When I ran it, activation/passivation did not happen... limitation of 2 beans instances did not happen and all 3 beans were instantiated.

How ?
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok. I understood now.
http://edocs.bea.com/wls/docs70/ejb/reference.html#1071069
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cheers Pradeep,
This property sounds container specific. Not sure, if all EJB Containers support it.From the lnk, I understand it is applicable to both SFSB and Entity beans, as is activation and passivation.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It applies to both SFSB and Entity bean.
Yes, it is container specific.
[ November 11, 2003: Message edited by: Pradeep Bhat ]
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for all the help ! From the post above, I now know that the xml property to set is max-beans-in-cache. However, when I try creating the jar, I get the following error.
C:\book\EJB20\code\StatefulSession\Count\lib>java weblogic.ejbc20 -keepgenerated tmp.jar Count.jar
ERROR: Error parsing 'META-INF/weblogic-ejb-jar.xml' line 16: The content of element type "weblogic-enterprise-bean" must match "(ejb-name,(entity-descriptor|stateless-session-descriptor|stateful-session-descriptor|message-driven-descriptor)?,transaction-descriptor?,reference-descriptor?,enable-call-by-reference?,run-as-identity-principal?,jndi-name?,local-jndi-name?)".
ERROR: ejbc found errors

Below is my weblogic-ejb-jar.xml. To me, it looks fine.


Why ?
Thanks again.
 
Pradeep bhatt
Ranch Hand
Posts: 8945
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
stateful-session-descriptor should come before jndi-name, isn't?
 
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
QUOTE: stateful-session-descriptor should come before jndi-name, isn't?
-----------------------
YES!
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for highlighting the sequence.
 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error is gone after making sure that the order of the xml elements are right.
However, I am still unable to limit the number of SFSB instances to only 2. That is, I am still unable to simulate activation and passivation.

My ejb-jar.xml
----------------
<!DOCTYPE ejb-jar PUBLIC
"-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN"
"http://java.sun.com/dtd/ejb-jar_2_0.dtd">
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>Count</ejb-name>
<home>examples.CountHome</home>
<remote>examples.Count</remote>
<ejb-class>examples.CountBean</ejb-class>
<session-type>Stateful</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
</ejb-jar>
My weblogic-ejb-jar.xml
------------------------
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC
"-//BEA Systems, Inc.//DTD WebLogic 6.0.0 EJB//EN"
"http://www.bea.com/servers/wls600/dtd/weblogic-ejb-jar.dtd">
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>Count</ejb-name>
<stateful-session-descriptor>
<stateful-session-cache>
<max-beans-in-cache>2</max-beans-in-cache>
</stateful-session-cache>
</stateful-session-descriptor>
<jndi-name>CountHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic