How to deploy a RAP application to a servlet container?
The current eclipse build tools and wizards do not directly support
building this style of application so for the time being the build can be
performed with a series of Ant scripts and resource templates. The
org.eclipse.rap.demo.feature
shows how to create a WAR
that
contains the org.eclipse.rap.demo
project as RAP application.
Note: As with RCP applications there are a wide variety of possible
configurations. What's given in org.eclipse.rap.demo.feature
is just
one possibility.
As prerequisites we assume that you are familiar with the bundles- and
build information section of the
Equinox in a Servlet Container document. We also assume that you have a
checkout of the
servlet bridge and demo feature bundles
in your workspace.
Prepare the build script
- Open the
script/webappBuilder.xml
of the
org.eclipse.rap.demo.feature
with the Ant editor.
- Adjust the
servletbridge.dir
property
(see docu in script file).
Create the build content
- Right-Click on the
webAppBuilder.xml
script in the IDE and
"Run Ant". (Note: In order to make the pde.exportFeatures
task
available in the IDE select "Run in the same JRE as the workspace" on the
JRE tab from "Run Ant..").
- Refresh the feature project - a build folder should appear. (Note:
The
pde.exportFeatures
target will build the plug-ins
asynchronously and may take a while till finished. After that the complete
WAR
content should be available in the build folder.
Adjust the config.ini
- Adjust the path to the plugin directory of your build in the
ConfigIniCreator
(see docu in ConfigIniCreator
class).
- Run the ConfigIniCreator as java application.
- Copy the console output to the
config.ini
file of your
build.
After that pack the WAR
of the application build available in the
build folder (in our case the content of build/rapdemo
). Deploy
the WAR
to a servlet container to see whether the build was successful :-)
(screenshot shows application running with osgi-console. See web.xml in the
templates directory for more infos on how activating the console)
How to deploy my own application?
To deploy your own application like described above you will have
to create your own feature. The feature should contain the same plug-in
references as the demo feature (except the demo-plug-in of course!) plus the
plug-ins that make up your application. It is important that your plug-ins that
reference the servlet API use the Import-Package
header to do
this (see MANIFEST.MF
of the demo project).
Copy the script and templates folder to the feature and modifiy them
according to your project structure. Following the steps above should lead
to a full functional WAR
of your application.
Note: If you are encountering problems during the build
you may consider to use the PDE-Export (available from the feature.xml editor)
before exporting the whole WAR at once. This proved helpful for
trouble-shooting as the export may shows problem relevant dialogs that are
suppressed in the ant export.
Note also: Besides the application server log files
there exists an equinox framework log that can be found under the webapp's
work directory, e.g. on tomcat:
<tomcat-installation>\work\Catalina\localhost\demo\eclipse\workspace\.metadata\.log
In case equinox isn't able to start at all you may also have a look for log
files at:
<tomcat-installation>\work\Catalina\localhost\demo\eclipse\configuration