11 Replies Latest reply on May 31, 2011 2:05 AM by Jason Porter

    Maven 3 and EAR

    Seth Milder Newbie

      Hi everyone,


      I have a green field project and want to use Seam 3 and Maven 3. I currently have a Maven and Seam 2 project that was a bit of a pain to implement, but does produce a valid EAR artifact as a result. I am a lazy man, and I was hoping that Seam 3 (and/or Weld) would solve this drudgery for me, freeing me to spend my CPU cycles on solving the problem at hand. I was sad to see that all the examples in the Seam 3 distribution only produce WAR artifacts, although I was happy to see that they at least used Maven. It does seem that this functionality is in the works from what I have read. Does anyone have any idea when this will be ready to use, or even test (I would be happy to contribute)? Should it make any difference, I am using JBoss 6, perhaps I only need WAR? I am interested in eventually deploying my application in JBoss in a cluster configuration, so I think I do need EAR, don't I?


      Best,


      Seth

        • 1. Re: Maven 3 and EAR
          Jason Porter Master

          You'll be fine with a war. The only two reason for ears, imo are:



          1. Sharing EJBs among multiple wars

          2. Using remote EJBs



          There may be some others I'm not aware of, but those are the two that I recall.

          • 2. Re: Maven 3 and EAR
            Seth Milder Newbie

            Thanks! I think I actually do need remote EJBs because I wish to leverage container managed web services.


            Best,


            Seth

            • 3. Re: Maven 3 and EAR
              Jason Porter Master

              When you say container managed what is it you want to get from the container? Transactions? Security? Something else? I believe you can do those things with Seam 3. If not, we should probably address them.

              • 4. Re: Maven 3 and EAR
                Seth Milder Newbie

                I mean like this:


                http://www.theregister.co.uk/2007/01/23/ejbwebservices/


                Thanks!

                • 5. Re: Maven 3 and EAR
                  Jason Porter Master

                  404. Could you just describe what you want? There really isn't any reason you couldn't do it with normal POJOs, or inject local EJBs into the webservice to actually do the heavy lifting.

                  • 6. Re: Maven 3 and EAR
                    Werner Jacobs Newbie

                    Jason,


                    Can you explain a bit further?


                    Your first reason why to use EAR is clear to me. (EJB shared for multiple WARS)


                    But the second one is not very clear to me.


                    If for instance we have multiple applications and one application uses functionality of another appliction by its remote EJB interface, we can not deploy this consuming application as WAR Archive. Is my understanding correct?


                    We are about to start a project in SEAM 3 and we want to start off from a seam booking application to have a skeleton structure available.  As for now, there are no EAR example available amongst the seam 3 examples as mentionned before. So being enforced to use an EAR packaging would complicated things unnecessary.
                    Thx for your answer,


                    Werner

                    • 7. Re: Maven 3 and EAR
                      Jason Porter Master

                      If the wars are in the same ear you should be able to use the local interface because it's local to that deployment, if they're in separate ears or a different vm then you'll have to use the remote interface.

                      • 8. Re: Maven 3 and EAR
                        Werner Jacobs Newbie

                        Jason,


                        Thanks for the answer.


                        So a war packaging won't restrict the use of remote EJB which are deployed on another VM.

                        • 9. Re: Maven 3 and EAR
                          Jason Porter Master

                          I think we may have misunderstood each other. EJBs deployed in a war only support the local interface. If you need remote, you'll have to go to an ear, at least that's how I understand it.

                          • 10. Re: Maven 3 and EAR
                            Werner Jacobs Newbie

                            Jason, thanks for the follow-up.


                            I was scanning the internet about some articles which would explain this.


                            On the IBM site , I found the following article



                            IBM EJB 3



                            As I understand, remote EJB are possible inside a WAR and also the invocation of remote EJB is possible when your application is packaged as a WAR.


                            As English is not my mother tongue, can you verify if what I understood is correct.


                            So I guess there' s no explicit need for EAR packages unless you want to call services via their local interfaces. (the first reason you mentionned)


                            Thx again,


                            Werner

                            • 11. Re: Maven 3 and EAR
                              Jason Porter Master

                              Looks like I misunderstood the spec, I thought only EJB 3.1 Lite was supported in wars, but really that depends on the server, if the server is full profile then you can do everything save EJB 2.1/1.1 entity beans in a war. Of course if the container is only Web Profile then that's all you get in a war.


                              Seems to me like you only need an ear if you want to share EJBs (using their local interface) with multiple wars. :)