Wednesday, February 13, 2013

How To Change The Default Port Of Tomcat

1) Go to 'conf' folder in tomcat installation directory.

2)  Edit following tag in 'server.xml' file.

<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" 
redirectPort="8443"/>

3) Change the port=8080 value to a preferred value.A port number is a 16-bit unsigned integer, thus ranging from 1 to 65535. The port numbers in the range from 0 to 1023 are the well-known ports. They are used by system processes that provide widely used types of network services.

4) Save file.



How To Host A Simple Html Page in Tomcat

There is no need to create a war to run the html file from Tomcat. Follow steps can be used.
  1. Create a folder in webapps folder e.g. MyApp
  2. Put html and css in that folder and name the html file, which you want to be the starting page for your application, index.html
  3. Start tomcat and point your browser to url "http://localhost:8080/MyApp". Your index.html page will pop up in the browser
There is another way too.Put the html or other resources to ${CATALINA_HOME}/webapps/ROOT
& open browser and browse to http://localhost:8080/yourhtml.html