Announcement Announcement Module
Collapse
No announcement yet.
Portlets IndexOutOfBoundException Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Portlets IndexOutOfBoundException

    Hi all,

    I have a Webflow 2.2.1, JSF 1.2 (Mojorra) application in a portlet environment (jetspeed).

    When adding the application I get the following error (and the portlet has no content, just its title-bar):
    see file log.txt in log.zip.

    I have no idea what the problem might be.
    The following files are in the attached zip:
    web.xml
    portlet.xml
    faces-config.xml
    application-context.xml
    portlet-config.xml
    webflow-config.xml
    webmvc-config.xml
    main.xhtml (page)
    main-flow.xml (flow definition)
    PersonValidator.java ( a validator to be used)
    ViewFlowHandler.java (returning the id of the view mode flow)

    Would be nice if someone has a hint where the error comes from. I have no idea.

    Regards,
    Florian

  • #2
    Have you checked the swf-booking-portlet-faces sample in the distribution? Compare your faces-config.xml with the one in the sample.

    Comment


    • #3
      The faces-config.xml looks the same.
      So this cannot be the problem.

      Comment


      • #4
        As far as I can see this is in your faces-config.xml:

        Code:
        <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
        And this is what's in the sample:

        Code:
        <view-handler>org.springframework.faces.webflow.application.portlet.PortletFaceletViewHandler</view-handler>

        Comment


        • #5
          Sorry, my mistake.

          Now I changed to the new view handler.
          That still does not work.

          The strange thing, from my point of view, is that in the exception it is still the

          Code:
          com.sun.facelets.FaceletViewHandler
          that is included in the stack-trace:

          Code:
          Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
                  at java.lang.AbstractStringBuilder.replace(AbstractStringBuilder.java:800) ~[na:1.5.0_22]
                  at java.lang.StringBuffer.replace(StringBuffer.java:392) ~[na:1.5.0_22]
                  at com.sun.facelets.FaceletViewHandler.getRenderedViewId(FaceletViewHandler.java:763) ~[jsf-facelets-1.1.14.jar:1.1.14]
                  at com.sun.facelets.FaceletViewHandler.buildView(FaceletViewHandler.java:505) ~[jsf-facelets-1.1.14.jar:1.1.14]
                  at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:567) ~[jsf-facelets-1.1.14.jar:1.1.14]
                  at org.springframework.faces.webflow.FlowViewHandler.renderView(FlowViewHandler.java:99) ~[spring-faces-2.2.0.RELEASE.jar:2.2.0.RELEASE]
                  at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110) ~[jsf-impl-1.2_15.jar:1.2_15-20100816-SNAPSHOT]
                  at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100) ~[jsf-impl-1.2_15.jar:1.2_15-20100816-SNAPSHOT]
                  ... 82 common frames omitted
          The full stacktrace, from deployment over adding the portlet to a page to the exception, can be found attached (log.zip).

          Do you have an idea?

          Regards,
          Florian

          Comment


          • #6
            Addition:

            I also tried with myfaces. the error is exactly the same.

            Comment


            • #7
              I digged a little bit deeper.

              The exception occurs in the getRendererViewId method of the FaceletViewHandler.

              The method looks like

              Code:
              protected String getRenderedViewId(FacesContext context, String actionId) {
                      ExternalContext extCtx = context.getExternalContext();
                      String viewId = actionId;
                      if (extCtx.getRequestPathInfo() == null) {
                          String viewSuffix = this.getDefaultSuffix(context);
                          viewId = new StringBuffer(viewId).replace(viewId.lastIndexOf('.'),
                                                                    viewId.length(),
                                                                    viewSuffix).toString();
                      }
                      if (log.isLoggable(Level.FINE)) {
                          log.fine("ActionId -> ViewId: " + actionId + " -> " + viewId);
                      }
                      return viewId;
                  }
              The problem is now the creation of the viewId. the actionId that is passed to the method is (in my case)
              /WEB-INF/flows/main/main/main
              the lastIndexOf on viewId returns -1 and this results in a StringIndexOutOfBoundsException.

              Further investigating...

              Comment


              • #8
                Now it works

                I added ".xhtml" to my files.

                Comment

                Working...
                X