8 Replies Latest reply on Nov 10, 2006 11:26 AM by Gavin King

    Seam on Tomcat without ejb3

    Filippo Newbie

      Is it possibile to not include jboss-ejb3-all.jar in the WAR deployed to Tomcat?
      If I don't include it, during Tomcat startup, I get an error because Seam is searching for javax/ejb/stateful.
      I noted that in hibernate example (only javabeans) this jar is included too.
      I would prefer to not include it beacuse of the size (approx 8MB) that slows down the download to client.
      thanks in advance

      Configuration:
      Seam 1.0.1.GA
      Tomcat 5.5.17


      INFO 03-10 13:14:06,546 (Http11BaseProtocol.java:init:144) -Initializing Coyote HTTP/1.1 on http-8080
      INFO 03-10 13:14:06,546 (Catalina.java:load:511) -Initialization processed in 656 ms
      INFO 03-10 13:14:06,640 (StandardService.java:start:442) -Starting service Catalina
      INFO 03-10 13:14:06,656 (StandardEngine.java:start:431) -Starting Servlet Engine: Apache Tomcat/5.5.17
      INFO 03-10 13:14:06,671 (StandardHost.java:start:716) -XML validation disabled
      INFO 03-10 13:14:07,312 (HostConfig.java:deployWAR:788) -Deploying web application archive SeamWar.war
      INFO 03-10 13:14:08,140 (FacesConfigurator.java:feedStandardConfig:151) -Reading standard config org/apache/myfaces/re
      source/standard-faces-config.xml
      INFO 03-10 13:14:08,187 (FacesConfigurator.java:feedClassloaderConfigurations:250) -Reading config jar:file:/C:/apache
      -tomcat-5.5.17/webapps/SeamWar/WEB-INF/lib/jboss-seam-debug.jar!/META-INF/faces-config.xml
      INFO 03-10 13:14:08,203 (FacesConfigurator.java:feedClassloaderConfigurations:250) -Reading config jar:file:/C:/apache
      -tomcat-5.5.17/webapps/SeamWar/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/faces-config.xml
      INFO 03-10 13:14:08,203 (FacesConfigurator.java:feedClassloaderConfigurations:250) -Reading config jar:file:/C:/apache
      -tomcat-5.5.17/webapps/SeamWar/WEB-INF/lib/jboss-seam.jar!/META-INF/faces-config.xml
      INFO 03-10 13:14:08,218 (FacesConfigurator.java:feedClassloaderConfigurations:250) -Reading config jar:file:/C:/apache
      -tomcat-5.5.17/webapps/SeamWar/WEB-INF/lib/jsf-facelets.jar!/META-INF/faces-config.xml
      INFO 03-10 13:14:08,234 (FacesConfigurator.java:feedWebAppConfig:411) -Reading config /WEB-INF/faces-config.xml
      WARN 03-10 13:14:08,328 (LocaleUtils.java:toLocale:52) -Locale name in faces-config.xml null or empty, setting locale
      to default locale : it_IT
      INFO 03-10 13:14:08,515 (StartupServletContextListener.java:initFaces:96) -ServletContext 'C:\apache-tomcat-5.5.17\web
      apps\SeamWar\' initialized.
      INFO 03-10 13:14:08,515 (SeamListener.java:contextInitialized:31) -Welcome to Seam 1.0.1.GA
      INFO 03-10 13:14:08,531 (Initialization.java:initPropertiesFromXml:119) -reading components.xml
      DEBUG 03-10 13:14:08,671 (Initialization.java:loadFromResource:247) -not found: /seam.properties
      DEBUG 03-10 13:14:08,671 (Initialization.java:loadFromResource:247) -not found: /jndi.properties
      DEBUG 03-10 13:14:08,671 (Initialization.java:loadFromResource:247) -not found: /seam-jndi.properties
      INFO 03-10 13:14:08,671 (Initialization.java:init:192) -initializing Seam
      ERROR 03-10 13:14:08,718 (StandardContext.java:listenerStart:3733) -Exception sending context initialized event to list
      ener instance of class org.jboss.seam.servlet.SeamListener
      java.lang.NoClassDefFoundError: javax/ejb/Stateful
      at org.jboss.seam.Seam.getComponentType(Seam.java:60)
      at org.jboss.seam.Component.(Component.java:172)
      at org.jboss.seam.Component.(Component.java:159)
      at org.jboss.seam.Component.(Component.java:154)
      at org.jboss.seam.Component.(Component.java:149)
      at org.jboss.seam.init.Initialization.addComponent(Initialization.java:381)
      at org.jboss.seam.init.Initialization.addComponents(Initialization.java:255)
      at org.jboss.seam.init.Initialization.init(Initialization.java:195)
      at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:32)
      at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3729)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:4187)
      at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
      at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:809)
      at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:698)
      at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:472)
      at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1122)
      at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310)
      at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1021)
      at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
      at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1013)
      at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
      at org.apache.catalina.core.StandardService.start(StandardService.java:450)
      at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
      at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
      ERROR 03-10 13:14:08,750 (StandardContext.java:start:4188) -Error listenerStart
      ERROR 03-10 13:14:08,750 (StandardContext.java:start:4215) -Context [/SeamWar] startup failed due to previous errors

      DEBUG 03-10 13:14:08,750 (Lifecycle.java:endApplication:130) -Undeploying, destroying application context
      DEBUG 03-10 13:14:08,750 (Contexts.java:destroy:184) -destroying: org.jboss.seam.properties
      DEBUG 03-10 13:14:08,765 (Contexts.java:destroy:184) -destroying: org.apache.catalina.jsp_classpath
      DEBUG 03-10 13:14:08,765 (Contexts.java:destroy:184) -destroying: javax.servlet.context.tempdir
      DEBUG 03-10 13:14:08,765 (Contexts.java:destroy:184) -destroying: org.apache.myfaces.shared_impl.webapp.webxml.WebXml
      DEBUG 03-10 13:14:08,765 (Contexts.java:destroy:184) -destroying: org.apache.myfaces.webapp.StartupServletContextListen
      er.FACES_INIT_DONE
      DEBUG 03-10 13:14:08,781 (Contexts.java:destroy:184) -destroying: org.apache.myfaces.config.RuntimeConfig
      DEBUG 03-10 13:14:08,781 (Contexts.java:destroy:184) -destroying: org.apache.catalina.resources
      DEBUG 03-10 13:14:08,781 (Contexts.java:destroy:184) -destroying: org.apache.catalina.WELCOME_FILES
      INFO 03-10 13:14:09,203 (ApplicationContext.java:log:646) -org.apache.webapp.balancer.BalancerFilter: init(): ruleChai
      n: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Re
      direct URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName /
      Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverything
      Rule: Redirect URL: http://jakarta.apache.org]]
      INFO 03-10 13:14:09,437 (ApplicationContext.java:log:646) -ContextListener: contextInitialized()
      INFO 03-10 13:14:09,453 (ApplicationContext.java:log:646) -SessionListener: contextInitialized()
      INFO 03-10 13:14:09,578 (ApplicationContext.java:log:646) -ContextListener: contextInitialized()
      INFO 03-10 13:14:09,593 (ApplicationContext.java:log:646) -SessionListener: contextInitialized()
      INFO 03-10 13:14:09,781 (Http11BaseProtocol.java:start:156) -Starting Coyote HTTP/1.1 on http-8080
      INFO 03-10 13:14:10,031 (ChannelSocket.java:init:374) -JK: ajp13 listening on /0.0.0.0:8009
      INFO 03-10 13:14:10,031 (JkMain.java:start:343) -Jk running ID=0 time=0/31 config=null
      INFO 03-10 13:14:10,093 (StoreLoader.java:load:229) -Find registry server-registry.xml at classpath resource
      INFO 03-10 13:14:10,140 (Catalina.java:start:559) -Server startup in 3594 ms

        • 1. Re: Seam on Tomcat without ejb3
          Gavin King Master

          There is a smaller jar that just contains the EJB3 standard annotations and interfaces. Its small. You could include that instead.

          • 2. Re: Seam on Tomcat without ejb3
            Filippo Newbie

            Do you mean

            jboss-ejb3.jar (19 kB)
            jboss-annotations-ejb3.jar (31 kB)

            distributed with ejb3.deployer?
            I'll give it a try.

            thanks Gavin.

            • 3. Re: Seam on Tomcat without ejb3
              Filippo Newbie

              It works!

              Now libraries are 7.5 MB instead of default 20 MB.
              I wonder if it's possible to slim it down again to reach the size of 3-4 MB.
              Is there a plan to supply a truly minimal set of libraries along with the standard distribution which already has jboss-all.jar, hibernate-all.jar and so on? I think it could be very useful in those cases where the application is distributed to clients.

              Mi set of library is actualy composed by (in KB):

              hibernate3.jar 2063
              xercesImpl 1176
              commons-collections-3.1.jar 547
              myfaces-impl-1.1.3.jar 512
              jboss-seam.jar 438
              jboss-common.jar 419
              jboss-xml-binding.jar 389
              hibernate-annotations.jar 331
              cglib.jar 321
              dom4j.jar 297
              jsf-facelets.jar 285
              myfaces-api-1.1.3.jar 247
              jboss-microcontainer.jar 211
              xml-apis.jar 190
              commons-beanutils-1.7.0.jar 185
              concurrent.jar 167
              commons-digester-1.6.jar 165
              el-ri.jar 96
              jboss-container.jar 59
              jboss-seam-ui.jar 54
              ejb3-persistence.jar 49
              jboss-annotations-ejb3.jar 31
              my-jms.jar 26
              el-api.jar 24
              jboss-dependency.jar 20
              jboss-ejb3.jar 19
              jstl.jar 17
              jboss-seam-debug.jar 5
              namespace.jar 3

              where my-jms.jar contains temporarily all jms related classes (I still haven't found the official package...)

              • 4. Re: Seam on Tomcat without ejb3
                h b Newbie

                Did anyone manage to find a solution to this ...


                Exception sending context initialized event to listener instance of class org.jboss.seam.servle
                t.SeamListener
                java.lang.NoClassDefFoundError: javax/ejb/Stateful
                at org.jboss.seam.Seam.getComponentType(Seam.java:60)
                at org.jboss.seam.Component.(Component.java:172)
                at org.jboss.seam.Component.(Component.java:159)
                at org.jboss.seam.Component.(Component.java:154)


                I tried removing the ejb3-all.jar and that breaks my build. So I have to add it.

                • 5. Re: Seam on Tomcat without ejb3
                  Gavin King Master

                  Seam 1.1.BETA2 is much less dependent upon EJB3, so you can run w/o the ejb3 jars.

                  • 6. Re: Seam on Tomcat without ejb3
                    h b Newbie

                    Thanks Gavin,
                    What I realised is I hit a big blunder while reading the installation instructions. The jboss that i installed SHOULD/MUST use the ejb profile. I selected the "all". So I reinstalled jboss with ejb profile and bingo!!!.

                    Thanks tho, for the quick response. I wil try to make my project ejb3 independant now.

                    • 7. Re: Seam on Tomcat without ejb3
                      Joseph Nusairat Newbie

                       

                      "gavin.king@jboss.com" wrote:
                      Seam 1.1.BETA2 is much less dependent upon EJB3, so you can run w/o the ejb3 jars.


                      I am curious what do you mean by that?

                      Whats the big change?

                      • 8. Re: Seam on Tomcat without ejb3
                        Gavin King Master

                        I'm just careful about what classes import javax.ejb.