Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
pooja mahajan
Custom Spring MVC -portlets broken after upgrading to Liferay 6.1 GA2
February 7, 2013 1:55 AM
Answer

pooja mahajan

Rank: Junior Member

Posts: 45

Join Date: January 29, 2013

Recent Posts

We are using Loferay 6.1 CE GA2 bundled with Jboss7.
We have the structure where applicationContext.xml contains shared beans (service layer, dao layer and such) and is loaded by org.springframework.web.context.ContextLoaderListener . Additionally all portlets have their own context loading MVC related beans (controllers, view resolvers, etc).

Generated listeners in web.xml on version 6.1 GA1:

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<listener>
<listener-class>com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener</listener-class>
</listener>
<listener>
<listener-class>com.liferay.portal.kernel.servlet.PortletContextListener</listener-class>
</listener>

After upgrading to Liferay 6.1 GA2 deployment sorts listeners in web.xml alphabetically:

<listener>
<listener-class>com.liferay.portal.kernel.servlet.PluginContextListener</listener-class>
</listener>
<listener>
<listener-class>com.liferay.portal.kernel.servlet.SerializableSessionAttributeListener</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

This causes portlet context to be loaded first and dependent beans from application context are missing.

We are getting following issue.
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#0' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Class' for property 'targetClass'; nested exception is java.lang.IllegalArgumentException: Cannot find class [com.closepf.common.utils.ConfigProperties]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:526)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:455)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:192)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:567)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:282)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:204)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at com.liferay.portal.spring.context.PortletContextLoaderListener.contextInitialized(PortletContextLoaderListener.java:98)
at com.liferay.portal.deploy.hot.SpringHotDeployListener.doInvokeDeploy(SpringHotDeployListener.java:77)
at com.liferay.portal.deploy.hot.SpringHotDeployListener.invokeDeploy(SpringHotDeployListener.java:40)
David H Nebinger
RE: Custom Spring MVC -portlets broken after upgrading to Liferay 6.1 GA2
February 7, 2013 5:36 AM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 11464

Join Date: September 1, 2006

Recent Posts

So have your portlet context file import the app context rather than using separate loader listeners.
Peter Schübl
RE: Custom Spring MVC -portlets broken after upgrading to Liferay 6.1 GA2
February 8, 2013 3:21 AM
Answer

Peter Schübl

Rank: New Member

Posts: 9

Join Date: November 24, 2011

Recent Posts

Wouldn't that result in beans in the application context being created multiple times (once for each portlet) rather than being shared between multiple portlets?
pooja mahajan
RE: Custom Spring MVC -portlets broken after upgrading to Liferay 6.1 GA2
February 10, 2013 9:32 PM
Answer

pooja mahajan

Rank: Junior Member

Posts: 45

Join Date: January 29, 2013

Recent Posts

Hi David,
Thanks for useful suggestion. Can you please brief me the process as i am toltally new to liferay