This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes EJB and other Java EE Technologies and the fly likes Is it posible to limit the number of instances of EJB in application server ? 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 "Is it posible to limit the number of instances of EJB in application server ?" Watch "Is it posible to limit the number of instances of EJB in application server ?" New topic
Author

Is it posible to limit the number of instances of EJB in application server ?

Hardik Mehta
Greenhorn

Joined: Jul 31, 2006
Posts: 19
Hi,

I want to check if my stateful bean get passivated/activated as expected and the callbacks are called.

Is it possible in GlassFish, JBOSS to restrict the number of instances created in the pool ?

If yes how ?

thanks & regards.


cout << About programming, Linux, music, stars, life and everything;
Hardik Mehta
Greenhorn

Joined: Jul 31, 2006
Posts: 19
I figured this out after searching.

Here is the documentation link.
http://www.jboss.org/file-access/default/members/jbossas/freezone/docs/Administration_And_Configuration_Guide/5/html/clustering-session-sfsb30.html

I have to use the @CacheConfig annotation.

I am still searching for the way to configure this with xml without using any annotations. Can any body suggest how ?



My bean class looks like this..



Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9915
    
158

Hardik Mehta wrote:
I am still searching for the way to configure this with xml without using any annotations. Can any body suggest how ?


For JBoss see this


[My Blog] [JavaRanch Journal]
Hardik Mehta
Greenhorn

Joined: Jul 31, 2006
Posts: 19
Thanks Jaikiran,

I did exactly what the tutorial said, but I get the following error while deploying..

org.jboss.deployers.spi.DeploymentException: Error creating managed object for vfszip:/home/hardik/apps/jboss-5.1.0.GA/server/default/deploy/count-bean.ear/count-bean.jar/
at org.jboss.deployers.spi.DeploymentException.rethrowAsDeploymentException(DeploymentException.java:49)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:362)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:322)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.createMetaData(AbstractParsingDeployerWithOutput.java:294)
at org.jboss.deployment.JBossEjbParsingDeployer.createMetaData(JBossEjbParsingDeployer.java:95)
at org.jboss.deployers.spi.deployer.helpers.AbstractParsingDeployerWithOutput.deploy(AbstractParsingDeployerWithOutput.java:234)
at org.jboss.deployers.plugins.deployers.DeployerWrapper.deploy(DeployerWrapper.java:171)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doDeploy(DeployersImpl.java:1439)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1157)
at org.jboss.deployers.plugins.deployers.DeployersImpl.doInstallParentFirst(DeployersImpl.java:1210)
at org.jboss.deployers.plugins.deployers.DeployersImpl.install(DeployersImpl.java:1098)
at org.jboss.dependency.plugins.AbstractControllerContext.install(AbstractControllerContext.java:348)
at org.jboss.dependency.plugins.AbstractController.install(AbstractController.java:1631)
at org.jboss.dependency.plugins.AbstractController.incrementState(AbstractController.java:934)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:1082)
at org.jboss.dependency.plugins.AbstractController.resolveContexts(AbstractController.java:984)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:822)
at org.jboss.dependency.plugins.AbstractController.change(AbstractController.java:553)
at org.jboss.deployers.plugins.deployers.DeployersImpl.process(DeployersImpl.java:781)
at org.jboss.deployers.plugins.main.MainDeployerImpl.process(MainDeployerImpl.java:702)
at org.jboss.system.server.profileservice.repository.MainDeployerAdapter.process(MainDeployerAdapter.java:117)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.scan(HDScanner.java:362)
at org.jboss.system.server.profileservice.hotdeploy.HDScanner.run(HDScanner.java:255)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: aop-domain-name cannot appear in this position. Expected content of session is unordered_sequence: port-component? call-by-value? configuration-name? security-proxy? clustered? home-jndi-name? method-attributes? cluster-config? security-identity? local-jndi-name? ejb-name? local-home-jndi-name? timer-persistence? security-domain? ior-security-config? exception-on-rollback? jndi-name? ejb-timeout-identity? depends* invoker-bindings? {all descriptionGroup}? {unordered_sequence jndiEnvironmentRefsGroup}?


My META-INF/jboss.xml looks like this:



and the META-INF/mydomain-aop.xml like this:


The bean class is the same as posted before, without annotations regarding cacheconfig.

Am I making any mistakes ?

 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it posible to limit the number of instances of EJB in application server ?
 
Similar Threads
how many instances to be maintained in Pool.?
number in upper right corner, class - test 486
Struts doubt
about Singleton
Stateless session bean