4

I want to make my Java EE application pluggable. The main application would be deployed in an ear, but its code in EJB would contain entry points for plugins. Plugins could be deployed on their own jar file. Is there any good framework to do this? I'm looking for just a lightweight framework.

What should I read or learn to make such a framework?

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
nerd
  • 837
  • 6
  • 21

2 Answers2

5

OSGi would be a good fit for this. Either Apache Felix or Eclipse Equinox can be started up inside your Java EE application and OSGi bundles (jar files with some extra entries in the MANIFEST.MF file) can be deployed to them.

There's some good information about embedding Felix here: http://felix.apache.org/site/apache-felix-framework-launching-and-embedding.html#ApacheFelixFrameworkLaunchingandEmbedding-embedding

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Nick Wilson
  • 4,959
  • 29
  • 42
  • Or, if you are already using Glassfish... http://docs.oracle.com/cd/E26576_01/doc.312/e24930/osgi.htm. This would keep you from having to write the OSGi stuff yourself, since you can deploy the bundles straight to Glassfish. I do hate that it ties you to a vendor though. – Justin Smith Mar 06 '14 at 15:10
1

Two other ways to create plug-ins for Java EE are via its connector architecture (JCA) and via its portable extensions (CDI).

While quit powerful, JCA isn't documented very well as it's more often used by vendors instead of regular application developers.

Mike Braun
  • 3,729
  • 17
  • 15
  • I can't seem to find any concrete examples of using CDI in a "pluggable" fashion. Even with CDI, the deployment still seems very static. Meaning I would have to regenerate the whole application just to add a plugin. For example, with CDI, it doesn't seem possible to @Inject a bean from a separate application, which would be perfect for a pluggable archive. – Justin Smith Mar 06 '14 at 15:06