6 Replies Latest reply on Jul 15, 2011 8:45 PM by Russell Bateman

    Help for Seam Catch

    Russell Bateman Newbie

      New to Seam forums. Could someone direct me to the right forum in which to ask Seam Catch questions?


        • 1. Re: Help for Seam Catch
          John Ament Master

          This would be it.  what's your question?

          • 2. Re: Help for Seam Catch
            Russell Bateman Newbie

            I'm struggling with what appears to be the one (and only) example of code integrating Seam Catch. I've played with that example (NavigationServlet); not all lessons are getting learnt, I guess.

            In particular, I'd like to see a trimmed down NavigationServlet.service() method devoid of extra stuff, i.e.: without any explicit reference to NavigationEnum in the try block (set up just to force the catch mechanism to engage?) and, if possible, the catch block (or a longer discussion of what the comment on that block means).

            Uh, I readily admit that I'm several bricks short of a ton on this, but I really like what I think Seam Catch will do for me. I'm trying to implement it in my own code and I struggle with a) the explicit consumption an example of which is noted above and b) not ever hitting breakpoints I set inside (my own) methods of either class ServerHandlerDeclaration or HandlerOutput. (Yes, I've kept pretty much the exact names of the example.)

            I'm aware that I'm not asking pointed enough questions because I don't have this stuff down enough yet.

            To help you avoid digging around for this example, I've posted (only slightly mucked with) code for it at http://www.javahotchocolate.com/tutorials/seam-catch.html navserv. (Fix this up: the forum editor wouldn't let me insert it.)

            Profuse thanks for any help you can give to nudge me toward understanding.


            • 3. Re: Help for Seam Catch
              Jason Porter Master

              What you have thus far is correct, not sure why you're not seeing break points being hit. There's also updated docs (I haven't done a release yet, if you'd like to build it from github please give me feedback) in an unreleased version.

              The simplest example I can give you is this:

              public class MyClass {
                  @Inject Event<ExecptionToCatch> catchEvent;
                  public void myMethod() {
                      try {
                          throw new Exception("Uh, um, out of ideas");
                      } catch (Exception e) {
                          catchEvent.fire(new ExceptionToCatch(e));
              public class ExceptionHandlerContainer() {
                  public void exceptionHandler(@Handles CaughtException<Exception> caught) {

              Make sure you have your beans.xml in the right place so CDI will pickup your beans, the rest should be working just fine. Please respond with any further questions (also hopefully with feedback about the changes to the documentation).

              • 4. Re: Help for Seam Catch
                Russell Bateman Newbie


                The missing bean.xml might be the problem. I have assumptions that may not hold?

                I'm the one at the JUG meeting that asked if this can be done without dragging all of Seam into the mix. I've demonstrated to myself that this is possible just as you said, and I point this out in my (very emerging) research document on Seam Catch a link to which was in my question.

                However, the WEB-INFO/bean.xml in NavigationServlet is empty (except for the header). I note that WEB-INFO/web.xml is empty too.

                I'm writing a REST service using Eclipse, JAX-RS (Jersey) and Tomcat (oops, did I say that? Sorry, but I still want to use Seam Catch 'cause it's such a killer idea. Yeah, Tomcat is a requirement.)

                If you can endure it, I have built a demo application in Eclipse around the minimalist example you gave in your response here and documented my progress in trying to make it work. I hope it's worth it to you to take a look and that, if you do, my stupidity will become immediately apparent. (I'd like to claim that this would somehow help you refine your presentation or documentation, but I'm probably still more clueless than the average bear having sought refuge in Java/JEE only 5 years ago from C/assembly--gasp!)


                Again, thanks for the help whether or not you have the time to pursue this.


                • 5. Re: Help for Seam Catch
                  Jason Porter Master

                  If you're trying to run in SE, please read the documentation at http://docs.jboss.org/weld/reference/1.1.0.Final/en-US/html/gettingstarted.html#tomcat

                  For help getting things up and running inside a servlet container (too bad I can't persuade you to use JBoss AS7 :) look at

                  I know I may be tossing a lot at you, but if you'd really like to play around with things, I strongly suggest using Arquillian. You can take a look at the latest code (I just released Seam Catch 3.1.0.Alpha today, it's all in up there in github) in the tests to get an idea of how to use it.

                  For the current ease of use though, I'd suggest getting it up and running inside tomcat or an EE server though (Glassfish or JBoss will probably be the easiest as there's less configure and setup). If you're going to be at the UJUG north meeting next week we can touch base and discuss this a bit further. I could also (probably) come to your work and demo / present.

                  • 6. Re: Help for Seam Catch
                    Russell Bateman Newbie

                    Thanks, I'm beginning to see.

                    Ordinarily, I attend south since I live 2 miles from it, however, this is tempting. I work for HP in American Fork. I know we'd love to have you. I'll look for you next Thursday.