Show TOC

Procedure documentationRunning the Application Client Locate this document in the navigation structure

Procedure

  1. Implement the starter.

    In the CalculatorServiceClient project, create a new file with the name appclient_starter.xml and paste the following content into this file:

    Syntax Syntax

    1. <?xml version="1.0" encoding="UTF-8"?>
      
      <project name="AppclientRunner" default="execute" basedir=".">
      
      	<property name="engine.install.dir" value="C:/usr/sap" />
      
      	<property name="SID" value="JP1" />
      
      	<property name="JC_NUMBER" value="00" />
      
      	<property name="USERNAME" value="Administrator" />
      
      	<property name="PASSWORD" value="master-password" />
      
      	<property name="JNDI_FACTORY"
      		value="com.sap.engine.services.jndi.InitialContextFactoryImpl" />
      
      	<property name="PROVIDER_URL" value="javaee-host:5${JC_NUMBER}04" />
      
      	<property name="EAR_PROJECT_NAME"
      		value="sap.com/CalculatorServiceEAR" />
      
      	<path id="appclient.class.path">
      
      		<pathelement path="${java.class.path}/" />
      
      		<pathelement
      			path="${engine.install.dir}/${SID}/JC${JC_NUMBER}/j2ee/j2eeclient/sap.com~tc~exception~impl.jar" />
      
      		<pathelement
      			path="${engine.install.dir}/${SID}/JC${JC_NUMBER}/j2ee/j2eeclient/sap.com~tc~logging~java~impl.jar" />
      
      		<pathelement
      			path="${engine.install.dir}/${SID}/JC${JC_NUMBER}/j2ee/j2eeclient/sap.com~tc~je~clientlib~impl.jar" />
      
      		<pathelement
      			path="${engine.install.dir}/${SID}/JC${JC_NUMBER}/j2ee/cluster/bin/ext/ejb_api/lib/ejb-3_0-api.jar" />
      
      		<pathelement
      			path="${engine.install.dir}/${SID}/JC${JC_NUMBER}/j2ee/cluster/bin/services/appclient/lib/private/sap.com~tc~je~appclient~impl.jar" />
      
      		<pathelement location="CalculatorServiceClient.jar" />
      
      		<pathelement
      			location="../CalculatorServiceEjb/CalculatorServiceEjb.jar" />
      
      	</path>
      
      	<target name="execute">
      
      		<java
      			classname="com.sap.engine.services.appclient.client.Launcher"
      			fork="yes">
      			<classpath refid="appclient.class.path" />
      			<arg value="-U${USERNAME}" />
      			<arg value="-P${PASSWORD}" />
      			<arg value="-F${JNDI_FACTORY}" />
      			<arg value="-H${PROVIDER_URL}" />
      			<arg value="-name" />
      			<arg value="${EAR_PROJECT_NAME}" />
      
      		</java>
      
      	</target>
      
      </project>
      
    End of the code.
Configuring the appclient_starter.xml

To execute the script, you have to make the following changes:

Configuration settings

Parameters

Description

engine.install.dir

The location of the AS Java installation directory.

SID

The ID of the installed server (for example: JP1).

JC_NUMBER

The number of the Java instance

(for example: 00).

USERNAME

The name of the user with which the application client will connect to the JNDI service.

PASSWORD

The respective password for USERNAME.

JNDI_FACTORY

The name of the Initial Context Factory implementation that will be used.

PROVIDER_URL

The URL to connect to JNDI. Replace

<javaee-host> in the script with the host name where the application server is installed.

EAR_PROJECT_NAME

The name of the application - it has the following format: <vendor-name>/<ear-project-name>. The <vendor-name> could be changed by modifying META-INF/application-j2ee-engine.xml file in CalculatorServiceEAR project, by default it is sap.com.

  1. Execute the script.

    From the context menu of appclient_starter.xml, choose Run As →Ant Build.

Result

In this tutorial you have learned how to create, implement, deploy and run an application client.