14 Replies Latest reply on Dec 15, 2006 2:06 PM by adsf adsf

    Referencing global view-id variables from .jpdl.xml

    adsf adsf Newbie

      Hello,

      is it somehow possible to declare 'global view-id variables' and reference them in .jpdl.xml files?

      I.e. one has a 20+ pageflows that all end on the 'home' page. Now, instead of setting the view-id of the end state of every single of these >20 pageflows to '/home.xhtml', one sets the view-id of the end state to 'home' and declares 'home' in navigation.xml or faces-config.xml like this:

      <navigation-case>
       <from-outcome>home</from-outcome>
       <to-view-id>/home.xhtml</to-view-id>
       <redirect />
      </navigation-case>

      (just like one would do without using pageflows)
      I'm asking because i get
      javax.servlet.ServletException: ViewId must start with '/' (viewId = home)
      when I try this :(.

      IMHO it would be pretty useful if an additional layer of indirection is available because without this one had to edit every single .jpdl.xml file if one wants to change the 'home' page instead of only the navigation-case tag. Further this violates the DRY principle.

      The differentiation could be done by checking if the view-id start with / or not and it shouldn't produce overhead because this file is read on startup, therefore every reference could be substituted by the 'real' value on startup.

      What do you think? - i would love to do this in bigger projects!

        • 1. Re: Referencing global view-id variables from .jpdl.xml
          adsf adsf Newbie

          Hey Gavin,

          sorry for being so pushy but could you please tell me if this is possible - or if this isn't possible ATM consider implementing this ;)

          IMHO it would be very useful to have that additional layer of indirection - if one wants / needs it - to manage bigger projects.

          Thanks a lot in advance.

          • 2. Re: Referencing global view-id variables from .jpdl.xml
            Gavin King Master

            I really don't see this as very valuable. There's not much diff b/w "home" and "/home.xhtml", and you can easily do text search/replace on the second one.

            If you really need to do this, use an XML external entity definition, ie. define &home; to be "/home.xhtml".

            • 3. Re: Referencing global view-id variables from .jpdl.xml
              adsf adsf Newbie

              Thank you for your answer, but I'm not sure if you understood me right.

              What I want to do is to define some '_virtual_ location', like some logical place in my app - i.e. 'home' to be 'home.xhtml' in navigation.xml.

              Now i would like to refer to 'home' in my .jpdl.xml files. The advantage is - when i have a lot of .jpdl.xml files that reference 'home' and i want to change it from 'home.xhtml' to 'index.xhtml' - that i don't have to manually edit - or do find & replace - every single .jpdl.xml file but can simply change 'home.xhtml' to 'index.xhtml' in my navigation.xml file, without touching every single .jpdl.xml file. So the difference is not the '/' but more logical place vs. URL.

              IMO this could be pretty useful for managing / reorganizing big projects with many .jpdl.xml files - it makes this work a lot easier ant eliminates some copy paste errors.

              • 4. Re: Referencing global view-id variables from .jpdl.xml
                adsf adsf Newbie

                Sry, pressed on submit instead of preview.

                Was that wat you understood? If so could you please give me a hint / link - if you have one at hand - where i can find some information about 'XML external entity definition'.

                Thanks a lot

                • 5. Re: Referencing global view-id variables from .jpdl.xml
                  Gavin King Master

                  So use an XML external entity definition.

                  • 6. Re: Referencing global view-id variables from .jpdl.xml
                    adsf adsf Newbie

                    I'm sorry to bring this up again but I spent the last 10 hours trying to figure out how to do this with .xsd xml schemes with the result that I'm utterly sick & tired of this xml crap but nothing else.

                    As far as I understood it external entities work only if one uses dtds not with xsds?!

                    All I want to do is define a few elements in file1 and then include this in file2 - filexyz.

                    So - _please_ can someone give me:
                    1. a short example how my file1 has to look
                    2. how to include file1 in file2+ (file2+ has to use .xsd schemes!)
                    3. how to reference the entities defind in file1 - i assume i should use '&foo;'

                    Thanks for any help!

                    • 7. Re: Referencing global view-id variables from .jpdl.xml
                      Norman Richards Master

                      This is rather tricky, but you can use a DTD entity with a schema. Here's an example I just tested with components.xml:

                      <!DOCTYPE components
                      [
                      <!ENTITY myinfo SYSTEM "resource:WEB-INF/include.txt">
                      ]>
                      <components xmlns:pay="http://jboss.com/products/seam/examples/seampay"
                      xmlns:core="http://jboss.com/products/seam/core"
                      xmlns:framework="http://jboss.com/products/seam/framework">
                      .... use &myinfo; somewhere


                      Obviously "include.txt" here would would go in the WEB-INF dir next to components.xml. It's kind of tricky to get an entity reference that will work well both at runtime and in an xml editor. I'm open to suggestions if anyone knows a better solution.


                      • 8. Re: Referencing global view-id variables from .jpdl.xml
                        Norman Richards Master

                        Actually, it turns out to be even easier with the jpdl.xml files since everything lines up correctly at the top of the EAR. (for a normal app)

                        <?xml version="1.0"?>
                        
                        <!DOCTYPE pageflow-definition
                        [
                        <!ENTITY everything SYSTEM "resource:everything.txt">
                        ]>
                        <pageflow-definition name="newuser">
                         &everything;
                        </pageflow-definition>
                        


                        everything.txt shold be at the top of the ear, next to the jpdl.xml file.

                        • 9. Re: Referencing global view-id variables from .jpdl.xml
                          adsf adsf Newbie

                          Hey Norman,

                          thanks a lot for your help. But IMHO this xml solution isn't really good because:

                          1. it is not possible to have more than one entity per file (please correct me if I'm wrong on that), therefore one would end up with a lot of files just containing '/foo.xhmtl', '/bar.xhtml', ...

                          2. one can't use it in attributes (i.e. "view-id="&home;") because:

                          org.dom4j.DocumentException: Error on line 30 of document : The external entity reference "&home;" is not permitted in an attribute value. Nested exception: The external entity reference "&home;" is not permitted in an attribute value.


                          Therefore I discarded this solution and had a look at the seam sources - and came up with the following:

                          The following method expects the path to the web project on the _filesystem_ (like it is returned from '((ServletContext) facesContext.getExternalContext().getContext()).getRealPath("")') and returns a HashMap containing 'from-outcome' as keys and 'to-view-id' as values read from configFiles[] (all dependencies are a few dom4j classes):
                          private static HashMap<String, String> createViewMap(String realPathPrefix) {
                           String[] configFiles = {
                           "WEB-INF" + File.separator + "faces-config.xml",
                           "WEB-INF" + File.separator + "navigation.xml" };
                           HashMap<String, String> map = new HashMap<String, String>();
                           for (int i = 0; i < configFiles.length; i++) {
                           Document doc = null;
                           File file = null;
                           try {
                           file = new File(realPathPrefix + File.separator + configFiles[ i ]);
                           doc = new SAXReader().read(file);
                           } catch (DocumentException e) {
                           System.out.println("Can't read navigation rules from file: " + file.getAbsolutePath());
                           continue;
                           }
                           Element rootElement = doc.getRootElement();
                           Iterator rootIterator = rootElement
                           .elementIterator("navigation-rule");
                           while (rootIterator.hasNext()) {
                           Element element = (Element) rootIterator.next();
                           if (element.element("from-view-id") == null
                           || element.element("from-view-id").getText().equals("*")) {
                           Element navigationCase = element.element("navigation-case");
                           map.put(navigationCase.element("from-outcome").getText(),
                           navigationCase.element("to-view-id").getText());
                           }
                           }
                           }
                           return map;
                          }

                          Now all left to do would be to add a check to org.jboss.seam.pageflow.Page.read to see if the viewId starts with a / and, if it does not start with a /, replace it with the value obtained from the HashMap for said viewId as key.

                          There's no additional overhead because all necessary stuff can be done on initialization.

                          So could you guys _please_ reconsider your decision and add this to seam?! This would be really helpful and I already did almost all necessary work ;)

                          • 10. Re: Referencing global view-id variables from .jpdl.xml
                            Norman Richards Master

                            You can have any number of entities, but entities are not allowed in attribute values.

                            If it were me, I wouldn't try to solve this problem using entities. I don't like the use of entities in general, and I particularly dislike using them in this manner. I would simply do textual transformation when you construct your ear, the same way we do the build files.

                            • 11. Re: Referencing global view-id variables from .jpdl.xml
                              Gavin King Master

                              Just especially for you, sir, I added a protected method named getViewId(Page) to org.jboss.seam.core.Pageflow, so that you can override that method and do whatever crazy thing you like in it ;-)

                              • 12. Re: Referencing global view-id variables from .jpdl.xml
                                adsf adsf Newbie

                                Hey Gavin,

                                thank you very much for this change! I really appreciate this :)

                                Just allow me 2 more questions:

                                1. How am I supposed to extend this / bind my own class in seam?

                                What i tried was: I copied the whole org.jboss.seam.core.Pageflow class, changed the package declaration and set the 'precedence' attribute of @Install to 'APPLICATION'.

                                Then i get the following errors on every page request that does _not_ involve pageflows:

                                18:46:12,655 ERROR [PhaseListenerManager] Exception in PhaseListener RESTORE_VIEW(1) afterPhase
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRestoreView(AbstractSeamPhaseListener.java:59)
                                 at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:73)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:181)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:46:12,659 INFO [Pages] reading pages.xml
                                18:46:12,670 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) beforePhase.
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.core.FacesPage.storePageflow(FacesPage.java:67)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:220)
                                 at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:51)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)


                                When i access a page that relies upon a pageflow I get the following:

                                18:56:51,608 ERROR [PhaseListenerManager] Exception in PhaseListener RESTORE_VIEW(1) afterPhase
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRestoreView(AbstractSeamPhaseListener.java:59)
                                 at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:73)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:181)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:51,610 ERROR [PhaseListenerManager] Exception in PhaseListener APPLY_REQUEST_VALUES(2) beforePhase.
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforePhase(AbstractSeamPhaseListener.java:113)
                                 at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:58)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.applyRequestValues(LifecycleImpl.java:207)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:71)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:51,616 ERROR [PhaseListenerManager] Exception in PhaseListener PROCESS_VALIDATIONS(3) beforePhase.
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforePhase(AbstractSeamPhaseListener.java:113)
                                 at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:58)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:250)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:76)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:51,619 ERROR [PhaseListenerManager] Exception in PhaseListener UPDATE_MODEL_VALUES(4) beforePhase.
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforePhase(AbstractSeamPhaseListener.java:113)
                                 at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:58)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.updateModelValues(LifecycleImpl.java:290)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:81)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:51,624 ERROR [PhaseListenerManager] Exception in PhaseListener INVOKE_APPLICATION(5) beforePhase.
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforePhase(AbstractSeamPhaseListener.java:113)
                                 at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:58)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:331)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:51,661 INFO [STDOUT] edit...
                                18:56:51,661 INFO [STDOUT] usecaseId: 1
                                18:56:51,661 INFO [STDOUT] loadUsecaseById...
                                18:56:51,661 INFO [STDOUT] usecaseId: 1
                                18:56:51,661 INFO [STDOUT] Hibernate: select usecase0_.ID as ID184_2_, usecase0_.name as name184_2_, usecase0_.priority as priority184_2_, usecase0_.version as version184_2_, usecase0_.status as status184_2_, usecase0_.ExtendedPoint_ID as Extended7_184_2_, usecase0_.summary as summary184_2_, usecase0_.standardWorkflow as standard8_184_2_, extensionp1_.ID as ID185_0_, extensionp1_.name as name185_0_, extensionp1_.description as descript3_185_0_, extensionp1_.Usecase_ID as Usecase4_185_0_, usecase2_.ID as ID184_1_, usecase2_.name as name184_1_, usecase2_.priority as priority184_1_, usecase2_.version as version184_1_, usecase2_.status as status184_1_, usecase2_.ExtendedPoint_ID as Extended7_184_1_, usecase2_.summary as summary184_1_, usecase2_.standardWorkflow as standard8_184_1_ from Usecase usecase0_ left outer join ExtensionPoint extensionp1_ on usecase0_.ExtendedPoint_ID=extensionp1_.ID left outer join Usecase usecase2_ on extensionp1_.Usecase_ID=usecase2_.ID where usecase0_.ID=?
                                18:56:51,721 INFO [STDOUT] Usecase: Login User
                                18:56:53,695 ERROR [STDERR] globalhelp -> /menu/generalHelp.jsp
                                18:56:53,695 ERROR [STDERR] home -> /home.xhtml
                                18:56:53,695 INFO [STDOUT] usecase.getId: 1
                                18:56:53,701 ERROR [Exceptions] redirecting to debug page
                                javax.ejb.EJBTransactionRolledbackException: java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:93)
                                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
                                 at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
                                 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.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
                                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                 at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
                                 at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
                                 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.stateful.StatefulContainer.localInvoke(StatefulContainer.java:203)
                                 at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:98)
                                 at $Proxy318.edit(Unknown Source)
                                 at com.example.usecases.beans.Usecases$$FastClassByCGLIB$$9406d228.invoke(<generated>)
                                 at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
                                 at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
                                 at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:73)
                                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
                                 at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
                                 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.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                                 at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                                 at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:38)
                                 at sun.reflect.GeneratedMethodAccessor350.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                                 at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                                 at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
                                 at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
                                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
                                 at org.jboss.seam.intercept.ClientSideInterceptor.interceptInvocation(ClientSideInterceptor.java:82)
                                 at org.jboss.seam.intercept.ClientSideInterceptor.intercept(ClientSideInterceptor.java:51)
                                 at org.jboss.seam.intercept.Proxy$$EnhancerByCGLIB$$6eb2a3fb.edit(<generated>)
                                 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 com.sun.el.parser.AstValue.invoke(AstValue.java:151)
                                 at com.sun.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:283)
                                 at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
                                 at com.sun.facelets.el.LegacyMethodBinding.invoke(LegacyMethodBinding.java:69)
                                 at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
                                 at javax.faces.component.UICommand.broadcast(UICommand.java:106)
                                 at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:94)
                                 at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:168)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:343)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                Caused by: java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.interceptors.ConversationInterceptor.beginNavigation(ConversationInterceptor.java:196)
                                 at org.jboss.seam.interceptors.ConversationInterceptor.beginConversation(ConversationInterceptor.java:183)
                                 at org.jboss.seam.interceptors.ConversationInterceptor.beginConversationIfNecessary(ConversationInterceptor.java:119)
                                 at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
                                 at sun.reflect.GeneratedMethodAccessor353.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                                 at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                                 at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:50)
                                 at sun.reflect.GeneratedMethodAccessor352.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                                 at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                                 at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                                 at sun.reflect.GeneratedMethodAccessor351.invoke(Unknown Source)
                                 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                 at java.lang.reflect.Method.invoke(Method.java:585)
                                 at org.jboss.seam.util.Reflections.invoke(Reflections.java:18)
                                 at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
                                 at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
                                 at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
                                 at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
                                 at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
                                 at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:49)
                                 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.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
                                 at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
                                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                 at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
                                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                 at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
                                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                 at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
                                 at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
                                 at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
                                 ... 82 more
                                18:56:53,709 INFO [SeamExceptionFilter] killing transaction
                                18:56:53,724 ERROR [PhaseListenerManager] Exception in PhaseListener RESTORE_VIEW(1) afterPhase
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.afterRestoreView(AbstractSeamPhaseListener.java:59)
                                 at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:73)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersAfter(PhaseListenerManager.java:89)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:181)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:54,208 ERROR [STDERR] 15.12.2006 18:56:54 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/home/stephan/opt/JBoss-4.0.5/server/default/./deploy/Usecases.ear/Usecases.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/seam.taglib.xml
                                18:56:54,211 ERROR [STDERR] 15.12.2006 18:56:54 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/home/stephan/opt/JBoss-4.0.5/server/default/./deploy/Usecases.ear/Usecases.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
                                18:56:54,214 ERROR [STDERR] 15.12.2006 18:56:54 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/home/stephan/opt/JBoss-4.0.5/server/default/./deploy/Usecases.ear/Usecases.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-core.taglib.xml
                                18:56:54,219 ERROR [STDERR] 15.12.2006 18:56:54 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/home/stephan/opt/JBoss-4.0.5/server/default/./deploy/Usecases.ear/Usecases.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-ui.taglib.xml
                                18:56:54,225 ERROR [STDERR] 15.12.2006 18:56:54 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/home/stephan/opt/JBoss-4.0.5/server/default/./deploy/Usecases.ear/Usecases.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-core.taglib.xml
                                18:56:54,229 ERROR [STDERR] 15.12.2006 18:56:54 com.sun.facelets.compiler.TagLibraryConfig loadImplicit
                                INFO: Added Library from: jar:file:/home/stephan/opt/JBoss-4.0.5/server/default/./deploy/Usecases.ear/Usecases.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jsf-html.taglib.xml
                                18:56:54,255 INFO [[/Usecases]] WARNING: Component _id75 just got an automatic id, because there was no id assigned yet. If this component was created dynamically (i.e. not by a JSP tag) you should assign it an explicit static id or assign it the id you get from the createUniqueId from the current UIViewRoot component right after creation!
                                18:56:54,399 ERROR [PhaseListenerManager] Exception in PhaseListener RENDER_RESPONSE(6) beforePhase.
                                java.lang.ClassCastException: com.example.usecases.web.Pageflow
                                 at org.jboss.seam.core.Pageflow.instance(Pageflow.java:74)
                                 at org.jboss.seam.core.FacesPage.storePageflow(FacesPage.java:67)
                                 at org.jboss.seam.jsf.AbstractSeamPhaseListener.beforeRender(AbstractSeamPhaseListener.java:220)
                                 at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:51)
                                 at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:70)
                                 at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:373)
                                 at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                                 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                                 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                                 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                                 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                                 at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                                 at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                                 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                                 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                                 at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
                                 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                                 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                                 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                                 at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                                 at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                                 at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                                 at java.lang.Thread.run(Thread.java:595)
                                18:56:54,400 INFO [SeamExceptionFilter] killing transaction


                                The seam debug page shows me the following for the pageflow component:

                                - Component (org.jboss.seam.core.pageflow)
                                class class com.example.usecases.web.Pageflow
                                inProcess false
                                node
                                page java.lang.IllegalStateException[pageflow is not currently at a <page> or <start-page> node (note that pageflows that begin during the RENDER_RESPONSE phase should use <start-page> instead of <start-state>)]
                                pageViewId java.lang.IllegalStateException[pageflow is not currently at a <page> or <start-page> node (note that pageflows that begin during the RENDER_RESPONSE phase should use <start-page> instead of <start-state>)]
                                pageflowCounter 0
                                processInstance
                                toString() Pageflow(null)


                                So what am i missing? Is this the right way to inject my own class as the pageflow component into seam (when i use the 'official' (your) pageflow everything works fine)?

                                My 2nd question is:
                                AFAIK I need to get the real path of the application on the _filesystem_ (like it is returned from '((ServletContext) facesContext.getExternalContext().getContext()).getRealPath("")') to find the navigation configuration files.

                                So whats the easiest way to find it out? Is is stored in a variable of a seamcomponent? Or can i inject a facesContext into my pageflow class? How would you sole this?


                                Again, thanks for your advice / help ;)

                                • 13. Re: Referencing global view-id variables from .jpdl.xml
                                  Gavin King Master

                                   

                                  @Name("org.jboss.seam.core.pageflow")
                                  public class MyPageflow extends Pageflow {
                                  
                                   @Override protected String getViewId(Page page)
                                   {
                                   return ....;
                                   }
                                  
                                  }


                                  APPLICATION is the default precedence, so you don't need to specify it explicitly.

                                  • 14. Re: Referencing global view-id variables from .jpdl.xml
                                    adsf adsf Newbie

                                    Thanks Gavin, now it's working like a charm :)

                                    In case anyone is interested my solution is the following:

                                    package com.example.usecases.web;
                                    
                                    import java.io.File;
                                    import java.util.HashMap;
                                    import java.util.Iterator;
                                    
                                    import javax.faces.context.FacesContext;
                                    import javax.servlet.ServletContext;
                                    
                                    import org.dom4j.Document;
                                    import org.dom4j.DocumentException;
                                    import org.dom4j.Element;
                                    import org.dom4j.io.SAXReader;
                                    import org.jboss.seam.annotations.In;
                                    import org.jboss.seam.annotations.Name;
                                    import org.jboss.seam.core.Pageflow;
                                    import org.jboss.seam.pageflow.Page;
                                    
                                    @Name("org.jboss.seam.core.pageflow")
                                    public class MyPageflow extends Pageflow {
                                    
                                     private static final long serialVersionUID = -7905951040207871423L;
                                     private static HashMap<String, String> viewMap = null;
                                    
                                     @In(value = "org.jboss.seam.core.facesContext", required = false)
                                     private FacesContext facesContext;
                                    
                                     @Override
                                     protected String getViewId(Page page) {
                                     if(!page.getViewId().startsWith("/") && facesContext != null) {
                                     if(viewMap == null) {
                                     viewMap = createViewMap(((ServletContext) facesContext.getExternalContext().getContext()).getRealPath(""));
                                     }
                                     return viewMap.get(page.getViewId());
                                     }
                                     return super.getViewId(page);
                                     }
                                    
                                     private HashMap<String, String> createViewMap(String realPathPrefix) {
                                     String[] configFiles = {
                                     "WEB-INF" + File.separator + "faces-config.xml",
                                     "WEB-INF" + File.separator + "navigation.xml" };
                                     HashMap<String, String> viewMap = new HashMap<String, String>();
                                     for (int i = 0; i < configFiles.length; i++) {
                                     Document doc = null;
                                     File file = null;
                                     try {
                                     file = new File(realPathPrefix + File.separator + configFiles[ i ]);
                                     doc = new SAXReader().read(file);
                                     } catch (DocumentException e) {
                                     System.out.println("Can't read navigation rules from file: " + file.getAbsolutePath());
                                     continue;
                                     }
                                     Element rootElement = doc.getRootElement();
                                     Iterator rootIterator = rootElement.elementIterator("navigation-rule");
                                     while (rootIterator.hasNext()) {
                                     Element element = (Element) rootIterator.next();
                                     if (element.element("from-view-id") == null
                                     || element.element("from-view-id").getText().equals("*")) {
                                     Element navigationCase = element.element("navigation-case");
                                     viewMap.put(navigationCase.element("from-outcome").getText(),
                                     navigationCase.element("to-view-id").getText());
                                     }
                                     }
                                     }
                                     return viewMap;
                                     }
                                    }


                                    The only drawback is that the path on the filesystem is read from the servletcontext - therefore it doesn't work upon first request.

                                    If someone knows a more elegant solution i would be glad to hear it ;)