JRebel Remoting can be used to update applications deployed to SAP NetWeaver Cloud. This means that you only have to deploy the application once and then keep on updating it in Eclipse (soon with IntelliJ as well) without restarts using the JRebel Remoting IDE plugin. SAP NetWeaver Cloud supports deployment of Java EE 6 Web profile WAR files and OSGi bundles. In order to enable JRebel, it has to be wrapped in a self-extracting OSGi bundle (don’t panic – we’ll show you how). The next step is deploying it together with the application WAR(s).

Creating the Bundle

The first step is to place a jrebel.jar (use the latest nightly build at the moment) in an empty folder. You can download the nightly build from the JRebel early access page and you’ll get the license file when you apply for an evaluation licence. The second step is turning these artifacts into an OSGi bundle. You need a META-INF folder containing MANIFEST.MF file with the following content to do that:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JRebel Wrapper
Bundle-SymbolicName: jrebel.wrapper
Bundle-Version: 1.0.0

Make sure there is an empty line at the end of the manifest file! Finally, create a p2.inf file in the same META-INF folder to make it a self extracting bundle. The file needs to have the following content:
org.eclipse.equinox.p2.touchpoint.natives.unzip(source:@artifact, target:${installFolder});
Finally, zip up the folder into a jar file. Its contents should look like this:
-- jrebel.wrapper_1.0.0.jar
|  |-- p2.inf
That’s it! You have a self-extracting JRebel OSGi wrapper-bundle. Now it has to be placed in the same folder with all the wonderful applications which will be deployed to SAP NetWeaver Cloud. Ideally this has to look like:
-- Deploy_folder
|--application2.war (Optional)
|--application3.war (Optional)

Uploading the Bundle

There are several ways to throw that pile of software over the fence to SAP NetWeaver Cloud. Ironically – all of them involve using the Neo Console Client. Prerequisites to deploy an application are:
  1. you have an account at SAP NetWeaver Cloud, create a free perpetual developer account over right now!
  2. you have to download the SAP NetWeaver Cloud SDK and extracted it locally.
  3. your apps + JRebel are placed in a deployment folder

Manually specify all the options

Go to Neo_SDK\tools folder and execute the following command:
neo deploy -s <FOLDER CONTAINING JREBEL WRAPPER + WAR FILES> --account <YOUR ACCOUNT> --application <APPLICATION NAME> --host hanatrial.ondemand.com --user <YOUR P/S USER> --vm-arguments "-javaagent:jrebel.jar -Drebel.remoting_plugin=true -Drebel.remoting.sapAuthenticator=true"

Save options in a property file

You can also save all those settings in one properties file and reuse it for future operations. The properties file will have the following content:
account=<YOUR ACCOUNT>
application=<APPLICATION NAME>
user=<YOUR P/S USER>
vm-arguments=-javaagent:./jrebel.jar -Drebel.remoting_plugin=true -Drebel.remoting.sapAuthenticator=true
The call to the SAP NetWeaver Cloud Console Client afterwards looks much more streamlined:
neo deploy <PROPERTIES_FILE>
The result in both cases will be the same – you’ll see an output like this:
Requesting deployment for:
application    : hellojrebel
account        : p1234566789trial
source         : /usr/gosho/all_my_precious_apps
vm arguments   : -javaagent:jrebel.jar -Drebel.remoting_plugin=true -Drebel.remoting.sapAuthenticator=true
elasticity data: [1 .. 1]
severity       : ERROR
host           :<a href="https://netweaver.ondemand.com"> https://hanatrial.ondemand.com</a>
SDK version    : 1.13.1
user           : p1234566789
Password for your user:
Deployment finished successfully.
The only thing remaining afterwards is to start your application by calling neo start or using the start button at your SAP NetWeaver Cloud Account page.  With that – your application is JRebel-enabled and ready to be rapidly developed! Once you have the application running, copy-paste its URL from the browser’s address bar to JRebel Advanced properties window. Don’t forget to enable HTTP Authentication and provide your SCN login details when they are prompted for. Any comments? Any problems? You can visit the JRebel Forum or shoot us an email at support@zeroturnaround.com.