Home JBoss howto Configuration How to force JBoss to deploy the EJB first in an EAR ?
11 | 03 | 2010
JBoss 5 AS Book
"JBoss AS 5 development" reviews
Please share your feedback/review with other readers!
Banner
Dashboard
Advertise with Us
Banner
RSS Feed
Login
Sign here for the NewsLetter.



Poll
What book could be in your wish list next XMas ?
 
JBoss admin resources
Banner
JBoss howto

How can you solve deployment errors caused by large war/jar/ear files ?

jboss recipe of the day ...
Read More

How do you configure your .war to be deployed after your EJB ?

jboss recipe of the day ...
Read More

How do I configure a Queue/Topic to work in a cluster?

JBoss recipe of the day ...
Read More
How to force JBoss to deploy the EJB first in an EAR ?
Written by Mark S.   

Jboss recipe of the day

Sometimes the order of deployed units, in an Enterprise application matters. For example, if you are deploying an EAR which is made up of a WEB application an EJB, it can be necessary that the EJB application is deployed at first.

A typical scenario is a Web application uses ServletContextListeners. If the ServletContextListener tries to access the EJB, as soon as the Web component is deployed, a NamingException might be the outcome of it, because the EJB hasn't been still bound in the JNDI.

The quick fix to it is adding a ContextComparator in conf\bootstrap\deployers.xml file:
 

<bean name="topContextComparator">
  <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
  <property name="suffixOrder" class="java.util.Map">
    <map keyClass="java.lang.String" valueClass="java.lang.Integer">
	  <entry>
	    <key>.war</key>
	    <value>700</value>
	  </entry>
    </map>
  </property>
</bean>

This will ensure that your Web application is loaded after the EJB modules.


JBoss.org Search
Custom Search
Comments
Search
Only registered users can write comments!

3.26 Copyright (C) 2008 Compojoom.com / Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."