File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tomcat Question

 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have three websites but I can work with one website at a time to put it in ROOT.

Can I view three different websites with tomcat without copy pasting them in ROOT?

Thanks & best regards
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wouldn't put anything into ROOT. Why don't you keep the three sites in 3 (non-ROOT) subdirectories of the webapps directory; all 3 can run in parallel that way. The URL would be http://localhost:8080/myApp1/ instead of http://localhost:8080/ in that case, but all links should work the same, assuming you're using relative links.
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can run multiple web applications simultatiously by adding them to their own context like so:

%CATALINA_HOME%/webapps/webapp1
%CATALINA_HOME%/webapps/webapp2
%CATALINA_HOME%/webapps/webapp3
etc.

Where webappN would contain the typical web application directory structure. Or by just adding web application archives (.WAR) to %CATALINA_HOME%/webapps/ and having Tomcat explode them for you during deployment. Why would you want to add your web application files to the ROOT context?

Edit: Aw, too slow. Ulf beat me to it
[ March 27, 2008: Message edited by: Jelle Klap ]
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ulf Dittmer:
I wouldn't put anything into ROOT. Why don't you keep the three sites in 3 (non-ROOT) subdirectories of the webapps directory; all 3 can run in parallel that way. The URL would be http://localhost:8080/myApp1/ instead of http://localhost:8080/ in that case, but all links should work the same, assuming you're using relative links.


No, not working. I have aa folder and inside aa is company==>>profile.html
http://localhost:8080/aa is working but when am clicking the link the following message appears. Can I have to make changes in tomcat ?

HTTP Status 404 - /company/profile.html

--------------------------------------------------------------------------------

type Status report

message /company/profile.html

description The requested resource (/company/profile.html) is not available.
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
%CATALINA_HOME%/webapps/webapp1
%CATALINA_HOME%/webapps/webapp2
%CATALINA_HOME%/webapps/webapp3

Thanks for your help.

I am very new to tomcat and Java. where can I see .war file or where I make recommended changes

Thanks again
[ March 27, 2008: Message edited by: Farakhkhan ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In order for Tomcat to see a folder (under webapps) as an application, that folder must have a WEB-INF folder inside it.

tomcat/webapps/aa/WEB-INF
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
In order for Tomcat to see a folder (under webapps) as an application, that folder must have a WEB-INF folder inside it.

tomcat/webapps/aa/WEB-INF


Yes that has WEB-INF folder and web.xml but still am facing the problems. What else could be changed

Thanks & best regards
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Raakh",
Please check your private messages regarding an important administrative matter.
-Ben
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Farakhkhan",
Please check your private messages regarding an important administrative matter.
-Ben
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:
"Farakhkhan",
Please check your private messages regarding an important administrative matter.
-Ben


I checked and send you 2 simultaneous messages

Can anybody please help/guide me regarding my tomcat question?

thanks & best regards
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Farakhkhan:


I checked and send you 2 simultaneous messages

Can anybody please help/guide me regarding my tomcat question?

thanks & best regards


Please check them again.
-Ben
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:


Please check them again.
-Ben


Is it ok Now?
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, a very simple example:

1. Create a folder called helloworld in %CATALINA_HOME%/webapps, where %CATALINA_HOME% is the Tomcat installation folder.

2. Create a new plain text file with the following contents:


3. Save this file as index.html in %CATALINA_HOME%/webapps/helloworld

4. Start Tomcat (if not running).

5. Start a webbrowser and navigate to http://localhost:8080/helloworld (assuming localhost is the listen adress and 8080 is the listen port).

You should see the hello world message.
[ March 27, 2008: Message edited by: Jelle Klap ]
 
Farakh khan
Ranch Hand
Posts: 833
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Its mean that when I'll use the path of other file then I have to follow the path of this folder e.g. aa==>>index.html, company folder===>>profile.html like this /aa/company/profile.html whereas I was using in ROOT just: /company/profile.html

right?

Thanks & best regards
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jelle Klap:
3. Save this file as index.html in %CATALINA_HOME%/webapps/helloworld.


Again, Tomcat (in versions up to 5.5 anyway) won't recognize a folder as a web application unless it contains a WEB-INF folder.
 
Jelle Klap
Bartender
Posts: 1951
7
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ben Souther:


Again, Tomcat (in versions up to 5.5 anyway) won't recognize a folder as a web application unless it contains a WEB-INF folder.


It's fairly reasonable to assume that somebody just starting to learn about Tomcat downloaded a recent version to do so, and I didn't want to complicate things unnecessarily.
[ March 27, 2008: Message edited by: Jelle Klap ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by farakh khan:


No, not working. I have aa folder and inside aa is company==>>profile.html
http://localhost:8080/aa is working but when am clicking the link the following message appears. Can I have to make changes in tomcat ?

HTTP Status 404 - /company/profile.html

--------------------------------------------------------------------------------

type Status report

message /company/profile.html

description The requested resource (/company/profile.html) is not available.


You should probably use a relative URL in that link (one that doesn't start with a slash).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic