wood burning stoves 2.0
The moose likes Portals and Portlets and the fly likes libraries Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "libraries" Watch "libraries" New topic


Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104

I need some guidance on the portal approach. If I have a portal application in which all of the portlets(separate war files) are using some framework jars. The framework is the one that my org. follows. Since all the portlets use it can I share it at a common location or I have to put them in the portlet's WEB-INF\lib folder only for all the oirtlets.

Similarly if there are some other jars that are being used by all teh portlets, can I put them in a shared location?

Hemant Sharma

Joined: Feb 01, 2007
Posts: 23

You can put all the common jars in the shared\app\ directory of the portal server.

Thanks & Regards,<br />Hemant K. Sharma
Dorothy Taylor
Ranch Hand

Joined: Nov 26, 2007
Posts: 104
Thanks for the answer, but can you please tell that if suppose the version of the jar changes quite frequently, even then is it advisable to keep in shared/app or should it be in WEB-INF in this case, so that every time the version change happens the portal needn't be rebuit?
Hemant Sharma

Joined: Feb 01, 2007
Posts: 23

If you keep the jar in WEB-INF/lib and the jar is changing frequently, then you will need a fresh deployment (even though there was no change in portlet application) every time the jar is updated.

Its always good to keep common jars in shared/app.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

I always vote to put jar files in the web-inf\lib directory, as opposed to the servers app directory. I wrote an article on application packaging and classloaders that you might find interesting:

How to package J2EE applications: Classloaders and lib directories

Here's the thing - say you've got xerces1.1.jar in your shared\app folder. Then, one of your 1000 apps wants to use xerces2.0? You've got to update and test ALL 1000 apps before this one app can move.

Alternatively, if each app puts it's xerces jar in its local WEB-INF\lib directory, the app can be upgraded to a newer version without bothering all of the other 1000 apps on the server.

Of course, if all the apps hit the same db2, then the db2 driver should be on the shared\apps folder. For that matter, when you upgrage to a newer version of db2, all apps will have to update at the same time, so there it makes sense.

Indeed, putting things int he web-inf\lib directory will require a re-deploy of the app. Hopefully, though, updating a jar file is a very controlled, and regression-tested process that doesn't happen all that often.

As with most J2EE things, there are no right answers, there are only wrong answers. If you can manage not to get a wrong answer, you're doing good.

-Cameron McKenzie
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

Please check your private messsages.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
I agree. Here's the link: http://aspose.com/file-tools
subject: libraries
It's not a secret anymore!