4 Replies Latest reply on Jan 18, 2010 12:38 PM by pieter.martin

    Ear and EJB no WAR problem

    pieter.martin

      Hi,


      I have an ear app with just one EJB, a MDB at that.


      I have a META-INF/ejb-jar.xml file and a seam.properties file in the ejb jar.


      However I am getting the following exception,



      Caused by: java.lang.IllegalStateException: Attempted to invoke a Seam component outside an initialized application
           at org.jboss.seam.contexts.Lifecycle.getApplication(Lifecycle.java:36)
           at org.jboss.seam.contexts.Lifecycle.setupApplication(Lifecycle.java:134)
           at org.jboss.seam.Seam.componentForName(Seam.java:301)
      



      I know all will be well it I add an empty WAR archive but I'd rather not.


      How can I get past this?


      Thanks
      Pieter



        • 1. Re: Ear and EJB no WAR problem
          kapitanpetko

          Why to you need Seam in the first place if you have only one MDB?

          • 2. Re: Ear and EJB no WAR problem
            pieter.martin

            Well cause I quite like having seam around. This MDB is just a demo for now but it will have to make use of other Seam components.


            In the mean time I added a empty WAR, but it would be nice not to have to do that.


            Thanks
            Pieter

            • 3. Re: Ear and EJB no WAR problem
              kapitanpetko

              pieter martin wrote on Jan 18, 2010 07:38:


              Well cause I quite like having seam around. This MDB is just a demo for now but it will have to make use of other Seam components.



              OK...



              In the mean time I added a empty WAR, but it would be nice not to have to do that.



              Seam is initialized with a servlet listener, so you need a web app for that. If really try want to do it without a
              webapp, look for ideas in the Lifecycle class. Specifically, beginApplication/beginCall/endCall/endApplication.
              You'll have to initalize Seam yourself, and you will get only event and application scopes (since there is no webapp).


              Either that or live with an empty war.


              HTH

              • 4. Re: Ear and EJB no WAR problem
                pieter.martin

                Ok thanks, I think I'll go for the empty web app for now.


                Pieter