Deploy the Java Interface

Walks you through the steps required to associate an enterprise server instance with your project, build the project, set deployment properties, deploy the service interface, and verify the deployment results.
Restriction: This topic applies only when the Enterprise Server feature is enabled.

To successfully deploy a Java service interface to an enterprise server instance, you need to first set some options in Visual COBOL.

Build the ProgramEJB Project

You need to build the project to generate all required deployment files.

  • On the Solution Explorer, right-click the ProgramEJB project; then click Build.

Set Deployment Properties

To ensure that the deployment process runs smoothly, you must set some options that tell Visual COBOL what application server to use and where to find certain files.

  1. From the Solution Explorer, click the AccessBooks service interface.

    This activates the Properties window for the AccessBooks service interface.

  2. In the Properties window, ensure that the Interface type property is set to Java Interface (default).
  3. Click the Application files to deploy field, and then click its corresponding browse button Browse button.
  4. On the Add/Remove Items dialog box, use the click Add Files button to add the following files:
    File Project Folder
    bookfile.dat ProgramEJB
    bookfile.idx ProgramEJB
    book.dll ProgramEJB > bin > x86 > Debug
  5. When all three files have been added, click OK.

    These files are copied to the enterprise server instance when you deploy. The .dat and .idx files are the data and index parts of the indexed file accessed by the service. The .dll is the executable file you need to debug the service.

  6. In the Properties window, set the Application server to JBoss EAP 7.1 (Java7).
    Now you need to add three EJB connector class files to the Classpath, one each for the Java EJB, resource, and servlet files. Each file resides in %JBOSS_HOME%\modules\system\layers\base\javax\connector_class\api\main where connector_class represents EJB, resource, or servlet respectively. The file names are:
    Filename Connector class type
    jboss-ejb-api_3.2_spec-1.0.0.Final-redhat-1.jar EJB
    jboss-connector-api_1.7_spec-1.0.0.Final-redhat-1.jar resource
    jboss-servlet-api_3.1_spec-1.0.0.Final-redhat-1.jar servlet
  7. Add each connector class file to the Classpath as follows:
    1. On the Properties window, click the Browse button that corresponds to the Classpath field.
    2. Navigate to the %JBOSS_HOME%\modules\system\layers\base\javax\connector_class\api\main directory that corresponds to the connector class file you want to add.
    3. Double-click the file you want to add.
    4. Repeat this sequence until all three files are added.
  8. In the same manner as the previous step, add the javac.exe file in your %JAVA_HOME%\bin directory to the Classpath.
  9. Click OK.

Associate the ESDEMO Enterprise Server Instance

You need to associate the ESDEMO enterprise server instance with your ProgramEJB project:

  1. From Server Explorer, expand localhost under Micro Focus Servers to see a list of available enterprise server instances.
  2. Right-click ESDEMO; then click Associate with Project > ProgramEJB.

Stop Enterprise Server Instances

To ensure that your enterprise server instance does not encounter any port conflicts with other enterprise server instances that use the same listener port, stop all started enterprise server instances as follows:

  1. From the Server Explorer, expand localhost under Micro Focus Servers to see a list of enterprise server instances.
  2. Right-click each started enterprise server instance, and stop it by selecting Stop from the context menu. Started enterprise server instances show with a green icon Started enterprise server instance.

Start the ESDEMO Enterprise Server Instance

Before deploying your service interface, you must start the ESDEMO instance where the AccessBooks service will run.

  1. From the Server Explorer, expand localhost under Micro Focus Servers to see a list of available enterprise server instances.
  2. To start the ESDEMO enterprise server instance, right-click it; then click Start.
    Note: If this is the first time you have started the server you see a sign-on dialog box. If Server is secured is checked, uncheck it; then click OK. Unchecking Server is secured prevents this dialog box from showing when you subsequently start the region. If Server is secured is not checked, simply click OK to clear the dialog box.

The Enterprise Server Console Daemon is then invoked, starting the enterprise server instance.

Deploy the AccessBooks Java interface

  1. From the Solution Explorer, right-click the AccessBooks service interface; then click Deploy.

The Output window shows the progression of the deployment process. If deployment was successful, you should see a message indicating success.

If deployment ever fails, you should find a message in the output window indicating why it failed. Also, the failure message contains the path to the deployment log file. You can type the address into a browser and view the log file from there.

View deployment results

Now that your service interface has been deployed as a service running on the ESDEMO enterprise server, you can look at the details of the deployed service Enterprise Server Administration page.

  1. If Enterprise Server Administration is not showing in Visual Studio, start it as follows:
    1. From the Server Explorer in Visual COBOL, right-click Micro Focus Servers; then click Administration.

      The Enterprise Server Administration Home page starts in an Visual COBOL window.

    In the row showing information for the ESDEMO enterprise server, you should see that the Objects column shows the number of services that this enterprise server runs. In this case, the number of running services should be at least 9. These are the five that come standard with the ESDEMO enterprise server, plus the one service you added containing four operations. You might see more if you have deployed other services to the ESDEMO enterprise server.

  2. Click the Details button for the ESDEMO Services.

    In the row showing your new service, AccessBooks, you see that the Current Status column shows all four operations as Available. This means that the service is ready to be accessed.