Tomcat not working on Localhost - java

I have an Android application that connects to a servlet in a Tomcat server.
I have Tomcat server coupled to eclipse.
The IP address indicated to the Android application to connect to the Tomcat servlet is
http://10.0.2.2:8080/Middleware/UsuarioServlet
Why if I put
http://localhost:8080/Middleware/UsuarioServlet
not work and gives an error? If I have installed Tomcat on the same machine should work with localhost too.

Because your Android application runs on virtual device, which has another IP in your local intranet, it isn't localhost.

Localhost refers to the Android device in this case. Use the IP address 10.0.2.2 to refers to your development machine. Read more about here!

Related

Unable to access java web application with windows server static ip

I was unable to access java web application with static ip(public ip) of Windows Server it was getting that site cant be reached,
but it was working with local IP.
This is the first time i am deploying my java web application in windows server, I exported the WAR from eclipse and deployed in Apache tomcat server of Windows Server.
Please help me how to deploy in live windows server. and what is the process to deploy in live windows server.
Thanks
I found the solution for this question, the issue is that, the port i have given in tomcat, the same port is running on some other application, so i have change the port then it works fine.

unable connect to java app running on server (Heroku)

I deployed my app on Heroku. It is a simple app that will throw back the message sent from its client version (running on my PC) back to the client. My server app prints the IP address of the machine it's running on so I can connect to it from my client . I do get to see the IP address of Heroku machine when I deploy and run it. However, I am not able to connect to it from my client version using that IP address(Connection timed out) . I have allowed the port I am using in my firewalls. I don't understand what I am doing wrong .
Pls help me solve it.
If you need to see my code let me know ( the app works fine locally on different terminals so I don't think it has a problem).
Your Heroku dyno (an isolated server) is behind a router. You can't use the IP address to connect to it.
Instead, you the URL https://[appname].herokuapp.com where "[appname]" is the name of your app.
You can also run heroku open from the command line.

Apache tomcat - how to open the browser in remote machine

I have a local machine , say A with IP (a.a.a.a) and a linux server, say B with IP (b.b.b.b)
Now I have created a war file with name 'example' and deployed it in Apache tomcat in our linux server.
I want to open the browser in my local machine by typing the following in address bar :
http://b.b.b.b:8080/example
But I am not able to open it.
Could any one please suggest where in lies the issue?
Note : We can connect from A to B using only VNC viewer and not able to connect it through remote desktop connection application.
Does this implies that there is some issue in network connectivity or what? I think as we are able to connect B using VNC viewer, the problem should not be there.
Please help.
++++++++++++++++
extended
I have installed the apache tomcat server in my linux server which doesnot have any internet connecttion and deployed the war file in the server successfully.
and want to open browser from my local machine using (linux_IP)//8080//war_file_name
Note : local machine connects linux server through VNC only.
Could any one suggest is it possible in this scenario?
If you can only open server B using VNC, then there is a definite possibility that port 8080 is not open. The port 8080 should be open on the server. To check that you could try :
telnet host port
so for you:
telnet b.b.b.b 8080
from your machine.
Another thing to do is to start tomcat with IP address of your linux server to listen. Start tomcat with parameters:
-b b.b.b.b (ip address of your linux machine).
To me if definitely feels like a firewall problem.

Tomcat 7.0 issue

I have a tomcat7.0 running in a remote desktop machine say 204.34.34.45.
When I log into the remote desktop and try "http://localhost:8080" it is working fine.However
http://204.34.34.45:8080 is not working.
I am able to ping 204.34.34.45 from outside the remote desktop machine.
Do you know how can I access tomcat outside the remote desktop machine.
The firewall rules for that host may not allow connections to 8080. Talk to your system administrator for details.
Also, make sure you have the correct IP bindings set up for tomcat. It is possible to allow connections to localhost:8080, but disallow them from 204.34.34.45:8080. See How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?

Running Jetty web server in LAN

GAE comes with an inbuilt jetty webserver for testing purpose.Can it be configured to accessed within our LAN?
I can access it using http://localhost:8888 or http://127.0.0.1:8888 but can't access using http://192.168.1.201:8888 (This my local LAN ip)
why?
Yes it is possible:
To make your GAE accessible on your LAN, you have to configure the launcher to use the address 0.0.0.0 instead of localhost.
Open the GoogleAppEngineLauncher >> Application Settings for your app
Add “-a 0.0.0.0″ to the Extra Flags section and restart. Now your GAE will run in your LAN and can be accessed by other devices.
You need to configure GAE to listen on all interfaces, not only localhost's loopback interface (127.0.0.1).
For IntelliJ IDEA users (version 11 at least):
If you're using the GAE plugin and have a AppEngine Run configuration, open its settings and add to Server parameters: -a 0.0.0.0. This will make the GAE built-in Jetty server to listen on your lan/wlan ip address, http://10.0.1.2 for instance.

Categories