javaibm-midrangeconnectexception

java.netConnectException error when connecting to iSeries with IFSFileInputStream


I have a simple Java program (using JTOpen) to connect to an iSeries and open a IFS file:

System.out.println("by ipaddress");
AS400 as400 = new AS400("130.3.3.333", "user", "password");
System.out.println("as400 connected? = " + as400.getCcsid());
//handle the exception if the file is null 
IFSFileInputStream as400File = new IFSFileInputStream(as400, "//PDF//00000104.PDF");
System.out.println("is available" + as400File.getPath());
as400File.close();

On one server in DMZ everything works fine but on a (supposedly identical) VM image on a server in a different building (still in DMZ) I get an error:

by ipaddress
as400 connected? = 37
IO security exception
java.net.ConnectException: Connection timed out: connect
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.PlainSocketImpl.doConnect(Unknown Source)
    at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
    at java.net.PlainSocketImpl.connect(Unknown Source)
    at java.net.SocksSocketImpl.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.connect(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at java.net.Socket.<init>(Unknown Source)
    at com.ibm.as400.access.PortMapper.getServerSocket(PortMapper.java:170)
    at com.ibm.as400.access.AS400ImplRemote.getConnection(AS400ImplRemote.ja
va:975)
    at com.ibm.as400.access.AS400ImplRemote.connect(AS400ImplRemote.java:390
)
    at com.ibm.as400.access.AS400.connectService(AS400.java:870)
    at com.ibm.as400.access.IFSFileInputStream.connectAndOpen(IFSFileInputSt
ream.java:416)
    at com.ibm.as400.access.IFSFileInputStream.<init>(IFSFileInputStream.jav
a:150)
    at com.ibm.as400.access.IFSFileInputStream.<init>(IFSFileInputStream.jav

The connection works fine but then get a connect exception.

Any ideas welcome. Same ports are open in the firewall between both servers to the iSeries.


Solution

  • There are multiple services each on their individual port and the initial connect only opens one. Check the jt400 faq for the file service. I expect this port to be unopened in the firewall.