hosting my website on a LAN using tomcat server - java

I am badly stuck in a doubt that i have tried various ways to get it cleared and coul'nt find a solution and therefore i decided to come back to the good old place where i have never missed out on getting what i want!
I have a simple hello world jsp page that will trigger a java servlet when a button on this page is clicked. I am running it in a tomcat server that i have installed on my laptop. i am using the Eclipse IDE. so when i run my jsp page, it asks if i want to make the server up, and i will say yes and the jsp page comes up in the browser inside eclipse IDE. and i can access the same page through my system's browser (chrome) too using http:/// . (90 is the port that i have configured for this tomcat). but if i hit to the same url pattern as i have told you above on a desktop which is in the same network as my laptop is, nothing comes up and then i thought, i will hit using the IP of my laptop where the server (tomcat) is actually running, still no result.
when i googled a bit, i learnt that IIS server should be running on my windows to achieve what i want. but my doubt is: Is there a difference between IIS server and tomcat server?because tomcat is already running, do i need an IIS server?
Update - Solution
i used the private IP of my laptop and then it works!!! i was using teh public IP of my network till now so was unsuccessful!!

IIS is a web server while Tomcat is a web container. You can find more information
here
You dont need IIS to access Tomcat. Tomcat is a standalone web container which can server JSP pages you are trying to access. Simplest thing to do is try to ping your laptop from your desktop. If that doesnt work then your need to check firewall settings as suggested by another user. But if that works, make sure your port and application context name is correct.
Thanks.

As you told that you are using your public IP address to access the page but nothing happing, it's because the public IP you are seeing is not your laptop's IP. it's your router's IP. Your private IP is your laptop's IP which is assigned by your router. if you want to access the page using your public IP you have to forward that particular PORT on your router. By doing that you can easily access the page from anywhere not only from your home network but from other networks as well.

Solution i used the private IP of my laptop and then it works!!! i was using teh public IP of my network till now so was unsuccessful!!

Related

Web application running without a name

I just made a simple web application (using java and jersey as i want to start making a rest endpoint). I am working on intelliJ idea
I used this tutorial to build it.
I gave the project a name, group id and artifact.
Now when i run it in my local tomcat server, it runs successfully but does not show me the name of my web application in URL. It only shows localhost:8080 as can be seen in the screen shot below.
Why is it displayed like that? How can i give my application a name/URL?
Basically, you need to watch this video first: Domains and the Domain Name System and then fully understand what the following paragraph means. Then your question will solve itself. Good luck! :D
localhost is the IP address of the server where the tomcat (which is an application server) is running. 8080 is the port. The localhost maps (from Windows hosts file) to 127.0.0.1 and this is a loopback IP address (meaning that it is, in fact, yourself).
p.s. that's what about the name in the URL. About the actual browser tab name, it's the <title> HTML tag.
How can i give my application a name/URL?
You need to buy a domain name.
So what i was looking for was to set the application context in tomcat server.
Here is how i did it: On IntelliJ idea, clicked on 'Edit configuration' -> than on 'Deployment' tab.
There is an option for "application context' there. I give it the name of my application(or any name that i like) and click 'apply' and restarted the server.
Here is how it appears in the browser now:

Tomcat and Eclipse Real Website

I have created a website running on eclipse and tomcat. What is the way to make this website running online for real?? I have developed it, adding filters and sessions and using a database. I want to allow people to use this website. What I have to do?
You need to publically expose your computer and the port you set up.
If your application runs locally, it must be able to be hit by the outside world.
Make sure the tomcat config is setup correctly and ensure port forwarding on your router or modem is setup. Your public IP (available if you google whats my ip) and the port is all your users would need.

Trying to view deployed JSP page online. XAMP / Tomcat

I've been using XAMP and it's features for some php sites and it's working fine. I'm now needing to use it for JSP development for a project we're about to start working on.
So far it's functioning on my local machine in that I downloaded the sample war file from Tomcat and it deploys fine and is visible when using localhost:8080/sample.
The problem is that I can't seem to access it from a browser using the domain name. I tried www.mydomain.com/sample but receive a 404 error.
The same when using my local IP address instead.
I've searched online for a while now and have come across a few sources that hint at integrating apache with tomcat but nothing concrete enough to try and get a working solution.
I've also tried (and miserably failed) to watch the video that is referenced in a few other questions.
Any help is hugely appreciated,
Thanks.
that's because tomcat works on port 8080 unlike apache - when you run php sites they are just behind the apache which is visible on port 80 (which the default one in browsers), you can go through "http://mydomain.com:8080/sample" and it would work the same as through localhost
you can also change tomcat's settings and change it's connector's port from 8080 to 80, and then it would work as you expected

How to create voice chat in web browser with java

I want to create a voice chat which runs on the web browser.
The basic idea is that when I run the server.jar file, it will listen to a socket for connection, and when I type the ip and port on another computer on web browser(ex. 1.1.1.1:8082), the server will accept the connection and display an voice chat applet. Server.jar should contain all voice handlers. For example, if we have three computers, one with the server running while other two has web browser applet running and connected to the server, user1 talking will transmit over to the server, which then transmit over to user2.
So far, I have the applet and the server, but I am having trouble using the web browser to open the applet. It seems I need to use servlet and apache tomcat for the server side to make this work.
Can anyone confirm that I need to use servlet and apache tomcat to achieve this? Or can anyone suggest a better way to approach this project?
if it's peer-to-peer, everything can be written inside the applet.
Oh and as far as i know, there is no java voip libraries so you're going to have to port one from a C/C++ library or write it yourself.

How to put Java program online?

I am learning Java and am trying to do some experiments with networking Java programs.
I have a program made in 2 parts with a client and a server and it works in local testing but the program actually has usefulness for me and a friend of mine and I want to put the server online so both of us can connect to it and use it.
Where/How can I put the program online and have it running so that the client programs can connect to the ServerSocket with an ip address? (Preferably free)
If you dont want to pay server hosting then I would open a virtual server on my computer, then playaround with modem and forward related port to server ip. I would use a port more than 40000. Then just send your ip and port your friend or update application.
If you really want the application to go live within 5 mins, try Jelastic. If you have built a WAR file, simply sign up with their server,choose a provider closest to your geo location, configure Tomcat and you can upload the WAR file through their fantastic web console. Otherwise if you have some source control system(SVN,GIT etc), you just connect and build it with their Maven console and you can be ready. I used it for my start up(Cloudlabz) and really found it exciting.
Surya
You could also consider the cheapest Rackspace Cloud Server. You'll get a full fledged Linux server (distribution of your choice) for about USD 11/month. I've done that now and then myself to try things out.
Just install Java on it and you're good to go.
http://www.rackspace.com/cloud/cloud_hosting_products/servers/pricing/
http://ideone.com/
is that what you want for this?
This is a free web app for you to run your program online....so you can just paste your code and run it.
On the cloud you could use two different services in order to host your Java application.
IaaS (Infrastructure as a Service). Where you can just rent a specific infrastructure on the cloud and you could install and configure all the services that you need.
PaaS (Platform as a Service). In this case, you still enjoy the infrastructure on the cloud + the service Aaren full pre-configured. It means that you can deploy your application without installing or configuring anything. You just need to deploy your application. You have an example about how it works here. Also, you usually can test your Java apps on the cloud without paying.
You should host the server in Heroku ,they offer a free hosting with limits , I have an app there

Categories