0

I am working on a large scale system using PrimeFaces 5.0, Java EE 7, Maven 3.0.5, Netbeans 7.4 & GlassFish 4.0

I want to implement it as (multiple WARs , multiple EJBs , one EAR). Multiple wars could have common files like (JS, CSS, XHTML, Backbeans & Converters) i have achieved this using jar which contains this resources. different WAR files, shared resources

I need a session-scoped bean to be shared between different wars, I found this but i found it more than what i need.

http://docs.oracle.com/cd/E18686_01/coh.37/e18690/glassfish.htm#CEGBDHJB

so my questions is:

  1. Is using a jar is the right approach to share what i want ??
  2. where do i put jars like primefaces or omnifaces in the project where they use the same class loader ??
  3. How can i share session-scoped between different wars ??
Community
  • 1
  • 1
ES3000
  • 23
  • 5
  • If you are using spring: 1) maven lets build an ear consists of shared lib folder and your wars. 2) jars which are only in this lib folder may contain spring root context (you may declare your beans there). 3) may be you will need webAppRootKey – Multisync Oct 23 '14 at 10:49
  • Thanks for replaying, But i think i can fix this without using spring. – ES3000 Oct 25 '14 at 15:02

1 Answers1

0

I have been working on a ear project with similar requirements as yours, according to our experience :

  1. Sure. We have seperated our war projects and use them as extended controllers to carry out front end logic and passing data to view, and they make their service calls via a jar file called common-services.jar . Our whole service layer is living on a single jar file. However if you ask my personal opinion, I think it would have made a lot sense to create a third war file just for the services, and talk restful with all the front-end repos. That way service calls could be opened to third party users without any further work. So to sum it all up, yes it is an acceptable approach, but you should also consider packing it as war.

  2. On a parent pom above all war, so all war files use the same version and it is managed from a single pom.

  3. Carry all session based operations to your third jar / war we have discussed in question 1. Makes much more sense that way. Or I suppose you will need solutions like single sign on. But my first suggestion works like a charm for us.

Pumpkin
  • 1,993
  • 3
  • 26
  • 32
  • Thanks for your replay, my session-scoped backbean is in common jar but in my case every war create its own session. by the way every war have dependency tag for the common jar. – ES3000 Oct 25 '14 at 15:10