7 Replies Latest reply on Jul 12, 2006 12:05 AM by basel

    Accessing a protected JSF page causes

    basel

      I managed to get declarative security to work with JBoss and MySQL using FORM based authentication. Everything works fine except when I try to acess a protected JSF page. Accessing a JSF page that is not protected is perfectly fine.

      Here is what happens:
      1. I point the browser to a protected JSF page such as localhost:8080/seam_01/pro/guess.jsf
      2. The server loads the login.jsp page
      3. Entering a wrong username and password causes the error.jsp page to be displayed
      4. Accessing the same protected page agains shows the login.jsp page
      5. Upon entering valid username and password, the server returns "HTTP Status 404 - /seam_01/pro/guess.jsf"
      6. Now accessing a non-protected page such as localhost:8080/seam_01/simple.jsf is just fine
      7. Also, accessing a protected resource other than JSF pages works fine as well.

      Now going back to console I can see a long stack trace. Here are some excerpts from it:

      19:36:46,105 ERROR [STDERR] org.dom4j.DocumentException: Error on line -1 of document : Premature end of file. Nested exception: Premature end of file.
      19:36:46,106 ERROR [STDERR] at org.dom4j.io.SAXReader.read(SAXReader.java:482)
      19:36:46,106 ERROR [STDERR] at org.dom4j.io.SAXReader.read(SAXReader.java:343)
      19:36:46,106 ERROR [STDERR] at org.jboss.seam.core.Pages.initialize(Pages.java:77)
      19:36:46,106 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      ...
      
      
      19:36:46,113 ERROR [STDERR] Nested exception:
      19:36:46,113 ERROR [STDERR] org.xml.sax.SAXParseException: Premature end of file.
      19:36:46,113 ERROR [STDERR] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      19:36:46,114 ERROR [STDERR] at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
      19:36:46,114 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      19:36:46,114 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      19:36:46,114 ERROR [STDERR] at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
      19:36:46,114 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
      19:36:46,115 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      19:36:46,115 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      19:36:46,115 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      19:36:46,115 ERROR [STDERR] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      19:36:46,115 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      19:36:46,115 ERROR [STDERR] at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      19:36:46,116 ERROR [STDERR] at org.dom4j.io.SAXReader.read(SAXReader.java:465)
      19:36:46,116 ERROR [STDERR] at org.dom4j.io.SAXReader.read(SAXReader.java:343)
      19:36:46,116 ERROR [STDERR] at org.jboss.seam.core.Pages.initialize(Pages.java:77)
      ...
      
      
      19:36:46,123 ERROR [STDERR] Nested exception:
      19:36:46,123 ERROR [STDERR] org.xml.sax.SAXParseException: Premature end of file.
      19:36:46,123 ERROR [STDERR] at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
      19:36:46,124 ERROR [STDERR] at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
      19:36:46,124 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      19:36:46,124 ERROR [STDERR] at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
      19:36:46,128 ERROR [STDERR] at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
      19:36:46,129 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentScannerImpl$PrologDispatcher.dispatch(Unknown Source)
      19:36:46,129 ERROR [STDERR] at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
      19:36:46,129 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      19:36:46,129 ERROR [STDERR] at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
      19:36:46,129 ERROR [STDERR] at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
      19:36:46,130 ERROR [STDERR] at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
      19:36:46,130 ERROR [STDERR] at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
      19:36:46,130 ERROR [STDERR] at org.dom4j.io.SAXReader.read(SAXReader.java:465)
      19:36:46,130 ERROR [STDERR] at org.dom4j.io.SAXReader.read(SAXReader.java:343)
      19:36:46,130 ERROR [STDERR] at org.jboss.seam.core.Pages.initialize(Pages.java:77)
      ....
      
      
      19:36:46,138 ERROR [STDERR] Jul 8, 2006 7:36:46 PM com.sun.faces.lifecycle.LifecycleImpl phase
      WARNING: phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@309b3e5e) threw exception: java.lang.IllegalArgumentException: exception invoking: initialize exception invoking: initialize
      org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:43)
      org.jboss.seam.Component.callComponentMethod(Component.java:1334)
      org.jboss.seam.Component.callCreateMethod(Component.java:1322)
      org.jboss.seam.Component.newInstance(Component.java:1312)
      org.jboss.seam.Component.getInstance(Component.java:1263)
      org.jboss.seam.Component.getInstance(Component.java:1253)
      org.jboss.seam.Component.getInstance(Component.java:1235)
      org.jboss.seam.core.Pages.instance(Pages.java:191)
      org.jboss.seam.jsf.AbstractSeamPhaseListener.callPageActions(AbstractSeamPhaseListener.java:128)
      org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:98)
      org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:50)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:249)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      ...
      


      How can I get this working?

        • 1. Re: Accessing a protected JSF page causes
          pmuir

          It looks to me as though your pages.xml file is not well formed and causing a parsing exception.

          • 2. Re: Accessing a protected JSF page causes
            basel

            Hey petemuir,

            The file does not contain a single character and it is size is 0KB. I will try removing it once I go back home.

            • 3. Re: Accessing a protected JSF page causes
              basel

              Replacing the old pages.xml with a new one that has an empty pages tag solved part of the problem. The server still returns a 404 error code but no exceptions are thrown. Instead the following error messages are printed on the console:

              16:45:08,227 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.faces.lifecycle.LifecycleImpl populateFacesELResolverForJsp
              INFO: FacesELResolvers not registered with Jsp.
              16:45:08,292 INFO [Pages] reading pages.xml
              16:45:08,541 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/mnt/data/dev_env/jboss_4.0.4.GA_jems/server/default/deploy/seam_01.ear/seam_01.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/seam.taglib.xml
              16:45:08,579 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/mnt/data/dev_env/jboss_4.0.4.GA_jems/server/default/deploy/seam_01.ear/seam_01.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
              16:45:08,614 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/mnt/data/dev_env/jboss_4.0.4.GA_jems/server/default/deploy/seam_01.ear/seam_01.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
              16:45:08,624 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/mnt/data/dev_env/jboss_4.0.4.GA_jems/server/default/deploy/seam_01.ear/seam_01.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
              16:45:08,657 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/mnt/data/dev_env/jboss_4.0.4.GA_jems/server/default/deploy/seam_01.ear/seam_01.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
              16:45:08,668 ERROR [STDERR] Jul 9, 2006 4:45:08 PM com.sun.facelets.compiler.TagLibraryConfig loadImplicit
              INFO: Added Library from: jar:file:/mnt/data/dev_env/jboss_4.0.4.GA_jems/server/default/deploy/seam_01.ear/seam_01.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
              


              • 4. Re: Accessing a protected JSF page causes
                gavin.king

                You do not need pages.xml at all, it is an optional file!

                • 5. Re: Accessing a protected JSF page causes
                  basel

                  Hey Gavin,

                  What about the FacesELResolvers error message?

                  • 6. Re: Accessing a protected JSF page causes
                    gavin.king

                    Ignore em. I get them too. They don't seem to cause a problem.

                    • 7. Re: Accessing a protected JSF page causes
                      basel

                      Okay I will just ignore them. What should I do about the 404 status error?

                      5. Upon entering valid username and password, the server returns "HTTP Status 404 - /seam_01/pro/guess.jsf"