GeeCON Prague 2014*
The moose likes Tomcat and the fly likes Confugure Tomcat To Host a Server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "Confugure Tomcat To Host a Server" Watch "Confugure Tomcat To Host a Server" New topic
Author

Confugure Tomcat To Host a Server

sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Hello Friends,

I am quite new to tomcat, so please ignore if this question is funny or stupid...
I want to create a server to host my web-site(servlet-JSP tech. used),from my personal computer. I came to know Tomcat is the one that can do this.I have tried configuring tomcat for this purpose but have failed many times. So please help me to configure Tomcat for the same purpose..I have acquired a domain name and have static ip too...also any other suggestion for any other server s/w would be great,that supports J2EE spec..I hope my question is clear enough to answer....and if it is not then I would be more than happy to discuss it again...


Regards, Sud.
SCJP 5 ScjpFAQ JLS
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
How far have you gotten with Tomcat? Can you get Tomcat started and see the normal welcome page?

What is your operating system?
Which version of Java?

It is unclear from your post exactly where the problem may be.

Bill
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

William Brogden wrote:How far have you gotten with Tomcat? Can you get Tomcat started and see the normal welcome page?

What is your operating system?
Which version of Java?

It is unclear from your post exactly where the problem may be.

Bill


Thanks Bill for guiding me to the right question..As I know a little servlets and jsp I am a little femiliar with tomcat.
Hence i do know how to start tomcat as well as I see the normal welcome page. the operating system taht I use is Wondows 2007.But my question does not involve the os is use or does it? What I want to do is to configure tomcat to host the web-site from my pc at home,such that when a user writes www.shekharsudipto.com he should be touted to my computer or rather the server that I have hosted through tomcat. I hope I have made the things clear to you. If still I am not clear then I would discuss it again. And thanks Bill for the reply
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Hey Bill, I just now followed the link in your signature and saw your web-site (powered by Tomcat),great work out there. How did you do this? I want the same, to host my own website using tomcat server. Please guide me how configure it with the domain name so that the request for say www.shekharsudipto.com can be directed to my tomcat server(running in my pc ). I hope I am clear
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
You say you have gotten a static IP address and your site domain name is mapped to it, right?

The next question is, how is your computer exposed to the Internet?

In my case I have a router which performs a NAT (Network address translation) so that incoming requests to one of my registered IP addresses is directed to the local network address of my server. ONLY for requests directed to port 80. The router prevents external requests from seeing any other machine on my network. Incidently, the router logs show daily attempts to telnet to my system by hackers, isnt the Internet fun.

If you don't have a router, your connection is presumably protected from external access by a firewall or other security software. You will have to configure that firewall to allow access to the port you want Tomcat to serve - presumably port 80.

Bill

sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

William Brogden wrote:You say you have gotten a static IP address and your site domain name is mapped to it, right?

The next question is, how is your computer exposed to the Internet?

In my case I have a router which performs a NAT (Network address translation) so that incoming requests to one of my registered IP addresses is directed to the local network address of my server. ONLY for requests directed to port 80. The router prevents external requests from seeing any other machine on my network. Incidently, the router logs show daily attempts to telnet to my system by hackers, isnt the Internet fun.

If you don't have a router, your connection is presumably protected from external access by a firewall or other security software. You will have to configure that firewall to allow access to the port you want Tomcat to serve - presumably port 80.

Bill



Thanks Bill for the reply. I have broadband connection and I have a ADSL2 + router through which I am connected to the internet. I think in this case I don't have to configure the firewall. so please tell me further what procedure should I follow to configure tomcat with my domain name. I hope I am clear and if I am not then please let me know but please don't stop replying . thank you for your valuable time.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
I have a ADSL2 + router


In that case it is time for you to chase down the details of configuring the router yourself. Try the manufacturer's web site.

I imagine that your Windows installation has firewall software and may prevent external requests from reaching your system. Again, it is time for you to investigate the details. I can't help you with your router/windows configuration as that is quite different from mine.

Bill
srinivas srinivasmeenavalli
Ranch Hand

Joined: Jul 13, 2008
Posts: 65
hi
Have you configured Tomcat with any webserver like Apche,or IIS. Tomcat is a servlet container so you need to have a web server to access http requests.you can configure Apache webserver to open your own jsp's , which are developed in Tomcat
check this
webpage
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
Tomcat is a servlet container so you need to have a web server to access http requests


WRONG WRONG WRONG - where in the world did you get that idea. This has NEVER been true in the entire history of Tomcat.

Tomcat works just fine as a general purpose web server because the "default" servlet can handle all the normal http requests for html pages, images, css files, images etc.

There is UTTERLY NO REASON to enter the complexity of linking IIS or Apache to Tomcat.

Bill
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

William Brogden wrote:
I have a ADSL2 + router


In that case it is time for you to chase down the details of configuring the router yourself. Try the manufacturer's web site.

I imagine that your Windows installation has firewall software and may prevent external requests from reaching your system. Again, it is time for you to investigate the details. I can't help you with your router/windows configuration as that is quite different from mine.

Bill


ok Bill, Ihave configured my windows firewall to handle external requests to my ip-- my pc. now please tell me how do i configure tomcat with my domain name?? did you understand what I am seeking?? how do I configure TOMCAT with my domain name ?

And thanks again for the reply.
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

