Skip navigation

Monthly Archives: February 2011

This article is not for deploying web application outside “JBOSS_HOME” folder, if usually in JBoss to deploy our web application we put WAR file at “JBOSS_HOME\server\default\deploy” directory, i want to put it on let say “JBOSS_HOME\server\myserver\deploy” directory.

After googling sometimes I found that what I meant is change the JBoss default server configuration. Under “JBOSS_HOME\server” folder we can see folder like “all“, “default“, “minimal“, etc, that is as JBoss said is server configuration file set. With server configuration file set we can have alternate server configurations. You should read JBoss documents about how to configure the server.

To make another server configuration file set, just copy from existing server configuration to another name. Put your web application WAR  at “JBOSS_HOME\server\NEW_SERVER\deploy” directory, then run this from console:

Windows
JBOSS_HOME\bin\run.bat -c NEW_SERVER

Linux
JBOSS_HOME\bin\run.sh -c NEW_SERVER

Advertisements

Let say that you have fresh download of Tomcat 6 and want to deploy your web application in it, but you don’t want to access your web application using URL form http://%5BIP_OR_DOMAIN_NAME%5D:%5BPORT%5D/%5BWEB_APPLICATION_NAME%5D (e.g http://localhost:8080/BlaBlaBla) instead you just want URL form http://%5BIP_OR_DOMAIN_NAME%5D:%5BPORT%5D (e.g http://localhost:8080) to access your application. There are few ways to do these that I know and I will it post here.

To deploy web application in Tomcat we can use WAR file or using webapp exploded directory, I will use the last one. You can deploy your webapp in “TOMCAT_HOME/webapps” directory or outside of Tomcat directory, I will use last one also. Now let see how to change Tomcat 6 ROOT context:

Trick 1
Open “TOMCAT_HOME\conf\server.xml” file, look for Host tag, add Context tag to it so it will looks something like these:

<Host name="localhost"  appBase="webapps"
            unpackWARs="true" autoDeploy="true"
            xmlValidation="false" xmlNamespaceAware="false">
        ............
        ............
	<Context path="" docBase="D:\Gardiary\temp\my-app" reloadable="true" debug="0" cookies="false"></Context>
</Host>

Note that Context path is set to  “” not “/” and docBase is path to your webapp exploded directory. Save it and run your Tomcat,  you should be able to access your application just by using http://localhost:8080.

Trick 2
Remove (or change to other name) “TOMCAT_HOME\webapps\ROOT” folder, rename your webapp to ROOT and then put it in “TOMCAT_HOME\webapps” folder (a.k.a change the content of original ROOT folder with your web application content). Run your Tomcat.

Trick 3
Create file “TOMCAT_HOME\conf\Catalina\localhost\ROOT.xml“, the file looks something like these:

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="D:\Gardiary\temp\my-app"
 crossContext="true" reloadable="true">
</Context>

Change docBase to your webapp exploded directory and then run your tomcat.

That’s all I know folks!