Packaging of EAR / WAR / EJB-JAR

Hello,

I have a big application to do.

So, one solution should be to use an EAR for one module, containing the WAR for the web-tier and the EJB-JAR for the business-tier.

It would be better doing like this than creating a big WAR, in order to avoid to deploy a big WAR when a modification is done in one module.

What about the problem of the session ?

In fact, I have to declare a context-root for one EAR.

And at each context-root is created an object HttpSession on the server.

So, I have some questions about this :

- How can I configure my WARs in order to use only one HttpSession object for every WARs ?

- Can I put multiple WARs in one EAR ? If yes, what about the context-root ? This solution would resolve the session problem.

Thanks in advance.

bgOnline

[843 byte] By [bgOnlinea] at [2007-10-2 2:53:48]
# 1
Hello,You can definitely bundle multiple wars inside one ear file. The context path is per WAR and NOT EAR.Thanks and regards,Pazhanikanthan. P
pazhanikanthana at 2007-7-15 21:19:31 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 2
1)Youcan always have multiple WARs in one EAR.2)Context root is per WAR and not EAR.3)In websphere there is a setting "Share Session Context" by which you can share the sessions accross WARs belonging to the same EAR.
Abbyssa at 2007-7-15 21:19:31 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 3

> Hello,

>

> I have a big application to do.

> So, one solution should be to use an EAR for one

> module, containing the WAR for the web-tier and the

> EJB-JAR for the business-tier.

> It would be better doing like this than creating a

> big WAR, in order to avoid to deploy a big WAR when a

> modification is done in one module.

Are you using local EJBs or remote EJBs? The only way for a war to talk to a local EJB is to package the war along with the ejb-jar in an EAR file because they need to be collocated. You can not simply bundle EJB classes in a war file.

If you are using remte EJBs, then you can package the EJB client view classes along with the servlets and JSPs in the war file and deploy the war separately. But again your war will be one big war.

If your EJBs are just entity beans, then Java EE 5 (see http://weblogs.java.net/blog/ss141213/archive/2005/12/using_java_pers.html) allows you some nice options.

>

> What about the problem of the session ?

> In fact, I have to declare a context-root for one

> EAR.

> And at each context-root is created an object

> HttpSession on the server.

>

> So, I have some questions about this :

> - How can I configure my WARs in order to use only

> one HttpSession object for every WARs ?

There is no standard way to do this. Relying on any application server specific feature can only make your app non-portable. So I strongly recommend you not to do this.

> - Can I put multiple WARs in one EAR ?

Of course you can.

> If yes, what about the context-root ? This solution would resolve

> the session problem.

Can't be solved using any standard way. So I suggest you stick to one big war, if that's what your business requirement is.To speed up development-deployment-test cycle, any appserver allows a rapid deployment option where in you can deploy incremental changes to server. Use this facility during development. DON'T sacrifice portability of your app by using any product specific configuration that you may not find any where else.

Thanks,

Sahoo

sahooa at 2007-7-15 21:19:31 > top of Java-index,Enterprise & Remote Computing,AVK Portability...
# 4
You can put multiple 'war' in one 'ear' and setting context root for per war not ear ..Thanx n RegardsNarendra Kumar
Jeet_Narendraa at 2007-7-15 21:19:31 > top of Java-index,Enterprise & Remote Computing,AVK Portability...