Results 1 to 8 of 8

Thread: Portlets IndexOutOfBoundException

  1. #1
    Join Date
    Nov 2010
    Location
    Winterthur
    Posts
    49

    Default 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
    Attached Files Attached Files

  2. #2
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

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

  3. #3
    Join Date
    Nov 2010
    Location
    Winterthur
    Posts
    49

    Default

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

  4. #4
    Join Date
    Aug 2006
    Location
    Brooklyn
    Posts
    556

    Default

    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>

  5. #5
    Join Date
    Nov 2010
    Location
    Winterthur
    Posts
    49

    Default

    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
    Attached Files Attached Files

  6. #6
    Join Date
    Nov 2010
    Location
    Winterthur
    Posts
    49

    Default

    Addition:

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

  7. #7
    Join Date
    Nov 2010
    Location
    Winterthur
    Posts
    49

    Default

    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...

  8. #8
    Join Date
    Nov 2010
    Location
    Winterthur
    Posts
    49

    Default

    Now it works

    I added ".xhtml" to my files.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •