Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Integrating external packages using the ServletBridge in RAP
Integrating external packages using the ServletBridge in RAP [message #86673] Fri, 09 May 2008 03:05
Eclipse UserFriend
After spending plenty of hours with deployment of a RAP application in
Tomcat using the ServletBridge to access non-OSGi components, that's
what I've learned so far:

I lot of people report the have to integrate some EJBs, or other
non-OSGi parts of their application with their RAP-bundles. To make
those external libs visible to the RAP-bundles, one can use the
extendedFrameworkExports parameter in the web.xml. This can look like
this, for instance:

<init-param>
<param-name>extendedFrameworkExports</param-name>

<param-value> com.someorg.app.package1,com.someorg.app.package2,com.someor g.utils </param-value>
</init-param>

These packages are used by the ServletBridge to generate a new bundle
named "org.eclipse.equinox.servletbridge.extensionbundle" which is
deployed with your application. This bundle consists of a manifest.mf
only where all the specified packages are declared as Export-Packages.
That's the way, the dependencies of your RAP-bundles can be resolved on
startup. Consequently you have to declare the needed packages as
Import-Package in the manifest of your bundles.

So far so good. There are some pitfalls, e.g. indirect dependencies. You
have to make sure that all required classes of the imported packages
are avaiable within the OSGi-evironment as well. This can be done by
adding those packages to the extendedFrameworkExports section as well,
e.g. logger, apache-commons or what ever. This is very error-prone and
hard to test, because errors ocurr at runtime first
(ClassNotFound-exception).

Another possibility is to create a bundle which contains all the needed
libs (logger, etc.) and exports their packages. When this bundle is
deployed with your app, the needed classes can be found.


Another important point: DON'T use line feeds or comments in the
extendedFrameworkExports section. Its content is directly written to the
manifest.mf. A linefeed could cause the manifest-header to become
invalid, which means that none of your packages is exported. Even worse,
the necessary javax.servlet export is also not available, because this
is written to the manifest-header by default. A valid Manifest.mf in the
org.eclipse.equinox.servletbridge.extensionbundle looks like this:

Manifest-Version: 1.0
Bundle-Name: Servletbridge Extension Bundle
Bundle-ManifestVersion: 2
Fragment-Host: system.bundle; extension:=framework
Bundle-SymbolicName: org.eclipse.equinox.servletbridge.extensionbundle
Export-Package: org.eclipse.equinox.servletbridge; version=1.0, javax.
servlet; version=2.5, javax.servlet.http; version=2.5, javax.servlet.
resources; version=2.5, com.someorg.app.package1,com.someorg.app.pack
age2,com.someorg.utils
Bundle-Version: 1.0.0


Another important issue: As Frank said in his post in the thread
"Problems building a war file of my RAP application" one should at the
extensionbundle to the config.ini and remove the
updateconfiguration-bundle. That's the only way that I am aware of to
have any error messages if this indispensible bundle cannot be loaded.
Tomcat writes a log to the dir /work/<app_name>/eclipse/configuration in
that case.

I hope this helps anybody ;-)
Comments are welcome,
Stefan.
Previous Topic:Progress Bar Question
Next Topic:Ressources
Goto Forum:
  


Current Time: Mon Jul 21 20:08:30 EDT 2025

Powered by FUDForum. Page generated in 0.25986 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top