Getting java.net.UnknownHostException but pinging the address works - java

I'm writing an application in Scala that is using the java HttpClient to try to connect to a url, however I keep on getting the error ERROR Catching java.net.UnknownHostException: my.address.com. The tests are being run using sbt in the terminal on Ubuntu, and when I ping the host from the same location it is able to resolve the ip.
Does anyone have a suggestion of why pinging the host works but my application can't find it?

Related

Connection refused when using curl?

I am on a mac and am building a java spring boot project by following this tutorial:
https://spring.io/guides/tutorials/react-and-spring-data-rest/
However when I try to access the api through this command:
curl localhost:8080/api
I get the following message
Failed to connect to localhost port 8080: Connection refused
I'm not sure what the problem is! Grateful for your help,
Many thanks,

java.net.UnknownHostException when accessing through https

I am getting java.net.UnknownHostException while executing this particular line of code:
int status = client.executeMethod(method);
where client is an HttpClient object.
Could someone get me solution, please?
I had searched for this problem and I got some comments related to network proxy server settings.
By the way I am able to access the server site throw a web browser.
share you source code and full error logs, but java.net.UnknownHostException Exception Thrown to indicate : IP address or host or url could not be determine.
This exception occurring because your internet is not working properly or host URL or ip is not valid. try to ping your host.

Could not Connect User to Service in Android Studio

I am using Android Studio 2.3. When I am attaching my Moto G4 to debug an application, it ends up with the following error in Android Monitor.
6333-7189/? I/XMPPConnection: Preparing to connect user 1576857969013772288 to service: on host: and port: 0
03-25 11:06:18.221 6333-7189/? E/XMPPConnectionManager: Failed to connect user '1576857969013772288' to host ' on port 0: XMPPError connecting to :0.: remote-server-error(502) XMPPError connecting to :0.
-- caused by: java.net.ConnectException: Connection refused
After this error, no further logs are captured even in verbose mode.
Check below Links:
https://stackoverflow.com/a/6876306/3992798
I am having a similar problem.
I have an application running on Websphere 7 Dev environment
http://appl.company.com/appl/home.action
And also on my localhost system
http://localhost/appl/home.action
I am trying to access a URL like below
http://appl.company.com/SiteContent/a.html from the above application
It works perfectly fine on my local system.
But on the development environment, on this particular line :-
String stream = (new java.net.URL(url)).openStream();
I am getting a "java.net.ConnectException: Connection refused" exception
On googling i figured, such problems are either due to one of the following
The port is wrong (cannot be this option, as same url running perfectly from local system)
Firewall is stopping it.
The Android SDK, do you config the path?
try to it what open a cmd window,input 'adb devices',see result waht display a device of you Moto

Facing issue with ionic web-socket connection with java socket server

I am facing issue with websocket on Ionic
connection with "ionic serve" working perfect. but when i try with "ionic run android"(which is connected with WiFi) getting below given error.
"WebSocket connection to 'ws://192.168.1.7:8086/wsConn' failed: Error in connection establishment: net::ERR_CONNECTION_TIMED_OUT"
"192.168.1.7" is my server ip address.
I tested server running on window 10 and window server 2012 both.
tried with turning off server firewall also.
Can anyone help me on this ?

Remote debugging from eclipse

I am trying to remote a debug an application which is deployed through Websphere. I have all the port configured correctly on server side and on eclipse side. I can use
telnet host port
to connect to remote host and port correctly. But When I try to connect through remote debug through eclipse, I run into the error
Failed to connect to remote VM
com.sun.jdi.connect.spi.ClosedConnectionException
What can be the possible causes for this? I have checked and searched Stackoverflow for this error already. I have tried the most things from answer on this question Eclipse Error: "Failed to connect to remote VM"
I changed the port and it worked. It was a networking issue with that port of 7777.

Categories