Home JBoss Server JBoss deployment directory configuration
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
JBoss deployment directory configuration PDF Print E-mail
Written by F.Marchioni   
Friday, 29 May 2009 06:39

In this short tutorial we are going to show how to provide an alternative directory or URL for deploying your JBoss applications. We will also show how JBoss can even deploy applications from remote locations.

Deploying applications to JBoss is a simple task: all you do to deploy an application in JBoss is dropping the archive into the deploy directory. The JBoss engine immediately inspects the contents of the archive and attempts to deploy the component(s). Undeploying is as easy as deleting the archive from the deploy directory.

Sometimes it can be convenient to deploy your applications in another directory or filesystem. Configuring another deploy directory in JBoss is different from one version to another:
 

Configuring JBoss deploy directory in 4.x releases or earlier
 

The configuration file which we need to modify is server/xxxx/conf/jboss-service.xml

Open it and move almost at the end of the file. There you'll find the following attribute:
 

<attribute name="URLs">
     deploy/
</attribute>

This is the list of scanned deployment directories. Supposing you want to add a secondary deployment directory in /var/deploy filesystem, you have to add:
 

<attribute name="URLs">
     deploy/
     file:/var/deploy/
</attribute>

You can even choose to deploy a specific application from a remote repository. For example, if you have a remote server which has a virtual path "deploy" under the Base directory, then you can use this path as repository for deploying your application named myapp.ear:

<attribute name="URLs">
     deploy/
     http://www.remoteserver.com/deploy/myapp.ear
</attribute>

Configuring JBoss deploy directory in 5.0 release

JBoss 5.x doesn't use any more jboss-service.xml for configuring the deployment directory. Instead, you have to manipulate the server/xxx/conf/bootstrap/profile-repository.xml file.
Search for the SerializableDeploymentRepositoryFactory (about at the beginning of the file).

There, if you want to add for example the "deployments" beneath the JBoss Home, simply add another element in the array:

 <bean name="SerializableDeploymentRepositoryFactory" class="org.jboss.system.server.profileservice.repository.SerializableDeploymentRepositoryFactory">
      <property name="storeRoot">${jboss.server.base.dir}</property>
      <property name="attachmentsRoot">${jboss.server.data.dir}/attachments</property>
      <property name="applicationURIs">
         <array elementClass="java.net.URI">
            <value>${jboss.server.home.url}deploy</value>
            <value>file:/C:/jboss-5.0.0.GA/deployments</value>
            
         </array>
      </property>
      <property name="serializer"><inject bean="AttachmentsSerializer"/></property>
      <property name="deploymentFilter"><inject bean="DeploymentFilter" /></property>
      <property name="hotDeploymentFilter">
        <bean class="org.jboss.system.server.profile.basic.XmlIncludeVirtualFileFilter"/>
      </property>
      <property name="mainDeployer"><inject bean="MainDeployer"/></property>
      <depends>ProfileServicePersistenceDeployer</depends>
</bean>

Configuring JBoss deployment directory in release 5.1

Just while I was completing this article I've found out in JBoss wiki that in release 5.1 the configuration as changed again (!!!), so when using JBoss 5.1 your configuration file  will be server/xxxx/conf/bootstrap/profile.xml. Find the Bean named BootstrapProfileFactory and add your deploy folder to the list element:


<bean name="BootstrapProfileFactory"
     class="org.jboss.system.server.profileservice.repository.StaticProfileFactory">
     <property name="bootstrapURI">${jboss.server.home.url}conf/jboss-service.xml</property>
     <property name="deployersURI">${jboss.server.home.url}deployers</property>
     <property name="applicationURIs">
          <list elementClass="java.net.URI">
               <value>${jboss.server.home.url}deploy</value>

               <!-- Add your own deploy folder -->
               <value>file:/C:/JBossdeploy</value>
          </list>
     </property>
     ...
</bean>

In this example, we're adding the folder C:/JBossdeploy to the list of scanning directories.

Good deployment!


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."

Last Updated ( Friday, 29 May 2009 07:12 )