[Migrated content. Thread originally posted on 21 August 2007]
Hi there folks.I'm trying to integrate software written in Java (my fluent language) with AcuCOBOL. Our company is currently using AcuCOBOL version 7.2 targeting Windows, Unix and Linux. We've made a few attempts using the CVM, but though it works as advertised on Windows, it seems to throw up some issues under Unix.
So I've implemented a lower-level solution which requires using C$SOCKET to create a server socket. The java software runs within Tomcat (deployed as a JNDI resource and consumed by web applications), and this kicks off the COBOL program (JSRVSOCK) containing the C$SOCKET call in a separate process :-
Process p = Runtime.getRuntime().exec( "runcbl -b JSRVSOCK" );The problem is that this requires the COBOL to do something like this :-
CALL "C$SLEEP" USING 3.before doing the C$SOCKET call to create the server socket, otherwise the socket fails to materialise failing with an AGS-EADDRINUSE error, even though a netstat shows that the chosen port is unused. The C$SLEEP makes it work as long as the process is kicked off as Tomcat is started. If the process is kicked off at some later point, during some web application activity for example, the socket creation fails regardless.
If the runcbl -b JSRVSOCK is executed at a Unix command prompt, the socket creates okay.
If the java Runtime exec is done from within a small test java program, again the socket creates okay.
Has anybody seen this behaviour before, or can offer any insight which might explain this unusual behaviour? Thanks in advance.
Tim



