Accueil > Eclipse RAP, Libra, WAR Product > Create a WAR from RAP Application with Libra WAR Product [step3]

Create a WAR from RAP Application with Libra WAR Product [step3]

In [step2] we have created WAR Product files from RAP launches. In this article we will generate WAR by using the export WAR feature of the WAR Product to generates two WARs:

We will deploy generated WARs in a non OSGi HTTP Server Apache Tomcat. You can see the online demo of the rap-jpa.war created with WAR Product deployed on CloudBees which provides an Apache Tomcat at

We will see in this article that projects of contains 2 problems when WAR will be exported and deployed:

  • .qualifier must not used in the Host of fragments.
  • pay attention with of Plug-in /Fragments which must include the whole files (META-INF, fragment.xml, plugin.xml, etc).

Those 2 errors are interesting because it works with RAP launch but not with WAR Product.


WAR Products

You can download which contains the two WAR Products created in this article.


Create WAR rap-jpa.war of « RAP Client – JPA Dao »

In this section we use the features of WAR Product Editor to create the rap-jpa.war WAR. To do that Open the rap-jpa.warproduct with the WAR Product Editor.

Validate WAR product

Before creating WAR, click on Validate WAR product menu item to check you have not problem with Plug-Ins/Fragments of the WAR Product:

Export WAR product

If you have none errors, we can start exporting the WAR. To do that, click on Export WAR product menu item:

This action opens the Export dialog :

  • choose the file name of the generated WAR (here we will export WAR to generate the C:\rap-jpa.war).
  • select the « Allow for binary cycles in target platform » checkbox.

NOTE: here My WAR Product is used and display a checkbox « Allow for binary cycles in target platform » which is required to fix problem with cycle that we have with Spring.

Click on Finish button which starts the export of the WAR, but it fails with this error:

This error is interesting because this problem doesn’t occur when RAP launch is used. The problem comes from the OSGi Fragment fr.opensagres.dao.jpa.eclipselink
linked to OSGI bundle fr.opensagres.dao.jpa which defines version with .qualifier. The OSGi Fragment fr.opensagres.dao.jpa.eclipselink
uses the .qualifier at this step:

Remove the .qualifier used in the OSGi Fragment fr.opensagres.dao.jpa.eclipselink for Hosts:

Export the WAR, and you will see that rap-jpa.war will be generated with success.

Test WAR rap-jpa.war

At this step we can test our WAR. In my case, I have tested the WAR with Apache Tomcat and follow thoses steps:

  • Install Tomcat.
  • Copy/paste the rap-jpa.war in the webapps folder of the root of the Tomcat.
  • Start the Tomcat on the 8080 port by using the bin/startup.bat (or

build.propertries problem

Once the HTTP Server has deployed the war, tries to go to the URL, but you will have this 404 error:

But if you go at it works:

It means that the eclipsespring servlet that we have defined in the fragment.xml of the bundle fr.opensagres.richclient.config.rap is not used:

         title="RAP Application"

If you unzip the JAR of the rap-jpa/WEB-INF/plugins/fr.opensagres.richclient.config.rap you will see that fragment.xml doesn’t exists. The reason of that
is that of the fr.opensagres.richclient.config.rap bundle, doesn’t include the fragment.xml.

To resolve this problem, open the MANIFEST-MF of this bundle, go to the Build tab and select fragment.xml :

Rebuild the WAR and deploy it.

URL and branding

As we use the Plug-In in the WAR Product, we can benefit from branding features of RAP which provides several themes.

Custom branding

Now if you go to the URL, you will see:

You can test that with online demo at

RAP branding

if you go to the URL, you will see:

You can test that with online demo at

Fancy branding

if you go to the URL, you will see:

You can test that with online demo at

Business branding

if you go to the URL, you will see:

You can test that with online demo at

Create WAR rap-mock.war of « RAP Client – Mock Dao »

You can generate the rap-mock.war with the rap-mock.warproduct by exporting the WAR like explained below.

OSGi console

With WAR Product, HTTP Server starts the OSGi container. Is it possible to access to the OSGi console? The answer is yes. You must just configure web.xml to tell to the ServletBridge servlet which starts the OSGi container that OSGi console must be available by adding -console in the commandline.

      <param-value>-registryMultiLanguage -console -ws rap</param-value>     

When you will start the bin/startup.bat, you will see some Tomcat logs and OSGi console will be launched too.


In this article we have exported the WAR from WAR Product to generate WAR. We have seen how it’s very easy to generate WAR from RAP launches.

Catégories :Eclipse RAP, Libra, WAR Product

Votre commentaire

Entrez vos coordonnées ci-dessous ou cliquez sur une icône pour vous connecter:


Vous commentez à l’aide de votre compte Déconnexion /  Changer )

Photo Facebook

Vous commentez à l’aide de votre compte Facebook. Déconnexion /  Changer )

Connexion à %s

%d blogueurs aiment cette page :