cancel
Showing results for 
Search instead for 
Did you mean: 

Open Socket Connection in Java Proxy

Former Member
0 Kudos

Hi Gurus!!

I´m trying to open a socket connection from a Java Proxy. This is my code.

Socket sock = null;

PrintWriter out = null;

BufferedReader in = null;

String host = "FESRV028";

int destPort = 10006;

InetAddress destAddr = null;

try {

sock = new Socket("FESRV029", 10006);

} catch (IOException e) {

e.printStackTrace();

throw new RuntimeException(e);

}

I get the error "java.net.ConnectException: Connection refused".

Is neccesary some type of authetication with the server which we want to connect?? Somebody knows what could be the cause of this error?

Thanks and regards,

Manuel Míguez.

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

EJB classes are not allowed to open sockets directly. This is a general restriction of EJB.

Regards

Stefab

Former Member
0 Kudos

Hi Stefan,

This is a very bad new.

I have tested with another ip and port, and the error doesn´t occur, I get a empty response, because the data of the request is not real.

Is this normal or should I get a "Connection refused" error too?

Thanks and regards,

Manuel Míguez.

Former Member
0 Kudos

Hi,

The problem was the service of the IP and Port was down.

I have solved the problem.

Thanks and regards,

Manuel.

0 Kudos

Hi Manuel,

There are 2 possible causes of this error as far as I can see. 1) no service is listening on port 10006 of server FESRV028, or 2) something (e.g. a firewall) is blocking the connection between your Java proxy and FESRV028.

Regards,

Thorsten

Former Member
0 Kudos

Hi Thorsten,

Is very strange because I have done a ping from my XID server (server where the Java Proxy is deployed) to the server FESRV028 with port 10006 and the result is ok. And is supposed that the server doesn´t have any security enabled.

I don´t know if the server recquires any authentication. Do you know if this is possible?

Thanks and regards,

Manuel Míguez.