Jul 19th, 2006, 08:41 AM
Best Practice - Spring under JBoss
Looking for best practice for deploying Spring jar files under JBoss.
We are running several web applications in a Tomcat instance running under JBoss. All of these WARs are part of a larger application JBoss is serving for us.
Should we deploy the Spring jar files (and supporting jar files - not including our app specific jars:
a) in the war files
b) in the common lib area of Tomcat
c) in the common lib area of Jboss
Currently we have no plans to use EJB's, but we are using JBoss clustering, JBoss JMS, other features of the J2EE container.
Looking for any pros and cons those with more experience can share...
Jul 19th, 2006, 09:10 AM
If I would have multiple applications sharing the same version of Spring I would place it in some shared directory (tomcat/jboss). However if I have 1 application using it I would place it in the war file.
Also placing jars in other locations can sometimes lead to unpredictable situations.
Jul 19th, 2006, 11:56 AM
We will have multiple WARs usng Spring. They will each have there own context.
Jul 19th, 2006, 04:15 PM
according to your description, I would place all spring-related jars into the jboss/yourserver/lib. That way you won't have to copy the same files into multiple locations.
Jul 19th, 2006, 05:59 PM
I'd first try selecting answer D) None of the above.
Try putting jars in <ear>\lib and create <java> modules in your .ear application.xml
I know you're not using EJB but you can still package multiple <web> modules inside an .ear file, just also then add a <java> module for each .jar you want to include.
Jul 20th, 2006, 01:59 AM
That would also be an option, however I concluded they only deployed different wars.
Question from side regarding ears. If I have 30 web apps, sharing the same jars. Could we place those wars in a <ear>\lib. Would this reduce the memory footprint of all those applications? (Currently we have a memory issue on our production servers ). (Note: I didn't suggest the current type of deployment I'm only here to clean up the mess and make things better )
Jul 20th, 2006, 07:59 AM
Of course you can... But I wouldn't do that with all beans. There are several jars which were likely unhappy being in such a situation.
Originally Posted by mdeinum
In the past Struts was unhappy about a shared location, also other webframeworks. So the most frameworks recommend to put them into WEB-INF/lib.
But: Having them in a shared location would reduce the memory usage.
Jul 20th, 2006, 08:03 AM
Currently we have someone investigating which jars to put where, so which work well in a shared lib (or ear) and which not.
I also recall that hibernate doesn't like it always to be in a shared environment. Well I think we need see what to put where. Luckily that is not my job .