I checked in the prototype of the TomcatWebappLoader, which gives
people the ability to load one OpenEJB per webapp rather than one
OpenEJB for all webapps as it is now.

The basic idea to getting it to work is to:
  - add the loader servlet to the webapp's web.xml
  - set the openejb.loader init-parameter to tomcat-webapp
  - add the openejb-loader.jar to the webapp's lib dir

Some important notes on having one openejb per webapp rather than one
per Tomcat instance:

openejb.home and openejb.base
--------------------------------
  * When there is one OpenEJB for all webapps, the openejb.base will
    just be the same as openejb.home.  The openejb.base variable
    points to where the configs are, the logs are, and where the beans
    are.

  * When there is one OpenEJB for each webapp, the openejb.base
    variable will be the WEB-INF dir of the webapp.  This could be
    made configurable, I'm just blindly overwritting the openejb.base
    init-parameter with the WEB-INF dir.

classloaders
--------------------
  * When OpenEJB is loaded at the webapp level, all OpenEJB libraries
    are loaded into the Tomcat WebappClassloader and therefore only
    visible to the webapp.
 
  * When OpenEJB is loaded for use by all webapps, it is loaded into
    the Tomcat CommonClassloader as normal.

where to put shared libraries
-------------------------------
  * With one OpenEJB for all webapps, this rule applies as always:
    http://www.openejb.org/tomcat-ejbclasses.html
  
  * With one OpenEJB for each webapp, it doesn't apply.  OpenEJB will
    be right there in the webapp's classloader and will have access to
    the same libraries the webapp does.

test mixing one OpenEJB per Tomcat and one per webapp
-------------------------------------------------------
  * I don't know what would happen if someone tried to load one
    OpenEJB into the common classloader as is the case with one
    OpenEJB per Tomcat, but also tried to give a few webapps their own
    OpenEJB instances as well.  It may or may not work.
 
test more than one webapp with it's own OpenEJB
-------------------------------------------------
  * There are some places in OpenEJB where system properties are used
    which may screw things up when there is more than one OpenEJB in
    the VM.  The first OpenEJB may muck with the system properties and
    mess up the other OpenEJB.  Other than that, things should be
    fine.  Make sure you test this as it is important we fix any such
    issues before releasing.

test with security manager enabled
------------------------------------
  * When Tomcat is started with the security manager enabled, it could
    potentially be a problem as OpenEJB is loaded into the
    WebappClassloader and would therefore be subject to all the same
    restrictions the webapp is under.

Jacek has shown interest in documenting and polishing all of this, but
there is certainly enough work for everyone (committer of not).  This
is the last major piece for 1.0.

We just need a few people to beat on this so we can flush out any
issues and help us get the docs right.  When this is done, it's 1.0
time!

-David

Reply via email to