10 Replies Latest reply on May 30, 2007 4:54 PM by jason trump

    Using Seam gem for tomcat with and without embedded ejb3

    James Chua Newbie

      Hi

      How does everyone start their seam project? Are all using seam gen? I prefer to use tomcat because jboss take so much resources from my pc and I feel tomcat is much lighter since I won't be using the other services jboss has.

      How can I then using seam gen in tomcat with and without embedded ejb3.

      Thanks.
      james

        • 1. Re: Using Seam gem for tomcat with and without embedded ejb3
          Hung Tang Apprentice

          Hi,

          Seam-gen currently doesn't support non-EJB3 like POJO components, but that is planned for the future.

          Like you, I haven't moved to the EJB3 space yet as I am more comfortable with tomcat and just want a lighter environment.

          If you insist on Seam-gen now, I guess EJB3 is your only option. Otherwise, you could look at the two examples in the distribution: jpa, hibernate2 that shows how to deploy Seam applications to a tomcat (which requires jboss microcontainer).

          • 2. Re: Using Seam gem for tomcat with and without embedded ejb3
            Norman Richards Master

            I think I'd always rather run an app in a proper app server than in a simple web container. There are so many more deployment and management options, and applications are so much easier to work with in the JBoss. Tomcat standalone feels rather clunky and confined to me. It's like trying to use a windows shell when you are used to using a UNIX shell. You can still get things done, but it's just not a very good experience. Even if I only needed/wanted tomcat features, I'd still prefer to run a bare tomcat profile in JBoss rather than in tomcat standalone. (the installer do that now, so it's not a pain like it used to be)

            That being said, hopefully we'll be able to support more deployment options in seam-gen in the future. If it is particularly important to you, maybe you will want to chip and help out? :)

            • 3. Re: Using Seam gem for tomcat with and without embedded ejb3
              James Chua Newbie

              I am worrying about the complexity(heavy on pc resource, learning curve, hosting cost) of Jboss as I've never use it before. The only reason I am using jboss now is because of seam. Many developers of small/medium scale web apps stay away from Java is because of this reason. Just compare the hosting cost between php, tomcat, and jboss.

              But I like what you've said, and it's very convincing. What is the different between tomcat and jboss on tomcat profile? Does tomcat profile has ejb3? If not what will I gain from jboss on tomcat profile?

              Can I have all the features of seam on tomcat with embedded ejb3?

              I'll be very very glad to help out in seam development.

              james

              • 4. Re: Using Seam gem for tomcat with and without embedded ejb3
                Norman Richards Master

                You could add EJB3 to the tomcat profile but then you'd be getting close to the more fully featured app server you were trying to avoid. With tomcat on JBoss, you'd pretty much have exactly what you'd have with only tomcat but you'd have the benefit of JBoss deployment, classloading, security, clustering, logging, management, etc...

                I don't know about hosting issues. You are probably right that if someone else is providing hosting and providing the actual server, you may have more options with naked tomcat.

                You know - I don't think I've heard from anyone deploying a Seam app on tomcat+JBoss w/ embedded EJB3. I'll have to give that a try later and verify that there aren't any issues.

                • 5. Re: Using Seam gem for tomcat with and without embedded ejb3
                  Guy Davis Newbie

                  Hi Norman,

                  Our product currently ships a Java daemon that we've embedded Tomcat into. It runs as a Windows service. We are hesitant to require our clients to follow a whole other install process for JBoss along with ours. Is it possible to embed JBoss into the JVM process of another Java daemon?

                  For example, here's our Server's main():
                  public void main(String[] args) {
                  // do some of our apps startup

                  // Load Tomcat and start the listener...
                  }

                  Size on disk isn't a concern for us, so if we could hold all of JBoss in our app's install directory:
                  our_app/
                  our_app/jboss/...

                  and start JBoss programatically from the JVM of our server, then we could bundle it together.

                  If we can't then, I think I'll need to evaluate Seam running on Tomcat embedded in our server.

                  Thanks for any tips you can provide,
                  Guy

                  • 6. Re: Using Seam gem for tomcat with and without embedded ejb3
                    Gavin King Master

                    You should be OK using jboss embeddable ejb3 in this scenario.

                    • 7. Re: Using Seam gem for tomcat with and without embedded ejb3
                      Guy Davis Newbie

                       

                      "gavin.king@jboss.com" wrote:
                      You should be OK using jboss embeddable ejb3 in this scenario.


                      Hi Gavin, thanks for the response. I can run the examples using the full version of Tomcat 5.5.X, but I get the following after I put jboss-seam-booking.war example into the webapps dir for our server application which uses Tomcat embedded. Any pointers on what I can do to get around this? Thanks.

                      2007-01-25 15:17:28,267 ERROR Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
                      java.lang.RuntimeException: org.jboss.xb.binding.JBossXBException: Failed to parse source: jar:file:/C:/Development/Seam/tomcat/webapps/ROOT/WEB-INF/lib/mc-conf.jar!/embedded-jboss-beans.xml@5,45
                       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:391)
                       at org.jboss.seam.core.Ejb.startup(Ejb.java:42)
                       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:597)
                       at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:102)
                       at org.jboss.seam.Component.callComponentMethod(Component.java:1797)
                       at org.jboss.seam.Component.callCreateMethod(Component.java:1745)
                       at org.jboss.seam.Component.newInstance(Component.java:1734)
                       at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:162)
                       at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:136)
                       at org.jboss.seam.init.Initialization.init(Initialization.java:426)
                       at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
                       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.start(ContainerBase.java:1013)
                       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.startup.Embedded.start(Embedded.java:821)
                       at com.intervera.server.web.DVWebServer.start(DVWebServer.java:110)
                       at com.intervera.server.DVServer.<init>(DVServer.java:85)
                       at com.intervera.server.DVServer.main(DVServer.java:249)
                      Caused by: org.jboss.xb.binding.JBossXBException: Failed to parse source: jar:file:/C:/Development/Seam/tomcat/webapps/ROOT/WEB-INF/lib/mc-conf.jar!/embedded-jboss-beans.xml@5,45
                       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:128)
                       at org.jboss.xb.binding.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:132)
                       at org.jboss.kernel.plugins.deployment.xml.BeanXMLDeployer.deploy(BeanXMLDeployer.java:85)
                       at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.boot(EJB3StandaloneBootstrap.java:380)
                       ... 24 more
                      Caused by: java.lang.IllegalStateException: Failed to create schema loader: org.apache.xerces.dom.DOMXSImplementationSourceImpl cannot be cast to org.w3c.dom.DOMImplementationSource
                       at org.jboss.xb.binding.Util$2.run(Util.java:512)
                       at java.security.AccessController.doPrivileged(Native Method)
                       at org.jboss.xb.binding.Util.getXSImplementation(Util.java:482)
                       at org.jboss.xb.binding.Util.loadSchema(Util.java:381)
                       at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:177)
                       at org.jboss.xb.binding.sunday.unmarshalling.XsdBinder.bind(XsdBinder.java:148)
                       at org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver.resolve(DefaultSchemaResolver.java:248)
                       at org.jboss.xb.binding.sunday.unmarshalling.SundayContentHandler.startElement(SundayContentHandler.java:159)
                       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser$DelegatingContentHandler.startElement(SaxJBossXBParser.java:299)
                       at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
                       at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
                       at org.apache.xerces.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(Unknown Source)
                       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
                       at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
                       at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
                       at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
                       at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
                       at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
                       at org.jboss.xb.binding.parser.sax.SaxJBossXBParser.parse(SaxJBossXBParser.java:124)
                       ... 27 more
                      2007-01-25 15:17:28,267 ERROR Error listenerStart
                      2007-01-25 15:17:28,267 ERROR Context [] startup failed due to previous errors
                      



                      • 8. Re: Using Seam gem for tomcat with and without embedded ejb3
                        Gavin King Master

                        Aaaiii, I have no clue - Tomcat is *definitely* not my thing. Try asking in another forum....

                        • 9. Re: Using Seam gem for tomcat with and without embedded ejb3
                          Guy Davis Newbie

                          In case someone else runs into this error, I narrowed the problem down to our using Xerces as the XML parser for Jdom. I removed xerces.jar and xml-apis.jar from our build process and the problem went away. In our JDom configuration code, I needed to use the org.jdom.adapters.JAXPDOMAdapter rather than the org.jdom.adapters.XercesDomAdapter.

                          I'm not sure if JBoss doesn't like a particular version of Xerces or all versions, but switching to the JAXP parser (which is included in the JDK libraries) made this problem go away.

                          I can now run the Seam examples using the embedded EJB3 library in an embedded version of Tomcat within our Java server application.

                          Hope this helps,
                          Guy

                          • 10. Re: Using Seam gem for tomcat with and without embedded ejb3
                            jason trump Newbie

                            as a further note -- i was having the same problem using the embedded container with junit 4 and found my way to this forum thread (and many other threads reporting the same problem). In addition to the fix mentioned above, it is also possible to get unit tests (and potentially tomcat, though i haven't tried yet) to work with xerces rather than jdom.

                            the problem seems to be with Xerces version compatibility. i upgraded xerces from 2.6.2 in my unit test environment to 2.9.0 (the latest), and the problem went away.