Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to structure a JSF application (EAR/WAR/JAR)

843844Apr 21 2008
Hi All,

How do you recommend I should structure a JSF application in terms of EARs, WARs and JARs?
Let me set the context for you: I have a fairly large project which consists of a number of sub components. Each of these sub components are JSF applications in the sense that they have JSF pages connected to each other. So, for instance, I have a company management sub component and a product management subcomponent. Most of these sub components share some Java libraries and/or entities.

Because of this I decided to have each sub component contained in its own WAR, with no universal libraries in its lib folder, and to then add these WARs to an EAR with all the library JARs in the EAR's lib folder, as so:
EAR
   |_ component1.WAR
   |_ component2.WAR
   |_ lib
         |_ sharedlib1.JAR
         |_ sharedlib2.JAR
Unfortunately I'm having more problems than I hoped I would with JSF with this setup. An alternative I have is to create one gigantic WAR which contains all the library archives and then to only deploy this WAR. Although this would probably work, it destroys the nice seperation I had between sub components, where I could for instance just remove the one WAR from the EAR if it was giving problems. That structure would look something like this:
WAR
   |_ <WebContent>
   |_ WEB-INF
             |_ classes
                       |_ <JSF classes>
             |_ lib
                    |_ sharedlib1.JAR
                    |_ sharedlib2.JAR
Finally, I have a third option where I add all the libraries required by a WAR to its lib folder and I have no shared libraries in the EAR's lib folder. The disadvantages are of course that the EAR will be huge as JARs get duplicated unnecessarily, and I'm not sure that this won't cause conflicts. The structure would look like this:
EAR
   |_ component1.WAR
                    |_ WEB-INF
                              |_ lib
                                    |_ sharedlib1.JAR
                                    |_ sharedlib2.JAR
   |_ component2.WAR
                    |_ WEB-INF
                              |_ lib
                                    |_ sharedlib1.JAR
                                    |_ sharedlib2.JAR
I believe the first way to be the best, but I'm struggling getting JSF to work like I expect (see [http://forum.java.sun.com/thread.jspa?threadID=5288069|http://forum.java.sun.com/thread.jspa?threadID=5288069] ). What are your suggestions?

Thank you,
Ristretto
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 19 2008
Added on Apr 21 2008
0 comments
306 views