jQuery in Action, 3rd edition
The moose likes Linux / UNIX and the fly likes Struts/Tomcat on Linux Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Struts/Tomcat on Linux" Watch "Struts/Tomcat on Linux" New topic

Struts/Tomcat on Linux

Steve Levin

Joined: Jul 23, 2004
Posts: 11
I have recently obtained a dedicated server from a hosting company, FedoraC6.PLESK811. I have ben trying, unsuccessfully, to upload and run my struts web application. I am trying to avoid using a war file so I have uploaded the files into the directory /var/www/vhosts/myDomain.com/httpdocs.
The folders I have uploaded to this directory are WEB-INF, jsp, images, etc.. along with an index.html page which simply redirects to a home.jsp page in the folder jsp.

Within Plesk, when i click on the 'site preview', the index page correctly redirects the app to the home.jsp page but all that is shown is the tiles insert definition on that page.

So it seems that Tomcat is not being used to handle the requests. The hosting companies support for this topic is terrible. And I've been running around in circles for hours trying to figure it out. I'm somewhat new to Linux and I would appreciate any help that could be given configuring Linux/Apache/tomcat to handle this web app.

Thanks in advance
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

It's difficult for folks on a forum to help with issues like this.
There are a lot of ways to configure Tomcat and the Apache Web Server; especially in regards to where files and things go. If your hosting company is not giving you good support or is not providing documentation for this, you might want to consider switching to one that does.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Narendra shah
Ranch Hand

Joined: Feb 28, 2007
Posts: 52
Ya you are right. As such your tomcat is running at different port. Your application is running on your linux server default http service. You can configure your tomcat to run when your httpd service is being on. And change your port setting on /usr/local/tomcat/../server.xml. I hope this is useful to you.

Narendra Shah -- SCJP 5
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

You can't just plunk stuff any old where and expect it to work. There are some very good reasons why WAR files are the best way to deploy J2EE apps, but if you prefer to use an exploded WAR, here's some info that may help.

The #1 mistake that almost everybody makes is in thinking that a web server is basically the same as a file server. A web server is a LOT different than a file server. Just because URL's look like filesystem paths doesn't mean that that's how the appserver will interpret them, and Struts apps are a paticular case in point - if the appserver didn't decode the URL into a Struts request, you'd get no web page at all.

When a web application is deployed to an appserver, an application context is established. The application context is the top "directory" of the URL. In order to serve up this application context, you have to establish a mapping of the context name with a web app. For Tomcat, that would be to a WAR file or (in your case) an exploded war directory.

By default, any subdirectory dropped into the $CATALINA_BASE/webapps directory will have its name registered as a web application context. So in the simplest case, I could deploy $CATALINA_BASE/webapps/myapp and bring up the app at http://myhost:8080/myapp.

If you prefer not to deploy to $CATALINA_BASE/webapps, you can indicate an alternate location using a web context definition - see the Tomcat docs on the <Context> element. Although you can embed this definition in the Tomcat server.xml file, a better way is to deploy the context as a standalone xml file. In Tomcat4, you'd drop this file into CATALINA_BASE/webpps. In Tomcat5, it goes in CATALINA_BASE/conf/Cataline/locathost.
[ July 12, 2007: Message edited by: Tim Holloway ]

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Struts/Tomcat on Linux
It's not a secret anymore!