• Post Reply Bookmark Topic Watch Topic
  • New Topic

where is my web application root?  RSS feed

 
James Byars
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,

I am new to Tomcat, and I am a little confused as to where I should put my web application. Basically, I have a ROOT directory already in my webapps directory, and I am confused as to which one I should be using.

1) $CATALINA_HOME/webapps/
2) $CATALINA_HOME/webapps/ROOT

thanks
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends on whether or not you want your webapp to be in the root context ("/"). If so, replace the ROOT contents with your webapp. If not, create a new directory and put it there. (Or leave it as a war file and put it under webapps and Tomcat will unarchive it for you.)
 
James Byars
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Depends on whether or not you want your webapp to be in the root context ("/"). If so, replace the ROOT contents with your webapp. If not, create a new directory and put it there. (Or leave it as a war file and put it under webapps and Tomcat will unarchive it for you.)


sorry, I am confused. I had thought that the root context was decided by the url-mapping in web.xml !
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tried it yet?
 
James Byars
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Have you tried it yet?


I wouldnt have asked if I had not! yes, I did try various combination, but still have problems.
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maybe it'd be easier if you'd describe the problem(s). Under default circumstances what I've told you is correct.
 
James Byars
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Maybe it'd be easier if you'd describe the problem(s). Under default circumstances what I've told you is correct.


Hi David,

I am sure what you described is right, I am just a little confused as to what is going on. Maybe I should start one step at a time,

1) When I place my war file in $CATALINA_HOME/webapps/, Tomcat automatically extracts it into webapps. And if I delete the war, the extracted directory also gets deleted from webapps. Is this correct?

2) I have my directory structure as
- myHome
- myTestApplication
- WEB-INF
-src
-classes
-web.xml

I went into myHome and I did:

jar cvf myTestApplication.war myTestApplication.

I thought this was the right way to do it, but trial and error has shown me that Tomcat will extract this as $CATALINA_HOME/webapps/myTestApplication/myTestApplication/WEB-INF/etc...

and therefore I had to go into myHome/myTestApplication and then do:

jar cvf myTestApplication.war WEB-INF

Is this the way things are meant to work?

thank you
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your directory hierarchy is unclear.

AFAIK war files should be created at the app context root, so if you have an index.html at the root level in your app it should be at the root level in the war. That said, it's been a really long time since I've created a war file by hand.
 
James Byars
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
David Newton wrote:Your directory hierarchy is unclear.

AFAIK war files should be created at the app context root, so if you have an index.html at the root level in your app it should be at the root level in the war. That said, it's been a really long time since I've created a war file by hand.


thanks
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!