Seam book examples updated to Seam 2.0.0.GA

As a service to my readers, I have updated all examples in my JBoss Seam book to Seam 2.0.0.GA.

Go download the zip file here

The example applications are fully tested against JBoss AS 4.2.0 GA.

NOTE: To build the examples, you now need to download and unzip Seam 2.0.0.GA first, and then set the build.properties file to point to the Seam installation directory.

12 Responses to “Seam book examples updated to Seam 2.0.0.GA”

  1. Hussein Baghdadi Says:

    Thanks Michael.
    How did you find the migration, smooth or hard?

  2. Francisco Antônio Says:

    Thank you very much Michael!

    By the way, are you planning a new book targetted(?) to Seam 2.0?

  3. Michael Yuan Says:

    Hussein,

    There are a few configuration changes I had to make (e.g., the components.xml is different now and the dependency jars have changed). But there is no code changes. :) Overall, I found it is pretty easy to migrate.

    Just make sure that you read the migration guide in Seam 2 distribution.

    cheers
    Michael

  4. Michael Yuan Says:

    Francisco,

    Yes, I am updating the book for Seam 2 (and add a few chapters to cover new features).

    The goal is to start making the book available on Safari online starting from Jan 2008 and have the paperback out Q2 2008.

    cheers
    Michael

  5. Sart Valcerou Says:

    Hi Michael !
    I just read your book and have some stupid questions.. =)

    The first one is about examples..
    In crud application there is a single entity bean(Person) and this example works great but i can’t understand how does it work even without actual database ?

    And i’m wondering why you there are no any chapters that describes how to use Seam with assosiated tables.

    Thanks in advance.

  6. ivon Says:

    Hi Michael !

    I hava a question.How to use “jboss tools” to build the example?

    Thanks a lot.

  7. marc Says:

    i noticed a problem with your booking example…

    if you use the wrong username or password

    this error happen:


    ERROR [SeamLoginModule] Error invoking login method
    javax.el.ELException: javax.ejb.EJBTransactionRolledbackException: @Out attribute requires non-null value: authenticator.user
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:332)
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
    at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
    at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:108)
    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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
    at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
    at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
    at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
    at org.jboss.seam.security.Identity.authenticate(Identity.java:335)
    at org.jboss.seam.security.Identity.authenticate(Identity.java:324)
    at org.jboss.seam.security.Identity.quietLogin(Identity.java:265)
    at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:182)
    at org.jboss.seam.security.Identity.isLoggedIn(Identity.java:172)
    at org.jboss.seam.security.Identity.authenticate(Identity.java:322)
    at org.jboss.seam.security.Identity.login(Identity.java:237)
    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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
    at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:341)
    at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
    at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
    at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
    at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
    at javax.faces.component.UICommand.broadcast(UICommand.java:383)
    at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
    at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
    at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
    at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
    at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
    at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
    at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
    at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
    at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: javax.ejb.EJBTransactionRolledbackException: @Out attribute requires non-null value: authenticator.user
    at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)

  8. Michael Yuan Says:

    Yeah, I should have “required=false” in the @Out annotation to prevent this exception.

  9. Hussein Says:

    Hi Michael,
    Sorry for bothering you but I need your help.
    I’m trying to create a Seam POJO war application (JavaBeans and entities).
    For persistence, I’m using Seam managed Hibernate sessions.
    How to unit testing those classes that get Session object injected into them?
    Unfortunately, Seam’s examples don’t include such unit tests to use as a guide.
    Thanks Sir.

  10. Michael Yuan Says:

    Hussein,

    Official Seam examples have unit tests running with TestNG. JUnit is easy to do as well. Read the book. :) Basically, you need to bootstrap an EntityManager in your test setup and close it when you teardown.

    cheers
    Michael

  11. Koral Says:

    Thanks Michael, this is great!

  12. marcos Says:

    hi,

    can I make the Identity available to lets say a spring bean used as a service?

    if that is possible, how would be the best way to achieve that?

    thank you
    regards

Leave a Reply