Pooling and caching stateful session bean
kbillewicz Mar 25, 2006 1:58 PMI would like to turn on pooling for my stateful session bean.
When I'm trying to configure <container-configuration> with pooling but without cache I'm getting during bean deployment on server an error that <cache-policy-conf> is required.
Whem I'm configuring cache, getting an exception (on the standalone client) during executing create() method on Home Interface:
java.lang.NullPointerException at org.jboss.ejb.StatefulSessionContainer.createSession(StatefulSessionContainer.java:248) at org.jboss.ejb.StatefulSessionContainer.createHome(StatefulSessionContainer.java:323) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) ... at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:86) at $Proxy0.create(Unknown Source) at com.example.client.HelloClient.main(HelloClient.java:31)
I have prepared config files as follows:
ejb-jar.xml:
<enterprise-beans> <!-- Session Beans --> <session > <description><![CDATA[]]></description> <display-name>Hello</display-name> <ejb-name>Hello</ejb-name> <home>com.example.HelloHome</home> <remote>com.example.Hello</remote> <local-home>com.example.HelloLocalHome</local-home> <local>com.example.HelloLocal</local> <ejb-class>com.example.HelloBean</ejb-class> <session-type>Stateful</session-type> <transaction-type>Container</transaction-type> </session> ...
jboss.xml:
<enterprise-beans> <session> <ejb-name>Hello</ejb-name> <jndi-name>ejb/Hello</jndi-name> <local-jndi-name>HelloLocal</local-jndi-name> <configuration-name>Hello</configuration-name> <method-attributes> </method-attributes> </session> </enterprise-beans> <container-configurations> <container-configuration> <container-name>Hello</container-name> <instance-pool>org.jboss.ejb.plugins.StatefulSessionInstancePool</instance-pool> <instance-cache>org.jboss.ejb.plugins.StatefulSessionInstanceCache</instance-cache> <persistence-manager>org.jboss.ejb.plugins.StatefulSessionFilePersistenceManager</persistence-manager> <container-pool-conf> <MaximumSize>3</MaximumSize> </container-pool-conf> <container-cache-conf> <cache-policy>org.jboss.ejb.plugins.LRUEnterpriseContextCachePolicy</cache-policy> <cache-policy-conf> <min-capacity>50</min-capacity> <max-capacity>1000000</max-capacity> <overager-period>300</overager-period> <max-bean-age>600</max-bean-age> <resizer-period>400</resizer-period> <max-cache-miss-period>60</max-cache-miss-period> <min-cache-miss-period>1</min-cache-miss-period> <cache-load-factor>0.75</cache-load-factor> </cache-policy-conf> </container-cache-conf> </container-configuration> </container-configurations> ...
Have you any idea what can be wrong here? I had been working on it for several hours and haven't found any solution.
Best regards,
Konrad