Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

NoRouteToHostException  RSS feed

 
Erik Lindholm
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello.
I have made a class for sending a file (FTP) in IBM Visual Age for Java. This works just fine when I run this as a batch application from VAJ ("Run batch ..").
When I call the same class from a Servlet I get the java.net. NoRouteToHostException. I run this from the Websphere Test Environment (WTE).
I am just FTP'ing within my own computer with the nodename "oemcomputer" and port=21. No firewalls.
This is the statements that gives the exeception:
private Socket csock = null;
private static final int CNTRL_PORT = 21;
private String server = "oemcomputer";
csock = new Socket(server, CNTRL_PORT);//<======
Should I do this different when I am starting this from a servlet or does this have to do with the WTE ?
 
Erik Lindholm
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found out of this myself.
In the servlet I initiated my FTP-bean by using the class-loader like this:
FtpBean=(mypackage.FtpBean)
java.beans.Beans.instantiate(getClass
().getClassLoader
(),"mypackage.FtpBean");
When I made the initiation like this it worked:
FtpBean = new mypackage.FtpBean();
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!