Search This Blog

Wednesday, February 22, 2012

JVM COBOL within Apache Tomcat

After installing the micro focus product , we needed to use the Java to Cobol calls.
our java code is running within tomcat 5.5.X via JVM 5.
using microfoucus jar files is not enoght  .. i get the next error

Micro Focus COBOL Runtime Support for Java is preventing this application from executing because an internal Java property is not setup. Reason: Application should use "cobjrun" to execute this application instead of the default "java" trigger

i knew that i need to use cobjrun as my running process and not just java runtime.
based on this article Running JVM COBOL within Apache Tomcat: i started .
in the end i managed to make such call.
the only changes i needed are:

in the file setclasspath.sh .. i changed the _RUNJAVA env .
_RUNJAVA=/opt/microfocus/cobol/bin/cobjrun32

in the file catalina.sh  i add the next env settings

#yaniv add
COBDIR=/opt/microfocus/cobol/
COBJVM=sun_150
LD_LIBRARY_PATH=/opt/microfocus/cobol/lib/:/usr/java/jre/lib/sparc:/usr/java/jre/lib/sparc/client:/usr/java/jre/lib/sparc/native_threads:$LD_LIBRARY_PATH
PATH=/opt/microfocus/cobol/lib/:/usr/java/jre/sh:/usr/java/sh:/usr/java/bin:/usr/java/jre/bin:$PATH
CLASSPATH=/opt/microfocus/cobol/lib/mfcobol.jar:.:/usr/java/jre/lib/rt.jar:/opt/microfocus/cobol/lib/mfimtk.jar:/opt/microfocus/cobol/lib/xerces.jar:/opt/microfocus/cobol/lib/castor-0_9_4_1-xml.jar:/opt/microfocus/cobol/lib/mfcobol.jar:.:/usr/java/jre/lib/rt.jar:/opt/
COBCPY=/opt/microfocus/cobol/cpylib:$COBCPY
export COBDIR
export COBJVM
export LD_LIBRARY_PATH
export PATH
export CLASSPATH
export COBCPY

restart your tomcat .. and enjoy
Yaniv Tzanany

No comments: