views:

301

answers:

3

This seems like an elementary question, but I want to make sure that we're doing things right.

We're making webapps using Spring MVC and serving them using WebLogic. Where should jars be placed in this setup?

We have talked about placing business logic into jars that would live in the server classpath and app-specific jars would be packaged into the WAR files that get deployed. We know that if we redeploy a jar in the server classpath we have to bounce the server. Is there a way to avoid this?

+3  A: 

There are a couple of options, depending on your situation:

  • If you will only have one WAR, or you don't need to code across multiple WAR files, then you can package the business logic in with the WARs.

  • On the other hand, if you want to share code across multiple WAR files, then you would bundle the WARs into an EAR, and bundle the shared business logic code in one or more JAR files stored in that EAR.

I would generally avoid using the server classpath, since you are likely to run into classloading issues, and you don't want to bounce the production server just to update code.

John Stauffer
I am not in the know concerning EARs and haven't found a lot of good information on them. Do you have any good references for them?
I Never Finish Anythi
It looks like EARs can't talk to one another, so if I have a JAR to share, the WARs would need to be in the same EAR. If that is the case, would I have to deploy both WARs (since they're in the same EAR) if I make changes to one?
I Never Finish Anythi
A: 

I've seen other SO questions that reported issues with JARs on the server classpath:

http://stackoverflow.com/questions/1325595/weblogic-ear-classloading.

I think it's better to keep your WAR as a single, independent unit.

duffymo
A: 

If it is just a single web app per server, just shove 'em in WEB-INF/lib. Otherwise, the shared j2ee libraries discussed here provide flexibility and are easy to use & deploy in WLS.

http://download.oracle.com/docs/cd/E12839%5F01/web.1111/e13706/libraries.htm#g1092115

Wayne Young