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:
<?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/ejb-3_0-api.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>
|
Do not forget to specify the “master-password” and the “javaee-host:”.
Configuration settings
Parameters |
Description |
engine.install.dir |
The location of the plugins directory of SAP NetWeaver Developer Studio |
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. Please change <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. |
2. Execute the script
From the context menu of appclient_starter.xml, choose Run As → Ant Build.
In this tutorial you have learned how to create, implement, deploy and run an application client.