Forums de discussion

Spring Beans are not visible in portlet context

Zeshan Khalid, modifié il y a 15 années.

Spring Beans are not visible in portlet context

New Member Envoyer: 1 Date d'inscription: 04/11/08 Publications récentes
I have developed some portlets and deploy them in liferay 4.3.2, they are working fine. But, when I tried to deploy them in liferay 5.2.0 they throw an exception. "openSessionInViewInterceptor" is not able to find reference to the "sessionFactory". "sessionFactory" bean has been defined in ApplicationContext.xml.

Can we deploy JSR 168 compliant portlets in liferay 5.2.0?


Here under is the portlet definition,

<portlet>
<portlet-name>TESTPORTLET</portlet-name>
<display-name>Invite Contact</display-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<init-param>
<name>contextConfigLocation</name>
<value>/WEB-INF/mode.xml</value>
</init-param>
<init-param>
<name>default-view</name>
<value>/test.jsp</value>
</init-param>
<supports>
<mime-type>text/html</mime-type>
</supports>
<expiration-cache>0</expiration-cache>
<portlet-info>
<title>Test Portlet</title>
<short-title>Test Portlet</short-title>
<keywords>Test Portlet</keywords>
</portlet-info>
</portlet>



Here under is the mode.xml

<bean name="openSessionInViewInterceptor"
class="org.springframework.orm.hibernate3.support.OpenSessionInViewInterceptor">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="wrappingController"
class="org.springframework.web.portlet.mvc.PortletWrappingController">
<property name="portletClass"
value="de.danet.an.util.jsf.MyFacesAdaptedPortlet" />
</bean>
<!-- Handler Mapping -->
<bean id="portletModeHandlerMapping"
class="org.springframework.web.portlet.handler.PortletModeHandlerMapping">
<property name="interceptors">
<list>
<ref bean="openSessionInViewInterceptor" />
</list>
</property>
<property name="portletModeMap">
<map>
<entry key="view">
<ref bean="wrappingController" />
</entry>
<entry key="edit">
<ref bean="wrappingController" />
</entry>
<entry key="help">
<ref bean="wrappingController" />
</entry>
</map>
</property>
</bean>