CustomRecord and Other Java Support

If your EJB or Java bean uses custom records you need to make sure that support for them is available. Custom records are created if you map COBOL group items onto Java data types. You map group items in the Interface Mapper whenever you set up Reusable Mappings for group items and you then make those group items into complex interface fields.

For Java beans, support for the CustomRecord and the RuntimeProperties interfaces is provided in mfj2se.jar, which is supplied in %ProgramFiles(x86)%\Micro Focus\Visual COBOL\javaee\common (Windows) or $COBDIR/javaee/common (UNIX) . This support must be available at run time, and you can ensure this by putting mfj2se.jar on the classpath. For example, you could run your application with this command:

Windows:

java –classpath class-directory\mfj2se.jar myProgram.class

UNIX:

java –classpath class-directory/mfj2se.jar myProgram.class

For EJBs, support for the CustomRecord and the RuntimeProperties interfaces is provided in mfejblib.jar. This support is automatically included in the application .ear file when you generate a client for the EJB. When the Deploy tool creates the EJB, it adds a manifest file manifest.mf to the .jar file, and in that manifest file it sets the classpath to mfejblib.jar.

If you create a client manually, you need to manually add the provided mfejblib.jar to your .ear file. The mfejblib.jar for your application server is located by default in the application-server-specific subdirectory under %ProgramFiles(x86)%\Micro Focus\Visual COBOL\javaee\javaee7\appsrv (Windows) or $COBDIR/javaee/javaee7/appsrv (UNIX) directory, where appsrv represents a subdirectory named for your Java application server and, in some cases, the version as well. For a list of supported application servers, see the Java Application Servers section of the Supported Operating Systems and Third-party Software topic..

We recommend that you put mfejblib.jar in the root of the .ear file, as this is the default location used by the classpath defined in the EJB's manifest.mf file.

You can view the manifest.mf manifest file by extracting it from the EJB's archive file, myservice.jar, which is in myproject\Repos\.deploymyservice (Windows) or myproject/Repos/myservice.deploy (UNIX). Notice that the classpath is set as follows:

Class-path: mfejblib.jar

If you require mfejblib.jar to be elsewhere, you need to change the classpath in manifest.mf in the EJB's .jar file accordingly.