Jump to content

[Solved] Java Servlet - Connection Refused


kidhack

Recommended Posts

Hi, I created a java servlet to download a m3u file and manage the records. A exception is thrown when I try to download the URL. The URL is correct and the servlet runs successfull in others platforms:

 

java.net.ConnectException: Connection refused (Connection refused)

java.net.PlainSocketImpl.socketConnect(Native Method)

java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)

java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)

java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)

java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)

java.net.Socket.connect(Socket.java:589)

java.net.Socket.connect(Socket.java:538)

sun.net.NetworkClient.doConnect(NetworkClient.java:180)

sun.net.www.http.HttpClient.openServer(HttpClient.java:463)

sun.net.www.http.HttpClient.openServer(HttpClient.java:558)

sun.net.www.http.HttpClient.<init>(HttpClient.java:242)

sun.net.www.http.HttpClient.New(HttpClient.java:339)

sun.net.www.http.HttpClient.New(HttpClient.java:357)

sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:1202)

sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1138)

sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1032)

sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:966)

sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1546)

sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474)

java.net.URL.openStream(URL.java:1045)

com.avz.servlets.MainServlet.generateTVFile(MainServlet.java:313)

com.avz.servlets.MainServlet.doGet(MainServlet.java:54)

javax.servlet.http.HttpServlet.service(HttpServlet.java:622)

javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)

Link to comment
Share on other sites

Thanks but my incoming port is 80, I need that the servlet can call outputs URLs that have 8000 as port... The thread that you indicates to me is to set a different port in the incoming calls?
BufferedReader in = new BufferedReader(new InputStreamReader(m3uUrl.openStream(), StandardCharsets.UTF_8));

 

This code fails in the first second line trying access to the m3uUrl. I don't know if the thread can help me or only refers to the incoming port.

 

Thanks a lot

Link to comment
Share on other sites

It sounds like you need an outbound port not that your socket is listening on port 8000 like I thought. I see that you're connecting to a dynamic dns domain which is probably a home computer. Can you change the port 8000 to something else?

Link to comment
Share on other sites

I cant change the port, the server is a IP TV service that I hired and return a m3u file that I need download in my servlet.

 

Is not possible to open the 8000 port for outgoing connections?

 

I found this related thread and I think that you solved it😁:

 

https://www.helionet.org/index/topic/11996-a-module-in-my-joomla-webpage-on-heliohost-needs-access-to-tcp-port-8000/

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...