Hi. I am attempting to make a webservice connection that we used to have working. But something has changed *somewhere*.
So I am back to testing a basic connection and even that is now giving me issues....( see code below )
java.net.ConnectException: Connection refused (Connection refused) <--- Yes I have googled this error and gone through the list of possible causes.
I CAN use java sockets and connect to google, can ping Google for example... etc.
BUT this webservice domain btw has three parts.... so when I hit the webservice it looks like this. "https://app.edgtechnology.com/api/list/1/1/" Which I can browse to with Firefox and see the json. But cannot PING the same url from command line.
The below code fails. Just like the code that used to work connecting to the webservice now instantly fails..... as if the command to go out onto the internet were being blocked.
I have turned off firewalls, tried https, changed Java security settings but to no avail! I could very well be missing something basic, but have no idea.
I am on OSX using Java 1.8.0_341-b10
--- CODE ---
URL url22 = new URL("http://www.someurl.com");
HttpURLConnection urlConnect = (HttpURLConnection) url22.openConnection();
// trying to retrieve data from the source. If offline, this line will fail:
Object objData = urlConnect.getContent(); // <---- connection refused error
--- Update ---
Exception in thread "main" java.net.ConnectException: Connection refused (Connection refused)
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(Abstrac tPlainSocketImpl.java:476)
at java.net.AbstractPlainSocketImpl.connectToAddress( AbstractPlainSocketImpl.java:218)
at java.net.AbstractPlainSocketImpl.connect(AbstractP lainSocketImpl.java:200)
at java.net.Socket.connect(Socket.java:606)
at java.net.Socket.connect(Socket.java:555)
at sun.net.NetworkClient.doConnect(NetworkClient.java :180)
at sun.net.http://www.http.HttpClient.openServe...ient.java:499)
at sun.net.www.http.HttpClient$1.run(HttpClient.java: 551)
at sun.net.www.http.HttpClient$1.run(HttpClient.java: 549)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.http://www.http.HttpClient.privilege...ient.java:548)
at sun.net.http://www.http.HttpClient.openServe...ient.java:589)
at sun.net.www.http.HttpClient.<init>(HttpClient.java :278)
at sun.net.www.http.HttpClient.New(HttpClient.java:375)
at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1247)
at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1194)
at sun.net.http://www.protocol.http.HttpURLConn...ion.java:1061)
at sun.net.http://www.protocol.http.HttpURLConn...tion.java:995)