geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Jencks <david_jen...@yahoo.com>
Subject Re: migrating from apache tomcat to apache geronimo
Date Mon, 31 Mar 2008 16:01:47 GMT

On Mar 31, 2008, at 4:00 AM, vv wrote:

>
> hi,
>
> currently i have a web application running in tomcat 5.5. this  
> webapps is
> composed of some smaller modules, which i want to separate out now.  
> the
> modules are using struts.jar & some common application libararies.  
> i dont
> want to duplicate the libraries, hence i'm running as a single  
> webapps. is
> there a way i can split these in to separate archive files & still run
> within a single webapp context without duplicating the application
> libraries+struts.jar.

I think you might be asking 2 separate questions here....  In  
geronimo it's easy to take the jars out of a web-app and put them in  
the geronimo repository yet still have them in the web app's  
classloader.  However, one war == one web app context at least in  
terms of separate session management etc.  I'm not sure what happens  
if you try to deploy 2 web apps using the same context path.  Jetty's  
internal logic would try handlers until one handed a request, but I  
don't know what would happen on deployment.  Anyway I'd think it  
would be rather difficult to figure out the servlet mappings and  
security to make this do what you want.

Back to the easy part :-)

So, take each jar out of WEB-INF/lib, figure out an appropriate  
maven2 style artifact id for it, and put it in the appropriate place  
in the geronimo repository.  Then in your geronimo plan for your  
application, in the <environment><dependencies> section add a  
dependency for each jar.  The classloader for your web app will be  
just the same as if the jars were still in WEB-INF/lib.

If you want several web apps to have classes from one of these jars  
loaded in the same classloader, you have two choices:
- make one web app B depend on the other A.  You do this by listing A  
as a dependency of B.  You'll need the moduleID of A which you  
specified in the plan for A.  The jars will be loaded in A's  
classloader.
- create a "common classloader" module that loads all the shared  
classes and list it as a dependency of both A and B.  Geronimo has  
several of these such as jee-specs.

All this stuff is a lot easier if you build your project using maven  
and "pre-deploy" your app as a geronimo plugin.  With your jars in an  
appropriate maven repo installing the plugin will automatically pull  
in all the dependencies.  The apache directory plugin is a good  
example of this -- the entire directory server (many jars!) is pulled  
in from maven central when you deploy the plugin.

There's a way that may seem simpler at the moment but IMO is likely  
to lead to confusion later.... using the shared-lib.  You can just  
put your jars here and they will be in the shared-lib classloader  
which is IIRC a dependency of the tomcat module (??? you might need  
to add shared-lib as a dependency to your app).  This will NOT result  
in the jars being in the web-app's classloader, but rather in a  
parent classloader.

AFAIK un-precompiled-jsps and .js and static content still need to be  
in your web app.

hope this helps
david jencks
>
> is it possible to do this with geronimo
>
> thanks,
> -- 
> View this message in context: http://www.nabble.com/migrating-from- 
> apache-tomcat-to-apache-geronimo-tp16395625s134p16395625.html
> Sent from the Apache Geronimo - Users mailing list archive at  
> Nabble.com.
>


Mime
View raw message