3 Replies Latest reply on Jul 14, 2011 9:28 AM by seameddie

    Exception handling question

    seameddie

      Hello.


      I used seam gen from seam version 2.2.0.GA to create a sample project (running in JBoss AS 5.1.0.GA), which i modified to display data from my underlying mssql
      server database via 'dataTable-tag' (which works fine). I marked the stateful session bean fetching my result set as @Restrict(HASH{identity.loggedIn}),
      so im getting (as i excepted) a


      org.jboss.seam.security.NotLoggedInException
      



      My problem is, that


      <exception class="org.jboss.seam.security.NotLoggedInException">
           <redirect view-id="/login.xhtml">
                <message severity="warn">#{messages['org.jboss.seam.NotLoggedIn']}</message>
           </redirect>
      </exception>
      


           
      from the components.xml (which i did NOT modify) has no effect (no redirect to the login page, i get a stack trace in my browser instead of that).


      The same entries in the components.xml of seam version 1.2.1.GA (i tried that before) worked (exception was caught, redirect happened).


      Any idea what im doing wrong? Is it possible that the seam-built-in exception handling (via components.xml) does not because in my case the exception
      occurs while rendering the xhtml page? When i simply build a new action with 'seam new-action' (from seam-gen) and i tag the corresponding bean method (which is called on
      button click) as @Restrict(HASH{identity.loggedIn}), everything works fine.


      Thx in advance,


      Stefan

        • 1. Re: Exception handling question
          piklos


          <exception class="org.jboss.seam.security.NotLoggedInException">
               <redirect view-id="/login.xhtml">
                    <message severity="warn">#{messages['org.jboss.seam.NotLoggedIn']}</message>
               </redirect>
          </exception>



          Try moving it pages.xml, it should work then.


          Cheers.




          • 2. Re: Exception handling question
            piklos

            I ment to say Try moving it to pages.xml.


            Ohh EDIT button where are you :)

            • 3. Re: Exception handling question
              seameddie

              Hello.


              Thx very much...i must have been confused when i first started the post...the xml-tag i mentioned actually IS in the pages.xml already after rebuilding the project from scratch via seam-gen...the components.xml only contains


              <event type="org.jboss.seam.security.notLoggedIn">
                  <action execute="#{redirect.captureCurrentView}"/>
              </event>
              



              However...i will spent some time googling why the error still occurs...all looks fine to me (as far as i can see as a seam rookie).


              Stefan