Saturday 17 August 2013

Tomcat server setup

Tomcat server setup
Installing tomcat server
·         Install tomcat server
·         Go to tomcat folder directory( eclipse and tomcat both are downloaded in a same folder)
·         Click on tomcat.exe
·         Open eclipse ide tool (i.e start eclipse)
·         Go to eclipse directory, and open eclipse ide
·         Set up tomcat inside eclipse

·         Select server tab, right click->select new server like below
click on select tomcat versions (example: Tomcat v6.0 Server) from Apache

Click on next
·         Click on browse->go to tamcat directory(Ex: C:\Program Files\Apache Software Foundation\Tomcat 6.0
Once you select Tomcat 6.0, Here click on ok

Here you select jdk1.6.0 from JRE pop up options bcoz Tomcat needs


Click on Finish button

Right click the tomcat bottom, and select start option
Then you will notice Console icon
Note:
 While we are starting tomcat server some times we may get error message, that time we have to change the port no or host name:
1st method:
Steps
·         1. Navigate to
C:\apache-tomcat-6.0.18\conf\server.xml
(The place where you have installed tomcat)
·         2. In server.xml file locate
1.  <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->  
2.  <connector port="8080" maxthreads="150" minsparethreads="25" maxsparethreads="75" enablelookups="false" redirectport="8443" acceptcount="100" debug="0" connectiontimeout="20000" disableuploadtimeout="true">  
3.  <!-- Note : To disable connection timeouts, set connectionTimeout value to 0 -->  
4.  </connector>  
Or
1.  <connector port="8080" protocol="HTTP/1.1" connectiontimeout="20000" redirectport="8443">  
2.  </connector>  

(You can find something similar to the above snippet in server.xml.  It varies according to tomcat version)
change Connector port="8080" to Connector port="8081" or some other port number. Make sure that the port number in not used by some other application.
·         3. Save and restart tomcat.
·         4 .Now try running with the new port number i.e. http://localhost:8081

Mappings of IP addresses to hostnames

(Change localhost to some other name)


Operationg System: 
·         Windows XP
Steps
·         1. Navigate to
C:\WINDOWS\system32\drivers\etc

Or
start->All Programs->Run-> type 'drivers'  (Without quotes)->etc
·         2. Open the file host with a text editor and change
127.0.0.1       localhost
To
127.0.0.1       projectname


·         3. Restart Tomcat and Try http://projectname:8080/

# host file contains the mappings of IP addresses (in our case 127.0.0.1) to 
#host names (localhost). Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
*/

You can see the last line that server start up in 1674
Now you can observe that tomcat server has started


 In order to test this, open a browser window and access the default URL




 TYPE URL : localhost:8080

Or

If you change the host name as projectname, then type in the browser address url: projectname:80801 . if you unable to find the server tab in eclipse?

Ans: go to window from eclipse menu->show view->other->and search for server->press ok
1.       When we attempting to test the tomcat server, we may get pagenot found exception?




Ans:
Ans: go to right click on tomcat
Click switch location and click on apply and ok
·         Go to left hand side tomcat server
·         Right click->properties
Double click on configuration like below picture:

·         And make sure
·         Enable “use Tomcat installation”

You may like the following posts:










No comments:

Post a Comment