How to access Tomcat from another computer?
Like @informatik01 wrote, "If all your friends are on the same LAN (Local Area Network) as you are (and you say they are), the they can access your web application using the above URL.
http://192.168.0.120:8080/Your_App_Name/some_path/some_file.jsp
"
What OS are you using? Have you made any changes to server.xml
in $CATALINA_HOME/conf
?
Try accessing it locally first, then try it from one of your friends computers.
If it then fails, try and shutdown the firewall on the same machine as is running the tomcat instance. Depending on its configuration it may prevent incoming connections on the default port 8080
. If that was the issue, reactivate the firewall and open the desired port 8080
for http traffic.
Get to know the logs, they are usually located in $CATALINA_HOME/logs/
, have a look in catalina.out for example. If you´re unsure weather the server is up and running or not and whatever issues may´ve arisen, thats the best place to check. There it will state which webapps it finds and if it was successfull in deploying them. You can also go to the server root with your browser at localhost:8080
and check if you get the welcome screen.
Good luck!
If you are using Apache Tomcat, then by default applications deployed to it are accessible on port 8080.
So IF you have already deployed your web application to Tomcat in a proper way, AND you have started the Tomcat server, then you can access your application (website) like this:
http://localhost:8080/Your_App_Name/index.jsp
Instead of localhost, you can use 127.0.0.1, or your private IP address 192.168.0.120 like this
http://192.168.0.120:8080/Your_App_Name/index.jsp
Instead of Your_App_Name use the name of your deployed application (application context), and index.jsp is here as an example.
IF all your friends are on the same LAN (Local Area Network) as you are (and you say they are), then they can access your web application using the above URL.
http://192.168.0.120:8080/Your_App_Name/some_path/some_file.jsp
IF they are outside your LAN, then you have to configure port forwarding on your router. And to do that, of course, you need to have access to it. Then they will be able to access your web application using your public IP and the port as it was configured while setting port forwarding.
Here is a very good article with pictures:
By the way, if you have properly installed Apache Tomcat and started it, then you should be able to access it like this:
http://localhost:8080
Useful resources
- The official Apache Tomcat documentation
- Beginning & Intermediate Servlet & JSP Tutorials
- Tomcat for beginning Web developers (PDF file)