EasyBeans prototype on top of OSGi
This pages describes the EasyBeans over OSGi's architecture and the way to test it from the EasyBeans svn repository.
1 What is OSGI ?
OSGi is an independent corporation that defines a specification for
service delivery over wide-area networks to local area networks and
devices. For additional information see
http://www.osgi.org
2 Why EasyBeans on top of OSGi ?
OSGi is mainly used in the embedded domain but begins to be the basis
of plugin application (like Eclipse fo instance) at server level. It is
the heart of dynamic and adaptable service oriented architecture which
can bring many benefits:
- On demand building of the application.
- Deployment capabilities (installation, un-installation of the components).
- Component lifecycle (start, stop of the components).
- Update of a part of the application during runtime.
By relying on this framework, EasyBeans is
benefiting from the dynamic deployment (for the server, the associated
services and the beans) and assembly of OSGi services to provide an
EJB3 container service adaptable on demand.
As JOnAS 5.0 is also built on top
of OSGi, it will allow a smooth integration of the EJB3 container
technology inside the Java EE application server.
3 Architecture
The objective is to obtain a more fine
grained architecture by extracting all the components used by EasyBeans
that are currently instanciated inside the EasyBeans bundle.
Packaging each of them in a bundle is allowing to
only deploy/activate them when needed (to save resources) and to
improve the update capabilites.
4 Download
The OSGi version of EasyBeans has been validated with the Apache Felix OSGi implementation (
Apache Felix) and the Eclipse Equinox implementation (
Eclipse Equinox).
Apache Felix can only be downloaded from the
Apache Felix Downloads Page.
Eclipse Equinox can be downloaded from the Equinox
download page.
For EasyBeans/OSGi, the classical EasyBeans project is needed.
See
EasyBeans
for how to download, compile and install it.
EasyBeans/OSGi and the samples EjbJars are available from the EasyBeans source repository.
(svn://svn.forge.objectweb.org/svnroot/easybeans/trunk/easybeans-osgi).
The sources can be browsed with
FishEye
All these projects are Eclipse projects but Eclipse is not mandatory,
Maven is enough for compiling.
4.1 EasyBeans/OSGi Compilation
Simply enter mvn clean install in the root of the project.
It will produce an assembly by default.
Detailed running instructions are available on a
separate page.
4.2 Binary distribution
Binary distribution is available here :
http://forge.objectweb.org/project/showfiles.php?group_id=5
5 List of available bundles
| Bundle | Description | Location |
|---|
| |
easybeans.jar | The EasyBeans EJB3 server | core/output/bundle |
ow_ezbcomponent_osgi_carol.jar | Carol EasyBeans Component | components/carol/output/bundle |
ow_ezbcomponent_osgi_jotm.jar | JOTM EasyBeans Component | components/jotm/output/bundle |
ow_ezbcomponent_osgi_joram.jar | JORAM EasyBeans Component | components/joram/output/bundle |
ow_ezbcomponent_osgi_hsqldb.jar | HSQL DB EasyBeans Component | components/hsqldb/output/bundle |
ow_ezbcomponent_osgi_jdbcpool.jar | JDBC Pool EasyBeans Component | components/jdbcpool/output/bundle |
ow_easybeans_agent.jar | The EasyBeans OSGi Agent | agent/output/bundle |
easybeans-slsb.jar | The stateless example | examples/stateless/output/bundle |
easybeans-sfsb.jar | The stateful example | examples/stateful/output/bundle |
easybeans-entity.jar | The entitybean example | examples/entitybean/output/bundle |
easybeans-mdb.jar | The mdb example | examples/mdb/output/bundle |
6 Limitations
At the moment, the EasyBeans Core Bundle is using Hibernate as JPA provider.
Using another provider will almost certainly fails.
6.1 Clients for Entities
If an entity client is running outside of an OSGi Context (aka not
packaged as a Bundle), trying to launch directly the client will
produce the following output :
[java] Exception in thread "main" javax.ejb.EJBException: Error while sending a request
[java] at org.objectweb.easybeans.rpc.ClientRPCInvocationHandler.invoke(ClientRPCInvocationHandler.java:127)
[java] at %Proxy0.findEmployee(Unknown Source)
[java] at org.objectweb.easybeans.examples.entitybean.Client.main(Client.java:70)
[java] Caused by: java.lang.RuntimeException: Error while handling answer on the remote side
[java] at org.objectweb.easybeans.rpc.rmi.client.RMIClientRPC.sendEJBRequest(RMIClientRPC.java:90)
[java] at org.objectweb.easybeans.rpc.ClientRPCInvocationHandler.invoke(ClientRPCInvocationHandler.java:124)
[java] … 2 more
[java]
Caused by: java.rmi.UnmarshalException: IOException unmarshalling
returnjava.net.MalformedURLException: unknown protocol: bundleentry
[java] at org.objectweb.carol.rmi.jrmp.server.JUnicastRef.performRemoteCall(JUnicastRef.java:209)
[java] at org.objectweb.carol.rmi.jrmp.server.JUnicastRef.invoke(JUnicastRef.java:158)
[java] at org.objectweb.easybeans.rpc.rmi.server.RMIServerRPCImpl_Stub.getEJBResponse(RMIServerRPCImpl_Stub.java:48)
[java] at org.objectweb.easybeans.rpc.rmi.client.RMIClientRPC.sendEJBRequest(RMIClientRPC.java:88)
[java] … 3 more
This is because of the ClassLoader annotations coming back within the downloaded EJBResponse instance.
The OSGi gateway handle 'bundle:' style URLs, but the client (running outside of OSGi) doesn't know that protocol.
The solution consists of 2 steps :
- Add the ow_easybeans_osgi_client_rt.jar to your client classpath
7 Future improvements
- Upgrade the architecture as described in the architecture section.
- Expose the EJB3 local interfaces as OSGi services.
- Specialize EZBComponent interfaces, this will help for a natural launch order (registry first, event without the core, ...).
Resources