The moose likes Tomcat and the fly likes Help needed in tomcat deployment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Help needed in tomcat deployment" Watch "Help needed in tomcat deployment" New topic

Help needed in tomcat deployment

Vivek Bhatt

Joined: Mar 19, 2010
Posts: 2
Hi All,

I have just joined the forum and I am not sure what I am gonna ask, had already been discussed (may be many times).

I need help on to deploy an application on tomcat. I have hosted a website on internet using one hosting provider and I am currently accessing it using
ip address and port... something like http://123.456.789.012:<port>/abcd/xyz.html

server is tomcat 6.0.24 & application is on java+struts2+mysql.

I have also registered a domain name for this would be site (say

I am not able to setup this domain name on my tomcat server so that I can access the website using and not
using IP address and port, http://123.456.789.012:<port>/abcd/xyz.html

I have never been part of any deployment on internet.

Can anyone help me on this on how to make it work?

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17282

Welcome to the JavaRanch!

To permit your website to be findable by name, you have to get an entry in the "Internet phone book", which is Domain Name Services. That means that you have to purchase rights to the domain name "" from one of the domain name registrars such as Verisign or GoDaddy. You can also buy the name though your ISP in many cases. That will give you the rights for "" for a specified number of years, after which you'd have to renew the name, since it's really only rented, rather than purchased. And, of course, you have to have a domain name that no one else holds the registration on.

Once you've done that, you have to get the actual host IP address bound to a host name in that domain. Typically, that hostname would be "www" for the web host, but it doesn't have to be. This binding is done in the nameserver(s) that are registered with your domain name. Often your ISP will provide that service, although there may be a small fee.

Next, to get the port number off the URL, you'll have to do some work yourself. When a user enters a URL that doesn't have an explicit port number on it, and the protocol part of that URL is "http:", the client will assume port 80. So you'll need to make your webapp respond on port 80. You can do that by either changing the ports used by Tomcat (from 8080 to 80) or by proxying through another server, such as apache httpd.

Finally, to get the web application context name out of the URL, you'll either need to install it under the root context ("/") or, if you're using a proxying system, use the proxy rules to direct from the raw URL to the tomcat context.

I prefer the proxying approach, since Tomcat can only have one root context, but Apache can easily make multiple webapps each look they're at a root level. Plus it allows me to add non-J2EE resources to the overall webserver picture if I like.

An IDE is no substitute for an Intelligent Developer.
Devaka Cooray
ExamLab Creator

Joined: Jul 29, 2008
Posts: 3794

"Exam Flux", please check your private messages regarding an important administrative matter.

Author of ExamLab ExamLab - a free SCJP / OCPJP exam simulator
What would SCJP exam questions look like? -- Home -- Twitter -- How to Ask a Question
Vivek Bhatt

Joined: Mar 19, 2010
Posts: 2

Thanks for your inputs.

I have got the domain registered and made the payments. I can use it.

I am using port 7001 to access this application and it works well if I use it using IP address.

I am struck after this as I don't know what configuration shall I keep in server.xml. Can someone help me with deployment example which will
map www.<mywouldbesite>.com to that ip address and its port.

If any other info is required, please let me know.

I agree. Here's the link:
subject: Help needed in tomcat deployment
It's not a secret anymore!