“Current request is not a portlet request” error running Liferay portlets on WebLogic using Spring 3.0.5 and aop with a request scope bean

霸气de小男生 提交于 2019-12-24 09:28:34

问题


Has anyone seen and resolved this error?

Caused by: java.lang.IllegalStateException: Current request is not a portlet request            at org.springframework.web.portlet.context.PortletApplicationContextUtils.currentRequestAttributes(PortletApplicationContextUtils.java:194)
        at org.springframework.web.portlet.context.PortletApplicationContextUtils.access$0(PortletApplicationContextUtils.java:191)
        at org.springframework.web.portlet.context.PortletApplicationContextUtils$WebRequestObjectFactory.getObject(PortletApplicationContextUtils.java:238)
        at org.springframework.web.portlet.context.PortletApplicationContextUtils$WebRequestObjectFactory.getObject(PortletApplicationContextUtils.java:1)
        at org.springframework.beans.factory.support.AutowireUtils$ObjectFactoryDelegatingInvocationHandler.invoke(AutowireUtils.java:178)
        at $Proxy866.getAttribute(Unknown Source)
        at org.ihc.mh.proxy.portlet.factory.PortletProxyInfoFactory$PortletSessionScope.getAttribute(PortletProxyInfoFactory.java:198)
        at org.ihc.mh.proxy.portlet.factory.PortletProxyInfoFactory$ProxyInfoImpl.getUnitNumber(PortletProxyInfoFactory.java:52)
        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:597)
        at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
        at $Proxy790.getUnitNumber(Unknown Source)
        at org.ihc.mh.proxy.service.focus.impl.FocusServiceImpl.getFocusPerson(FocusServiceImpl.java:95)
        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:597)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:145)

The bean is defined using the "request" scope and aop like:

<bean id="focusPerson" scope="request" factory-bean="dataViewFocusService" factory-method="getFocusPerson">
   <constructor-arg ref="proxyInfo" />
   <aop:scoped-proxy proxy-target-class="false" />
</bean>

Yet when I trap the call to set the request attributes in the debugger, it seems to be coming from WebLogic rather than Spring as I expected:

  [1] org.springframework.web.context.request.RequestContextHolder.setRequestAttributes (RequestContextHolder.java:84)
  [2] org.springframework.web.context.request.RequestContextHolder.setRequestAttributes (RequestContextHolder.java:73)
  [3] org.springframework.web.context.request.RequestContextListener.requestInitialized (RequestContextListener.java:61)
  [4] com.liferay.portal.kernel.servlet.SecurePluginContextListener.requestInitialized (SecurePluginContextListener.java:189)
  [5] weblogic.servlet.internal.EventsManager.notifyRequestLifetimeEvent (EventsManager.java:333)
  [6] weblogic.servlet.internal.RequestEventsFilter.doFilter (RequestEventsFilter.java:25)
  [7] weblogic.servlet.internal.FilterChainImpl.doFilter (FilterChainImpl.java:56)
  [8] weblogic.servlet.internal.RequestDispatcherImpl.invokeServlet (RequestDispatcherImpl.java:524)
  [9] weblogic.servlet.internal.RequestDispatcherImpl.include (RequestDispatcherImpl.java:444)
  [10] com.liferay.portlet.InvokerPortletImpl.invoke (InvokerPortletImpl.java:602)
  [11] com.liferay.portlet.InvokerPortletImpl.invokeRender (InvokerPortletImpl.java:675)
  [12] com.liferay.portlet.InvokerPortletImpl.render (InvokerPortletImpl.java:382)
  [13] jsp_servlet._html._portal.__render_portlet._jspService (render_portlet.jsp:788)

These has been working correctly under Glassfish for sometime. On WebLogic we are getting this error. It looks like a conflict between WebLogic and the portlet in managing the Spring request context but I am not sure how to resolve it.

Thanks

来源:https://stackoverflow.com/questions/21918640/current-request-is-not-a-portlet-request-error-running-liferay-portlets-on-web

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!