Not able to connect localhost with system ip - java

I have deployed my java web application using apache tomcact in my system through Eclipse. I can access the same page with
https://localhost:8080/Home.jsp
as well
https://mysystemip:8080/Home.jsp
But the same page is not able to connect
https://mysystemip:8080/Home.jsp over the network through other systems. Previously it was working and now not. What issue causing this ?

Your Tomcat server is only bound to your local network interface. You need to bind it to all interfaces for it to be available.
There is already a solution (Can't access Tomcat using IP address):
Add address="0.0.0.0" to Connector string

Related

Connection to Openshift Online 3 from JAVA code outside the cloud

Openshift 2 will not work from tomorrow. Online 3 version is available. I use starter type.For Openshift 2 I could write/read data to/from MySQL DB located on openshift from my application that located on my PC, I mean from the code outside of the cloud. But now, with version 3 I have no idea hot to do it.
How to it now?
Is it possible to connect my local MySQL WorkBench to MySQL DB on Openshift Online 3 as well?
Port forwarding is very common method to make secure connection to remote machines. Its like creating a secure connection from your machine to the host machine. Once connection is build, any tool like MYSQL workbench can connect via localhost:<localport> where would forward the connection to remote machine's port.
Please read more about this feature here.
The port forwarding can be setup via any shell client supporting the feature, e.g. in a putty configuration.
Openshift V3 also support port forwarding through its client tool oc
Step wise:
1) Download and install oc tool. Refer here.
2) Once install on your machine (windows/linux), you could use port forwarding feature to access it from local machine.
Please refer openshift document here to setup port forward.
Once port forward is setup, leave the console open on local and try connecting to localhost:<localport> and you should actually get connected to MYSQL on openshift.
Yes, you can do this with port-forwarding:
https://katacoda.com/graham.dumpleton/courses/intro-openshift/port-forwarding

Accessing Google Cloud VM Instance Tomcat using External IP

I am trying to access my Tomcat HomePage which is inside my Google Cloud VM Instance with External IP address 35.189.85.127 and Internal IP 10.154.0.2. On my local machine, in my browser I tried http://35.189.85.127 and http://35.189.85.127:8080 but got error
The connection has timed out. The server at 35.189.85.127 is taking too long to respond.
I have seen all the questions and replies on stackoverflow regarding this question but still I found no clear solution.
The steps that I've done so far:
I have setup a Google Cloud VM instance in Compute Engine. I am using Windows Server 2016 as the image.
Using RDP I log on to Windows Server.
I successfully installed Java 1.7 and Tomcat 7 on Windows Server.
I tested Java and Tomcat 7, both are working fine i.e. I open browser and type localhost:8080 and it shows Tomcat HomePage.
I replaced localhost with my VM Instance Internal IP i.e. 10.154.0.2:8080 and it again correctly shows Tomcat HomePage.
Now I try to access Tomcat HomePage using my VM Instance External IP (Static) 35.189.85.127 but in my browser I get error
The connection has timed out. The server at 35.189.85.127 is taking too long to respond.
Faced the same issue today.
Noticed from your question that you're using an Windows environment.
On Windows
Be sure that the Windows Firewall is properly configured to allow traffic under the ports you need (or deactivate it).
On GCP
Under "VPC Network/Firewall Rules", create a new firewall rule and configure as below:
Firewall Rule Parameters (image)
Or, you have the option to check the "Allow HTTP traffic" option under the Instance Configuration menu and edit Tomcat's server.xml to startup at port 80, as described here:
Change Tomcat Port Tutorial # StackOverflow
Option1: If it's just tomcat. GCP offers a click to launch Tomcat instance with an external IP. You can SSH and also have a temp tomcat username and password to manage any of your deployments.
https://console.cloud.google.com/launcher/details/click-to-deploy-images/tomcat
Option 2:
If you wish to have a Google Cloud VM instance in Compute Engine.
You will need to setup security groups and assign it to your instance.
Eg. Define rules to Open Tomcat port 8080(or any) externally / range. Assign that group/rule to your VM instance.
There are many options available, it all depends on how you wish to organize things. You could create a VPC and add your instances there or keep them under the same subnet or have them accessible externally etc.

How to change host name Glassfish

I have troubles with glassfish server. I have created application in eclipse and war application, copied it to the remote server and delpoyed to glassfish. It recognized this web application and it works if specify url set it manually, by default it has following url
http://ubuntu:8080/TestService/TestServiceProvider?Tester
If set it to my server ip address manually it works great. How can I change ubuntu to my hostname.
Thanks.
You should redirect your domain name to that ip address from your domain management site.
Since you're using HTTP service I'm also assuming you're using virtual servers.
According to glassfish hostname mapping
setting "

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