How to change JBoss Connection pool size dynamically ?

This tutorial is outdated. Please check this article to learn how to configure a Connection Pool with JBoss/WildFly: WildFly Database connection pool configuration made easy JBoss AS 4-5-6 Supposing you need to change at runtime the size of your datasource named “CatalogDB”, then you can use twiddle command (or modify it manually from the JMX-Console) $ … Read more

JBoss performance tuning tips and hints – Part 2

Important notice: This article has been originally written for JBoss EAP 5 and contains some best practices to tune the application server and the environment where it’s running. Although some indications are still valid, we recommend also taking a look at the following articles which are more recent: JBoss AS 7 Performance tuning WildFly performance … Read more

How do I get the list of Datasources available ?

WildFly / JBoss EAP 6/7 The simplest way to retrieve the list of Datasources at runtime is using the CLI: ./jboss-cli.sh –connect –command=”/subsystem=datasources:read-resource” | grep “data-source” or programmatically using the JMX Api: import javax.management.*; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; public class HelloWorld { public static void … Read more

JBoss Performance Tuning tips and hints – Part 1

Important notice: This article has been originally written for JBoss EAP 5 and contains some best practices to tune the application server and the environment where it’s running. Although some indications are still valid, we recommend also taking a look at the following articles which are more recent: JBoss AS 7 Performance tuning WildFly performance … Read more

How to let JBoss deploy an application after other apps?

If you are running JBoss AS 7 or WildFly check the following tutorial: Configuring JBoss AS 7 deployment order. For older JBoss 4/5/6 releases follow this tip: If your application needs to be deployed after other applications, the quickest way to instruct JBoss to do it is simply creating a “deploy.last” folder inside the “deploy” folder. … Read more

How do I make sure my MBean is deployed after my EJB ?

If your MBean is dependent on another resource, supposing contained in an EAR file, you can specify in your jboss-service.xml not to deploy before this resource is available. Use the tag “depends” for this purpose For example: <server>     <mbean code=”sample.HelloWorldService” name=”sample:service=HelloWorld,id=1″>     <depends>jboss.j2ee:service=EARDeployment,url=’application.ear'</depends>   </mbean> </server> The same dependancy can be applied also for other … Read more

How to create multiple instances of an Mbean?

  Supposing you need two instances of an MBean, let’s say one for the client and one for the server. The main problem is that the objectName must be unique but you can hack it by adding an id for each MBean. Here’s an example: <?xml version=”1.0″ encoding=”UTF-8″?> <server>   <mbean code=”sample.HelloWorldService” name=”sample:service=HelloWorld,id=1″>     <attribute … Read more

How to count active session with twiddle ?

There are some well known alternatives to count the number of active session in a Web application, one of the most popular being adding Session Listeners to the application. However if you cannot modify your application or simply you need to use this value in a batch script you can still use the nice Jboss utility called … Read more