Source Code Download for the JBoss Seam Book
I finally put up a web page for the “JBoss Seam: Simplicity and Power Beyond Java EE 5.0″ book. The page has the source code download link for the example applications in the book. Have fun!
Please use this thread to report problems / bugs with the code. Thanks. We can still make changes to the book!
October 16th, 2006 at 10:08 am
Hi, Michael.
When I ran your HelloWorld sample in JBoss 4.0.4 GA, clicking “Say Hello” button showed the following error. Can you please help? Thanks. — John
HTTP Status 500 -
——————————————————————————–
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: Error calling action method of component with id _id0:_id2
javax.faces.webapp.FacesServlet.service(FacesServlet.java:121)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
root cause
javax.faces.FacesException: Error calling action method of component with id _id0:_id2
org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
javax.faces.component.UICommand.broadcast(UICommand.java:106)
javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
note The full stack trace of the root cause is available in the Apache Tomcat/5.5.17 logs.
——————————————————————————–
Apache Tomcat/5.5.17
October 16th, 2006 at 12:02 pm
Sorry for the obvious question … But did you install 4.0.4GA from the JEMS installer as described in the “install” chapter? If you did, I will need the complete stack trace from your console or log file.
October 16th, 2006 at 2:04 pm
I installed jboss-4.0.4.GA-Patch1-installer.jar from http://labs.jboss.com/portal/jbossas/download which redirected me to http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942&release_id=416591
http://labs.jboss.com/portal/jemsinstaller brought me to http://labs.jboss.com/portal/index.html?ctrl:id=page.default.downloads&project=jemsinstaller which pointed me to http://labs.jboss.com/portal/jbossas/download
I didn’t find jboss-4.0.5-installer.jar as mentioned on page 131 of your book draft. So I installed 4.0.4 GA hoping it works the same way.
The followings are the log messages from server.log since the server starts:
2006-10-16 14:38:11,250 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/helloworld].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
[...]
Caused by: javax.ejb.EJBException: java.lang.RuntimeException: java.lang.NoSuchMethodError: javax.interceptor.InvocationContext.getTarget()Ljava/lang/Object;
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
at $Proxy74.sayHello(Unknown Source)
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.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
… 25 more
October 16th, 2006 at 2:22 pm
Yeah, that is the problem. You need to install from the JEMS installer:
http://labs.jboss.com/portal/jemsinstaller/downloads
Use 1.2.0BETA would be good. JBoss AS 4.0.5 GA will come out really soon!
Sorry for the confusion.
October 16th, 2006 at 3:11 pm
Thanks, Michael. Now it works. I guess you need to update your book draft with the correct URL http://labs.jboss.com/portal/jemsinstaller/downloads
I enjoy reading your seam book very much. Althought I’ve just finished the first 4 chapters, I have to ask a question. Does Seam ultimately free developers from coding Java in the web tier? (If we use JSF in the web tier and Seam stateful session beans replace JSF backing beans, what else do we need to program in the web tier except JSF page navigation rules?)
I apologize if my question is too naive. I am beginner in JSF and Seam. Thank you again for your timely help.
John
October 16th, 2006 at 3:43 pm
Absolutely. Thank you for the feedback. I will update the book — this is exactly what the rough cuts program is for.
Seam essentially blurs the boundary between the “web tier” and “business tier”. Everything is a “POJO component” now. So it is correct to say that in a typical Seam WAR file, you only need:
1. web pages, including EL references to backend Seam components (I am sure whether this qualifies as “programming”)
2. Navigation rules
In any case, if you are from a servlet / JSP background, JSF takes some time to get use to. But once you do. It is incrediblly easy and powerful. Have fun!
October 16th, 2006 at 4:52 pm
Michael, thank you for sharing your insight.
It looks that Seam not only blurs the boundary between presentation layer and business logic layer, but also makes the presentation layer thinner (at least from the perspective of web application development) because applications using Seam will have almost all of their logics executed in business logic layer (EJB tier).
I believe it is a good direction for enterprise web applications to follow, taking into account the upcoming wave of BPM and SOA.
Cheers,
John
October 22nd, 2006 at 8:37 am
In section 7.2 Force a Transaction Rollback, Seam treats checked exceptions differently than unchecked exceptions regarding rollback. That is, unchecked exceptions automatically cause a rollback but checked exceptions don’t unless configured to do so. I presume this is a Seam distinction and not related to JEE. Is there any way to customize this behavior, perhaps such that you can specify the parent exception for the optional rollback to be something other than Exception? For instance, I might have a subclass of RuntimeException called AppException–and that I want to be able to use the @ApplicationException annotation with it and all its subclasses.
The reason is that many consider the entire checked exception approach broken and best avoided — myself included.
October 22nd, 2006 at 2:30 pm
Hi Clark,
Thanks for the feedback. The @ApplicationException annotation is defined in EJB3 — it is not specific to Seam. So, what we change here is pretty much limited as we have to be complaint to the EJB3 spec.
Did you mean that you want to throw a RuntimException that does not trigger rollback by default (i.e., without the @ApplicationException annotation)? I am not sure how to do it. Maybe you can raise this question in our EJB3 forum. Thanks.
cheers
Michael
November 1st, 2006 at 3:45 am
Hi Michael,when can we read the sample chapters?
November 1st, 2006 at 11:33 am
Patience please! I am working with the publisher to get some early access chapters out to the public. Expect something at around the JBoss World Berlin time frame (end of Nov)!
December 6th, 2006 at 12:26 pm
I noticed today that the publication date of the book was pushed back to April next year. What happened?
December 6th, 2006 at 12:37 pm
Oh, Seam 1.1 added quite a few new features. I decided to cover them as well in the book. Sorry for the delay. In the meanwhile, I will do another update for the Safari early access readers this month!
December 8th, 2006 at 12:35 am
At what level has this book been written? What level of understanding of each of Java, JSP/Servlets, JSF, and JBoss does your book assume that readers have?
In what style is it written? (A Dummies-style book or a typical JBoss book, like the JBoss 4.0 Official Guide?)
I guess I can tell from the sample chapters…any word on when those’ll be out?
December 8th, 2006 at 1:00 am
PW,
The book assumes the readers to have basic understanding of server side Java programming (servlet, web frameworks, Hibernate, and ideally JSF). No prior knowledge of JBoss is required.
So, I guess it is neither a dummy style book or a reference guide (we already have the Seam reference guide).
A couple of sample chapters will be out in 2 weeks. So, watch this blog.
cheers
Michael
January 2nd, 2007 at 7:13 am
In the book’s examples, do you use JSP or Facelets (or both)? And what JSF components library is used (Tomahawk etc)? Thanks in advance!