-
1. Re: OSGi Remoting over EJB remoting
sys3175 Jul 25, 2014 3:58 AM (in response to pmm)Hi Philippe,
I have found your project and find it very interesting.
I'm trying a remote EJB client (to an Eclipse application) to connect to an EJB server (JBoss 7 or Wildfly 8).
So, as I understand it, your project can generate the necessary service.xml file from the (remote) interface of the EJB.
In addition, it ensures that the necessary EJB client JARs are available.This sounds very exciting.
One question I have now: How to use your project?
I think osgi-remoting-ejb-sample contains the (remote) interfaces of the EJB. Is that right?
With custom interfaces I must therefore create your own osgi-remoting-ejb-sample.
And what do I do then? Simply everything to build with maven?
Thank you for an early reply.
Greeting Ronald
PS: translate processing: google :-) -
2. Re: OSGi Remoting over EJB remoting
pmm Jul 27, 2014 5:45 AM (in response to sys3175)Thank you for your interest. There are several steps involved:
- You have to generate your EJB client JARs.
- You have to somehow produce OSGi bundles for your EJB remote client interfaces. These bundles:
- have to be valid OSGi bundles with (direct) dependencies specified through
Require-Bundle
orImport-Package
must not have dependencies on EJB client libraries specified in the Manifest
when running in Equinox the bundle header
Bundle-ActivationPolicy: lazy
has to be setan OSGi remote service.xml in
OSGI-INF/remote-service
or a different location specified through theRemote-Service
bundle header. The easiest way to do this is through the included annotation processor.
- have to be valid OSGi bundles with (direct) dependencies specified through
We provide an annotation processor that can generate the service.xml for you. The processor needs the following arguments
javax.ejb.module.name
has to be set to the module namejavax.ejb.application.name
has to be set to the application name
- The manifest can be created through maven-bundle-plugin or any other way.
- sample-ejb uses the processor and maven-bundle-plugin. In addition <generateClient> is used so that EJBs, DAOs and so forth don't end up on the client (they do in the sample). That would be your ejb project.
- You have to somehow produce OSGi bundles for your EJB remote client interfaces. These bundles:
- You have to provide several the glue bundles.
- An equivalent of osgi-remoting-ejb-jboss-client that contains all the EJB client libraries from JBoss (or WildFly) AS that are not already OSGi bundles.
- An equivalent of osgi-remoting-ejb-jboss that contains an implementation of InitialContextService. The implementation
- Does authentication (the sample just uses jboss-ejb-client.properties)
- Provides the initial context
- Provides the bundle symbolic names of the all the client libraries (the osgi-remoting-ejb-jboss-client equivalent and all the EJB client libraries from JBoss (or WildFly) AS that are already OSGi bundles). It does not provide the bundle symbolic names of your own ejb client JARs from step 1.
- You have to deploy everything in in your OSGi container.
- the bundle
osgi-remoting-ejb-client
has to be started automatically - the JBoss (or WildFly) AS EJB client libraries that are already OSGi bundles have to be deployed (eg.
org.jboss.spec.javax.transaction.jboss-transaction-api_1.1_spec,
org.jboss.spec.javax.ejb.jboss-ejb-api_3.1_spec,
javax.xml.jaxrpc-api-osgi,
org.jboss.logging.jboss-logging)
- the implementation of
com.github.marschall.osgi.remoting.ejb.api.InitialContextService
(theosgi-remoting-ejb-jboss equivalent
) has to registered (eg. through Dynamic Services / Service Component Runtime) - the equivalent of
osgi-remoting-ejb-jboss-client
from step 2 has to be deployed unpacked - on Equinox the bundles
org.eclipse.equinox.ds
andorg.eclipse.equinox.util
have to be deployed. - the following VM argument has to be set
-Dorg.osgi.framework.system.packages.extra=sun.nio.ch,sun.refelect
We recommend to deploy the bundles
org.eclipse.equinox.console
andorg.apache.gogo.shell for debugging bundle issues.
- the bundle
- You have to generate your EJB client JARs.
-
3. Re: Re: OSGi Remoting over EJB remoting
sys3175 Aug 7, 2014 2:31 AM (in response to pmm)Hello Philippe,
thank you for your answer.
Is it possible your example on a JBoss 7.1.1 AS to deploy?
I have tried it with the osgi-remoting-ejb-sample-ear, but unfortunately it does not work.Something with "JBAS014771: Services with missing / unavailable dependencies"
[Edit, 07Aug2014] From the ejb.jar I have the directory OGSI-INF and all bundle information from the MANIFEST.MF deleted.
Now there are no problems during start of JBoss.
Can the remote client (with all dependencies) can be integrated in an Eclipse RCP?
I think that I would have to do the following:
(1) A new RCP projects create (E4-base)
(2) Add dependencies:
(2.1) bundle osgi-remoting-ejb-client with autostart, which level? Is Level 3 ok?
(2.2) bundle osgi-remoting-jboss-ejb with Auto Start (?) and level (?)
(2.3) bundle osgi-remoting-jboss-ejb-client with Auto Start (?) and level (?)
(2.4) the bundles org.eclipse.equinox.ds and org.eclipse.equinox.util should at it (due to the RCP) with Auto Start (?) and level (?)
Is that all?Thank you for an early reply.
Regards Ronald -
4. Re: OSGi Remoting over EJB remoting
sys3175 Oct 9, 2014 9:05 AM (in response to pmm)Hello Philippe,
I tried again to get to run your project in Eclipse (Kepler). Did not work. :-(
I have checked out from github (0.3.0) and it just as it is imported into Eclipse.
For the server I have used JBoss 7.1.1. Here I have rolled out the EAR archives.In the EJB-Jar have to remove all OSGi entries so that JBoss starts the EAR.
Otherwise, there are unmet dependencies.
In Eclipse, I have tried the following bundles in an OSGi framework (Equinox) execute:
(1) com.github.marschall.osgi-remoting-ejb-api
(2) com.github.marschall.osgi-remoting-ejb-client
(3) com.github.marschall.osgi-remoting-jboss-ejb
(4) com.github.marschall.osgi-remoting-jboss-ejb-client
(5) com.github.marschall.osgi-remoting-ejb-sample-client
There are the following problems:
- The package (2) misses the Import-Package com.github.marschall.osgi.remoting.ejb.api
- The package (4) misses the import packages javax.ejb and org.jboss.logging (I have not yet created a bundle for the JBoss client, my mistake)
- Missing the package (5) the Import-Package com.github.marschall.jboss.osgi.remoting.ejb.sample
So I have the console in Eclipse still works included in the following bundles Runtime:
- org.apache.felix.gogo.command (for the console)
- org.apache.felix.gogo.runtime (for the console)
- org.eclipse.osgi.service (for org.eclipse.equinox.ds and org.eclispe.equinox.util)Now my questions:
1. Why does not find the package (2) and (5) the import packages? Is the fact that the package (4) causes problems?
2. What is the best way to build the missing JBoss client bundle, which the package (4) is needed?
I want to understand how your example works.And how to build it up best. If possible, also with a building servers such as Hudson.
I think that can be used your example to create an EJB application with both a Web client and a RCP client.
Thank you for an early reply.
Greeting Ronald
PS: English by goo ....:-( -
5. Re: Re: OSGi Remoting over EJB remoting
pmm Oct 9, 2014 3:01 PM (in response to sys3175)I can not tell you why the packages are missed without further information. What I usually do debug such issues is.
- Check the launch configuration. Make sure all bundles I want are selected and then "Validate Bundles/Plugins"
- In the console find the bundle ids of the plugins (com.github.marschall.osgi.*). Check the state of the plugins. Manually start the plugins that are not started but should be (com.github.marschall.osgi.*). That usually gives you an exception that should help you track the problem down.
You do not need to build the missing JBoss bundles (org.jboss.spec.javax.transaction.jboss-transaction-api_1.1_spec, org.jboss.spec.javax.ejb.jboss-ejb-api_3.1_spec, javax.xml.jaxrpc-api-osgi, org.jboss.logging.jboss-loggng). The JARs themselves are already bundles with a Manifest and everything.
The other option instead of removing the OSGi entries from the EJB-JARs is simply disabling the OSGi subsystem in JBoss AS (it will be gone in WildFly anyway).
The project uses Maven as a build system. Downlad and install Maven and the building the project should be a simple case of
mvn clean package
this should also work on Hudson/Jenkins. Then you can look in the target/ folders and should find the bundles there.