srinivas srinivasmeenavalli wrote:hi
Have you configured Tomcat with any webserver like Apche,or IIS. Tomcat is a servlet container so you need to have a web server to access http requests.you can configure Apache webserver to open your own jsp's , which are developed in Tomcat
check this
webpage

Thanks buddy
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
how do I configure TOMCAT with my domain name ?


You dont have to unless you have multiple virtual hosts - not the usual situation. Tomcat just listens for requests, it assumes that the internet is directing requests to your computer correctly and that they are getting through your firewall.

Mapping your domain name to your IP address should be all that is required and that should be done by the domain name registry.

Are you sure that the port you configured for Tomcat to listen on is being passed by your firewall?

Bill
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

William Brogden wrote:
how do I configure TOMCAT with my domain name ?


You dont have to unless you have multiple virtual hosts - not the usual situation. Tomcat just listens for requests, it assumes that the internet is directing requests to your computer correctly and that they are getting through your firewall.

Mapping your domain name to your IP address should be all that is required and that should be done by the domain name registry.

Are you sure that the port you configured for Tomcat to listen on is being passed by your firewall?

Bill


Yes Bill as because I have turned off my firewall . But my question is that where does the server software reside? What I mean is that I have a domain name and that is bound with my IP. But then, when the request is directed to my PC ,how will the tomcat server will understand that it has to give a response? For that there must be some configuration settings,or no? Is it what you are saying that when there will be an incoming request i.e someone types in my domain name and that the request is forwarded to my PC, then the server running at any port , say 9856 it will serve the request? Is it not necessary to configure my server for the port? Tomcat is a web container for J2EE and apache is the web sever which will server the incoming request right? So if this is the case then how do i I configure tomcat with the apache web-server which will in fact serve the incoming request? i think I am clear in what i want to say, and if not then please tell me to be so.

Thank Bill.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
Like I said, when properly configured, a running Tomcat will wait for an incoming request on the socket specified. Tomcat depends on:

Your registered domain name mapping to your IP address.
Your firewall allowing an incoming request to reach the specific port as used in the URL.
Tomcat being configured to listen to the specific port.

Thats really all there is to it. Tomcat IS the server software.

apache is the web sever which will server the incoming request right?


Perhaps this is the source of your confusion. The Apache web server came long before Tomcat and is a free standing web server.

The Tomcat project unfortunately gets called "Apache Tomcat" - it is completely different from the existing Apache web server. Tomcat can act as a web server all by itself. You do NOT have to have IIS or the Apache web server or any other kind of web server in addition to Tomcat.

IF you are already running IIS or the Apache web server (not Tomcat) THEN you will have to configure Tomcat to cooperate with Apache or IIS or whatever. I have done this and it is a real pain in the neck.

Incidently - DO NOT TURN OFF YOUR FIREWALL - that would be inviting disaster. Instead, configure it to pass only incoming requests addressed to your selected port.

Bill

sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

William Brogden wrote:Like I said, when properly configured, a running Tomcat will wait for an incoming request on the socket specified. Tomcat depends on:

Your registered domain name mapping to your IP address.
Your firewall allowing an incoming request to reach the specific port as used in the URL.
Tomcat being configured to listen to the specific port.

Thats really all there is to it. Tomcat IS the server software.



Oohh, well then please guide me for doing the following...

William Brogden wrote:Like I said, when properly configured, a running Tomcat will wait for an incoming request on the socket specified. Tomcat depends on:

Your registered domain name mapping to your IP address. [I have done this ]
Your firewall allowing an incoming request to reach the specific port as used in the URL.
Tomcat being configured to listen to the specific port.





I hope you understand what I mean to say..
Thanks Bill once again...
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
So - you have done all the configuration and you have Tomcat running. Why do you need more guidance?

What happens when you address a URL to your site from a browser?

Bill
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Hi Bill,

Yes I have my tomcat configured to port 8080 and when I type localhost:8080 the home page of tomcat opens .
but when i type my domain name www.mountassisi.com it says me "Cannnot fing server". my tomcat is started and running. Is it due to the firewall??
I can not figure it out. What do i have to do?
Do i have to configure my firewall? If so then what are the changes I should make in the firewall settings so that it allows an access to port 8080?

And Bill, thanks for replying.
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

I have windows 2007 running on my laptop and in the firewall settings i have enabled "BranchCache - Content Retrieval (Uses HTTP) ".
But still it says cannot find server.
Please suggest any more changes, if there are any..

Thanks
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

When i type just "mount321.mine.nu" it says "Authentication Required" then it asks and says this...
A username and password are being requested by http://mount321.mine.nu. The site says: "DSL Router"


Mr. Bill can you figure out what is going on?
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

Do i have to configure tomcat with the domain name?
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12791
    
    5
Do i have to configure tomcat with the domain name?


Why do you keep asking the same question? I already told you the answer.

Since you can get to Tomcat as localhost:8080, tomcat is clearly running and waiting for a request on port 8080.

IF your firewall and router are configured properly to allow requests to 8080
THEN www.mountassisi.com:8080 should get through to Tomcat. Note that the port must be specified if it is not the default.

I have utterly no idea how Windows 2007 firewall should be managed - surely there is documentation.

Bill
sudipto shekhar
Ranch Hand

Joined: Apr 02, 2008
Posts: 823

I am sorry for my repeating questionnaire...
 
GeeCON Prague 2014
 
subject: Confugure Tomcat To Host a Server