To deploy a SAP Java application like Web Dynpro Java or SAP Portal application, tools like NWDS, NWDI or telnet are used. This is a very SAP centric setup. But how can you deploy a WDJ application without using NWDI, NWDS, telnet or direct server access? What if you want to deploy it out of your continuous integration (CI) server?

EAR, SDA, WAR, PAR, SCA?

First question to ask and to answer is: what file can be deployed? Normally, SAP Java applications are in SCA or SDA format. Standalone WDJ applications are EAR and portal files are SDA. The good news is that they are ZIP files. The portal SDA is basically the old PAR file renamed to SDA and WDJ EAR files are … EAR files. NWDS will create the files correctly, it’s just picking these files up – or create them manually – and deploy them to NW Java.

The tools

This folder and therefore the tools are gone in newer NWDS versions. Basically, there are no client side tools provided by SAP to deploy an application without using a SAP tool. The SAP Note 1715441 contains all the information regarding on how to deploy an application. It contains one entry about a deployment script:

Using filesystem deployment script

Open the “deployment script” folder located in /usr/sap/<SID>/J<nr>/j2ee/deployment/scripts.

There is an ant directory with an example ant build file. You can take this script and try it out to see if it matches your needs. In my case it didn’t. The SAP Note mentions a script directory; let’s take a look at it:

Running the deploy.csh script shows the application help.

Doing a deploy from the cmd line on the server:

Great, it works! But only from the server. What about freedom and deploy WDJ / Portal applications from your CI?

Java version

A look inside the file reveals that deploy.csh is a wrapper for calling a Java application. To be able to trigger a deploy from anywhere you want, all it takes is a Java application with the required JAR files. All the JAR files can be found in the deployment dir:

/usr/sap/<SID>/J<nr>/j2ee/deployment

/usr/sap/<SID>/J<nr>/j2ee/j2eeclient

The JAR files are:

lib/javaee_deployment-1_2-fr-class.jar

lib/sap.com~tc~je~deployment14~impl.jar

/lib/ant.jar

/lib/sap.com~tc~bl~jarsap~impl.jar

/lib/sap.com~tc~sapxmltoolkit~sapxmltoolkit.jar

/lib/sap.com~tc~bl~sl~utility~impl.jar

/lib/sap.com~tc~je~adminadapter~impl.jar

/lib/deploy_lib~sda.jar

/j2eeclient/sap.com~tc~je~clientlib~impl.jar

/j2eeclient/sap.com~tc~logging~java~impl.jar

/j2eeclient/sap.com~tc~exception~impl.jar

The Java class to call is

com.sap.engine.deployment.DMClient

Copy these files to a lib directory on the computer from where the deploy will be done. The command to do a deploy of a custom EAR file from command line using Java is:

This allows to deploy a EAR, SDA file out of your CI server. After a build the application can be deployed and the functional / load test can be run and integrated into the overall CI job run result. Transparency for your SAP Java projects.

Remark

A problem is – unfortunately – that the Java program does always return a successful execution as long as the application does not hit an error in the execution flow; like: logon not possible, missing EAR file. When the deploy returns an error, the application still returns success to the ant task, as the execution steps of the deploy application worked. To report a build failure on a failed server side deploy you’ll have to check the logs.