Skip to Main Content

Java SE (Java Platform, Standard Edition)

using cygwin inetd to start a script on a server to run a java application

2687896Jun 5 2014

Hi, I am following the oracle doc

http://docs.oracle.com/javase/7/docs/technotes/guides/rmi/inetd/launch-service.html (solaris specific)

I have two windows 2012 server VMs (firewalls off). I believe that I have configured cygwin inetd correctly by following the directions in

C:\cygwin64\usr\share\doc\Cygwin\inetutils-server.README, running /usr/bin/iu-config using values ntsec and creating user cyg_server on the server. I start and stop inetd using cygrunsrv -S inetd and cygrunsrv -E inetd. I have cygwin inetd ftp working on the machines.

What I am trying to do is to get the client to call an inetd service on the server which in turn runs a script on the server which sets up the environment and calls a java class called "Server".

My C:\cygwin64\etc\inetd.config on the server

ftp     stream  tcp     nowait  annie    /usr/sbin/ftpd ftpd

example-server    stream    tcp    wait    cyg_server    /nms/bin/test/test    test  

c:\windows\system32\drivers\etc\services on the server

example-server    9999/tcp

i think the hosts file on both the server and the client is corrently configured because ftp between the client and the server works

the test script on the client sets up the environment and then calls

/cygdrive/c/Apps/Java/jdk1.7.0_51/bin/java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Addresses=true -classpath c:\\cygwin64\\nms\\bin jmini.nms.console.inetd.Server 9999 &> /tmp/tmp.dat

Using Process Explorer I can see the client calling the cygwin inetd service, and a java exe being created. The Server code is called but the client timesout.

tmp.dat on the server contains

proxy Proxy[ServiceInterface,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[192.168.100.10:57036](local),objID:[27e13e26:14662d7e06e:-7fff, -976951803438894493]]]]]

server: failed to initialize registry proxy Proxy[ServiceInterface,RemoteObjectInvocationHandler[UnicastRef [liveRef: [endpoint:[192.168.100.10:57036](local),objID:[27e13e26:14662d7e06e:-7fff, -976951803438894493]]]]] on port 9999

Exception java.net.BindException: Address already in use: JVM_Bind

Looking at TCP view on start up there are two inetd processes, the ftp process (port 21) and the example-server (port 9999) process. when i start the client there are three inetd processes, the ftp process (port 21),  the example-server (port 9999) process remote address the server, and the example-server (port 9999) process remote address the client. the java process starts on a port that is not shared with any other process.

and the client dies with a java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:

     java.net.SocketTimeoutException: Read timed out

My questions are can you see how I have misconfigured this? Have you got a cygwin inetd process running a script/ java process and could you share the secret sauce with me?

Thank you in advance

Annie

Post Details
Locked on Jul 3 2014
Added on Jun 5 2014
0 comments
1,513 views