Link to home
Start Free TrialLog in
Avatar of hoomanv
hoomanvFlag for Canada

asked on

Q related to deploying web app

Hi
I need to know how to deploy my web application, not by copying it into tomcat's webapps folder.
is it possible to have my web app in D:\somefolder and tell tomcat that my app is else where ?
any hint would be appreciated
Avatar of rrz
rrz
Flag of United States of America image

Yes, use something like this
<Context path="/yourAppName"  docBase="D:\somefolder ">
</Context>  
add it to   the  <Host> element  of  your Tomcat's server.xml file  and restart.  Look at  
http://www.akadia.com/download/soug/tomcat/html/tomcat_server_xml.html
http://www.onjava.com/pub/a/onjava/2003/06/25/tomcat_tips.html
Avatar of hoomanv

ASKER

is this compatible with tomcat 5.5 ?
ASKER CERTIFIED SOLUTION
Avatar of rrz
rrz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hoomanv

ASKER

you mean i have to create a file named yourAppName.xml in TomcatHome\conf\Catalina\localhost\
and add this element to it ?
the problem is that what else should be added to this file ?
because currently there is no file with this name in that directory
Yes, create that file and add to that directory. The file only contains that element.  
See "A word on Contexts" at  
http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html#A%20word%20on%20Contexts
Avatar of hoomanv

ASKER

ok I created a HelloWorld.xml in TomcatHome\conf\Catalina\localhost\
and added <Context path="/HelloWorld"  docBase="C:\mywebapp2"></Context> to it
formerly I used to run it by http://localhost:8080/mywebapp2/HelloWorld/ (when it was in TomcatHome\webapps)
now it resides in C:\ but it doesn't work
Which resource are you trying to access ? What are you trying for URL ? Did you try  http://localhost:8080/HelloWorld/Helloworld  if the resource is HelloWorld in your web app.
Did you restart Tomcat ?
Avatar of hoomanv

ASKER

both of these two work if mywebapp2 reside in webapps folder
http://localhost:8080/mywebapp2/HelloWorld
http://localhost:8080/HelloWorld/Helloworld

but neither of them work if I move mywebapp2 to C:\ and also setting the Context

> Did you restart Tomcat ?
Yes
Avatar of hoomanv

ASKER

OK it worked
I had another mywebapp in webapps folder which had the same name HelloWorld
Thanks a lot rrz@871311
So the resource you are trying to access is HelloWorld ( a servlet ?) ?  
I don't why the second URL doen't work. It should not be working while you web app is still in the webapps folder.
Ok, good.   rrz
Avatar of hoomanv

ASKER

one other Q, why was it working with http://localhost:8080/mywebapp/HelloWorld
when mywebapp resided in webapps
but now that it is in C:\ it cant be run like http://localhost:8080/mywebapp/HelloWorld
instead I must use http://localhost:8080/HelloWorld/HelloWorld

which is the appropriate/standard way ?
If you want to use  
http://localhost:8080/mywebapp/HelloWorld  
then try  
<Context path="/mywebapp"  docBase="C:\mywebapp2"></Context>