[ Team LiB ] |
10.9 Hot-Deploying to JBoss10.9.1 ProblemYou want to deploy a new EAR or WAR file to JBoss. 10.9.2 SolutionCopy a new EAR to the deploy directory within the server environment that JBoss was started with. 10.9.3 DiscussionJBoss provides a simple mechanism to hot deploy: simply copy a new EAR file to the deploy directory within the server environment that JBoss was started with. This process is different from Tomcat; Tomcat requires the use of the Manager application. JBoss simply keeps tabs on the appropriate deploy directory, and when something new is discovered, it's deployed. If an old application exists then it is removed. Here is an Ant target named deploy that copies an EAR file to JBoss, which is automatically installed: <target name="deploy" depends="ear"
description="Builds and deploys the project to JBoss.">
<copy file="${dir.build}/${ear.file}" todir="${dir.jboss.deploy}"/>
</target>
The same target could be duplicated to copy a WAR file, too. The todir attribute is extremely important. The Ant property dir.jboss.deploy is defined as a well-known location within JBoss. Specifically, JBoss scans a directory for new deployed applications within the server environment that JBoss was started with. JBoss has three main default server environments:
This recipe simply uses the default server environment. Here are the Ant properties needed to set up the JBoss server environment and deployment directory: <property name="jboss.server.config" value="default"/> <property name="dir.jboss.deploy" value="${env.JBOSS_DIST}/server/${jboss.server.config}/deploy"/> Copying an EAR to the appropriate directory allows JBoss to automatically deploy your new application. 10.9.4 See AlsoRecipe 10.3 shows how to use Tomcat's Manager web application to hot-deploy. |
[ Team LiB ] |