Starting a new project and would like to know the pros and cons of packaging EJB in a WAR vs EAR.
Will JNDI still works when EJBs are in the WAR? efficiency? etc.?
I did some experiment on this topic and really surprised on the result. My conclusion was never use EJB in WAR. Let's leave the job for the EJB container so if anybody want to get the best and error free development use EAR instead.
When I worked EJB in WAR using NetBeans 7.1.3, Glassfish 3.1.2.2 and JRebel for faster development I have realized that JRebel only works perfect with reloading changes made in EJB modul if it was deployed in an EAR package. If I made simple WAR package the classloader behaved absolutely strange way during development phase and caused a lot of random bugs.
Anyhow the war package in normal deployment worked perfect as mentiod by others.
Also in a WAR package the changes in NamedQuery strings did not apear after save and compile. If I packaged into EAR the development was smooth and fast. Of course this could be a bug also in JRebel.