Uploaded image for project: 'MyFaces Orchestra'
  1. MyFaces Orchestra
  2. ORCHESTRA-25

Orchestra does not work within BEA WebLogic JSF portlet - FacesContextFactory related problem

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.1
    • 1.4
    • FrameworkAdapter
    • None
    • BEA WebLogic Portal 9.2, BEA WebLogic JSF portlets, Sun JSF RI 1.1_01, MyFaces Orchestra 1.2 snapshot

    Description

      I have read about the Orchestra's support for conversation scope and think it is very promising for an application we're building that needs to support 1) updates in wizard kind of screens where users submit changes made in multiple tabs and 2) have this working in scenarios where users do a ctrl+n / open new browser windows (=> session scope is ruled out)

      To get things started I am trying to get an Orchestra example (multiBean) working on our tech stack - BEA WebLogic Portal 9.2, BEA WebLogic JSF portlets, Sun JSF RI 1.1_01 and MyFaces Orchestra 1.2 snapshot. We are not going to have any non-JSF functionality in our application.

      So far I have been successful in running the example on BEA WebLogic Portal 9.2 without wrapping the JSPs within a JSF portlet. However, as soon as I wrap the JSP within a JSF portlet, I get the following error on the examples home page (/start.jsp):

      java.lang.ClassCastException: com.sun.faces.context.MyHttpServletRequestWrapper
      at com.bea.portlet.adapter.faces.lifecycle.LifecycleImpl.restore(LifecycleImpl.java:308)
      at com.bea.portlet.adapter.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:199)
      at com.bea.portlet.adapter.faces.FacesContentStubImpl.render(FacesContentStubImpl.java:224)
      at com.bea.netuix.servlets.controls.content.FacesContent.beginRender(FacesContent.java:312)

      This issue is showing up because myfaces-orchestra-core-1.2-SNAPSHOT.jar!faces-config.xml contains Orchestra related FacesContextFactory classes that are loaded by Faces Servlet upon startup. Looks like these factories (org.apache.myfaces.orchestra.lib.jsf.OrchestraFacesContextFactory is one of them) are not returning valid FacesContext objects (they're returning an object meant for servlet / non-portlet environments) and cause a ClassCastException in BEA Portal's classes that appear to be casting the request to FacesRequest, something like:
      (FacesRequest)context.getExternalContext().getRequest();

      To fix this problem, I added the BEA Portal specific FacesContextFactory (present in their faces-adapter.jar!faces-config.xml) into my applications's faces-config.xml. i.e. the following lines:
      <factory>
      ....
      <faces-context-factory>com.bea.portlet.adapter.faces.context.FacesContextFactoryImpl</faces-context-factory>
      ....
      </factory>

      This atleast got me to the examples home page (/start.jsp) since the server appears to have picked up the factory it last loaded. But, there is a side effect of this change. Now I find that FrameworkAdapter has not been initialized properly. The error is:

      Caused by: java.lang.IllegalStateException: FrameworkAdapter not found
      at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:111)
      at org.apache.myfaces.orchestra.conversation.ConversationManager.getInstance(ConversationManager.java:86)
      at org.apache.myfaces.orchestra.conversation.spring.AbstractSpringOrchestraScope.getRealBean(AbstractSpringOrchestraScope.java:311)
      at org.apache.myfaces.orchestra.conversation.spring.ScopedBeanTargetSource.getTarget(ScopedBeanTargetSource.java:71)
      at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.getTarget(Cglib2AopProxy.java:666)
      at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:616)
      at org.apache.myfaces.examples.multibean.Multibean$$EnhancerByCGLIB$$510f5a89.getBeanName()Ljava.lang.String;(:???)

      BEA Portal seems to be over-riding the Orchestra FacesContextFactory impl and not letting it do its per-request operations.

      I have looked around for a way of getting the same thing done via Orchestra filters. The following Orchestra filters are in my web.xml and haven't helped:

      • org.apache.myfaces.orchestra.frameworkAdapter.basic.BasicFrameworkAdapterFilter
      • org.apache.myfaces.orchestra.requestParameterProvider.RequestParameterServletFilter

      Even tried adding the org.apache.myfaces.orchestra.conversation.jsf.filter.OrchestraServletFilter filter but it did not help.

      I am not expecting BEA to fix/change anything on their side. Any chance this can be fixed in Orchestra?

      Thanks,
      Gautam

      PS - will attach full stacktraces after I create this JIRA item

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            lu4242 Leonardo Uribe
            gmarwaha Gautam Marwaha
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment