1 Reply Latest reply on Oct 23, 2008 10:09 PM by Dean Hiller

    EAR vs WAR: Embedded JBoss in Tomcat 6.0

    Francisco Peredo Newbie


      In the seam reference you can read at 2.2. Setting up a new Eclipse project:

      The most important choice you need to make is between EAR
      deployment and WAR deployment of your
      project. EAR projects support EJB 3.0 and require Java EE 5. WAR projects do not support EJB 3.0, but may
      be deployed to a J2EE environment.

      But, in Michael Yuan's blog says:

      If you need to use EJB3 beans, you will need to install the “Embeddable JBoss” libraries as shared library in Tomcat. It is an easy process. You can find instructions for Tomcat 5.5 and 6.0 respectively. Once you do that, you can deploy Seam applications without any restrictions. You will be able to use full EJB3 features including session beans, entity beans, message driven beans, and web services etc.

      Of course, you still cannot deploy EAR files on Tomcat. But you can bundle EJB3 JARs in the WEB-INF/lib directory of your WAR application — essentially re-creating the EAR structure in a WAR. Just run the tomcat.war ANT target on any of the official Seam examples to see how this is done.

      Therefore... is it really important so set the project as a WAR or as an EAR? (BTW I am creating my projects in eclipse using JBossTools)

      What are exactly the limitations for WAR projects (AFAIK one of the limitations could be transaction handling, when I tried to use transactions the way they are using in the bookings EAR example in a WAR, I got an exception like this: javax.naming.NameNotFoundException: EjbSynchronizations not bound so I switched to an EAR based project... but now I need to run that project in Tomcat 6.0, and I was thinking, that is easy, I just have to use Embedded JBoss, but then i turned out that Embedded JBoss does no support EAR projects... but then I read Yuan's blog at I learn that I can bundle EJB3 JARs in the WEB-INF/lib... is that true? and if is true.. would it have the exact same seam features available as a normal EAR project? and finally in what way do I have to alter my EAR project to bundle EJB3 JARs in the WEB-INF/lib.




        • 1. Re: EAR vs WAR: Embedded JBoss in Tomcat 6.0
          Dean Hiller Expert

          It might be a bit late for a response, but I have war files working in tomcat just fine with EJB3 jar which has seam/EJB3 beans in it.  You just have to make sure you don't miss that seam.properties file(blank file that is required for seam to find your components in the jar inside WEB-INF/lib).

          I am however now trying to figure out how to deploy to JBoss with a war file(I don't really like that ear file...it is nasty with all it's descriptors and such that I don't know what they all do :( ).