jboss.xml reference

JBoss xml reference

 

JBoss AS uses a set of custom xml descriptors which can be used to customize Enterprise applications. Today they are not used so widely as once, because they have been replaced by their equivalent annotations. Though it can be useful to have a reference to most common XML configuration file, if you need to mantain older Enterprise applications, or if you prefer to mantain your configutation separated from your code.

 

In this tutorial we will cover the following files:

 

  • jboss.xml
  • jboss-web.xml

 

jboss.xml

 

This descriptor can be used if your EJB do not use annotations to declare themselves as EJB.

It needs to be deployed in your EJB jar ander the META-INF folder.

 

Here's a sample jboss.xml file which can be used to declare a Session Bean and a Message driven Bean:


<jboss>
	<enterprise-beans>
		<session>
			<ejb-name>StatelessTest</ejb-name>
			<jndi-name>StatelessTest</jndi-name>
		</session>
		<message-driven> 
                           <ejb-name>SimpleMessageBean</ejb-name> 
                           <destination-jndi-name>queue/MyQueue</destination-jndi-name> 
                  </message-driven>
	</enterprise-beans>
</jboss>

Here's an advanced jboss.xml containing a cluster definition and a security domain


<jboss>

   <enterprise-beans>
	<session>
		<ejb-name>ShoppingCart</ejb-name>
		<jndi-name>ShoppingCart</jndi-name>
		<clustered>true</clustered>
		<cluster-config>
			<partition-name>DefaultPartition</partition-name>
			<load-balance-policy>
				org.jboss.ha.framework.interfaces.RandomRobin
			</load-balance-policy>
		</cluster-config>
		<security-domain>tutorial-test</security-domain>
	</session>
	<session>
		<ejb-name>StatelessTest</ejb-name>
		<jndi-name>StatelessTest</jndi-name>
	</session>
</enterprise-beans>
</jboss>

Related articles available on mastertheboss.com

JBoss MBeans POJO

JMX MBean services are the core building blocks of the JBoss Appl

How to a dump of JNDI tree with JMX console ?

#2 JBoss Howto. This is the recipe of the day

How to configure JBoss to bind to a different IP ?

  If you want to change the jboss.bind.address property use the 

How to shut down JBoss from remote ?

JBoss recipe of the day

How to create multiple instances of an Mbean?

  Supposing you need two instances of an MBean, let's say one fo

JBoss classloader issues

By default JBoss (prior to version 3.2) uses a flat class loading

Follow us on Twitter