Announcement Announcement Module
Collapse
No announcement yet.
Web Flow in Portlet, is initialized as Servlet rather than a Portlet Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Web Flow in Portlet, is initialized as Servlet rather than a Portlet

    Hi!

    I am currently updating our portlets to Spring 3.0 and Spring Web Flow 2.1.
    Everything worked with Spring 2.5 and Spring Web Flow 1.0.
    I could update all portlets to work with Spring 3.0, besides the one using Spring Web Flow. (We are using Liferay as the portal server)
    When I try to access a page with that portlet, I'll get the following Exception:
    Code:
    Caused by: java.lang.ClassCastException: com.liferay.portlet.RenderRequestImpl cannot be cast to javax.servlet.http.HttpServletRequest
        at org.springframework.webflow.mvc.servlet.ServletMvcView.doRender(ServletMvcView.java:46)
        at org.springframework.webflow.mvc.view.AbstractMvcView.render(AbstractMvcView.java:180)
        ... 202 more

    As far as I can tell right now, the class MvcEnvironment which should determinate in which environment the flow is executed does not get the right Context during the initialization of the Flow.
    This statement fails:
    Code:
    applicationContext instanceof ConfigurablePortletApplicationContext;
    I tried to debug it and I noticed, that the flow is initialized before the portlet that should execute the flow is initialized, from the log file with debug enabled (log4j: log4j.logger.org.springframework.webflow=DEBUG, log4j.logger.org.springframework.web.portlet=DEBUG ):

    Code:
    2010-09-07 10:03:09,634 DEBUG [main:] org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flows/register/start-flow.xml]' under id 'start-flow'
    2010-09-07 10:03:09,635 DEBUG [main:] org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flows/register/resendPassword-flow.xml]' under id 'resendPassword-flow'
    2010-09-07 10:03:09,635 DEBUG [main:] org.springframework.webflow.definition.registry.FlowDefinitionRegistryImpl - Registering flow definition 'ServletContext resource [/WEB-INF/flows/register/registration-flow.xml]' under id 'registration-flow'
    ....
    2010-09-07 10:05:13,517 INFO  [main:] org.springframework.web.portlet.DispatcherPortlet - Initializing portlet 'userRegistration'
    2010-09-07 10:05:13,518 INFO  [main:] org.springframework.web.portlet.DispatcherPortlet - FrameworkPortlet 'userRegistration': initialization started
    2010-09-07 10:05:13,518 DEBUG [main:] org.springframework.web.portlet.DispatcherPortlet - Portlet with name 'userRegistration' will try to create custom ApplicationContext context of class 'org.springframework.web.portlet.context.XmlPortletApplicationContext', using parent context [Root WebApplicationContext: startup date [Tue Sep 07 10:02:27 GMT 2010]; root of context hierarchy]
    2010-09-07 10:05:13,518 INFO  [main:] org.springframework.web.portlet.context.XmlPortletApplicationContext - Refreshing PortletApplicationContext for namespace 'userRegistration-portlet': startup date [Tue Sep 07 10:05:13 GMT 2010]; parent: Root WebApplicationContext
    2010-09-07 10:05:13,530 DEBUG [main:] org.springframework.web.portlet.context.XmlPortletApplicationContext - Bean factory for PortletApplicationContext for namespace 'userRegistration-portlet': org.springframework.beans.factory.support.DefaultListableBeanFactory@332a9b15: defining beans [org.springframework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor#0,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,defaultHandlerMapping,internalJspViewResolver,org.springframework.webflow.mvc.portlet.FlowHandlerAdapter#0,registrationFlowExceptionResolver,messageSource]; parent: org.springframework.beans.factory.support.DefaultListableBeanFactory@16a99013
    2010-09-07 10:05:13,610 DEBUG [main:] org.springframework.web.portlet.context.XmlPortletApplicationContext - Using MessageSource [org.springframework.context.support.ReloadableResourceBundleMessageSource: basenames=[WEB-INF/classes/nls/userRegistrationPortlet,WEB-INF/classes/nls/GlobalMessages]]
    2010-09-07 10:05:13,610 DEBUG [main:] org.springframework.web.portlet.context.XmlPortletApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@339d568b]
    2010-09-07 10:05:13,754 DEBUG [main:] org.springframework.web.portlet.context.XmlPortletApplicationContext - Unable to locate LifecycleProcessor with name 'lifecycleProcessor': using default [[email protected]5dbdb]
    2010-09-07 10:05:13,754 DEBUG [main:] org.springframework.web.portlet.context.XmlPortletApplicationContext - Publishing event in PortletApplicationContext for namespace 'userRegistration-portlet': org.springframework.context.event.ContextRefreshedEvent[source=PortletApplicationContext for namespace 'userRegistration-portlet': startup date [Tue Sep 07 10:05:13 GMT 2010]; parent: Root WebApplicationContext]
    2010-09-07 10:05:13,755 DEBUG [main:] org.springframework.web.portlet.DispatcherPortlet - Using MultipartResolver [org.springframework.web.portlet.multipart.CommonsPortletMultipartResolver@581651f6]
    2010-09-07 10:05:13,793 DEBUG [main:] org.springframework.web.portlet.handler.PortletModeHandlerMapping - Mapped key [view] onto handler [de.abas.portlets.register.StartFlowHandler@69340219]
    2010-09-07 10:05:13,796 DEBUG [main:] org.springframework.web.portlet.DispatcherPortlet - Published ApplicationContext of portlet 'userRegistration' as PortletContext attribute with name [org.springframework.web.portlet.FrameworkPortlet.CONTEXT.userRegistration]
    2010-09-07 10:05:13,797 INFO  [main:] org.springframework.web.portlet.DispatcherPortlet - FrameworkPortlet 'userRegistration': initialization completed in 279 ms
    So it might be, that the flow is not initialized within the portlet context and MvcEnvironment does not know anything about a portlet context.

    Does anyone have any hint/advice for me?

    Thanks in advance

    Cheers
    Tobias

  • #2
    Not hints at all?

    Comment

    Working...
    X