留言板

configure liferay datasource in spring+hibernate portlet

thumbnail
francesco scamarcio,修改在11 年前。

configure liferay datasource in spring+hibernate portlet

Regular Member 帖子: 104 加入日期: 09-8-17 最近的帖子
i develope a portlet project using spring+hibernate( i don't use service builder) and i configure the datasource in spring xml file.

<bean id="liferayDataSource" class="org.springframework.jndi.jndiObjectFactorybean">
<property name="jndiName" value="java:comp/env/jdbc/MyLiferayPool"/>
</bean>

MyLiferayPool is the pool configured in tomcat context.xml file.

after i try to configure datasource to call the datasource defined in liferay portal-ext

<bean id="liferayDataSource"class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource">
<bean class="com.liferay.portal.kernel.util.InfrastructureUtil" factory-method="getDataSource" />
</property>
</bean>

if i deploy a portlet project with the tomcat up it works well, but when i stop the server and restart it (the portlet project is alredy deployed) i get a null pointer errror because the server load a spring xml of project portlet until load a portal-ext when the jndi is configured

anyone can help me?

Alguien me puede ayudar?
Subhash Shah,修改在11 年前。

RE: configure liferay datasource in spring+hibernate portlet

Junior Member 帖子: 78 加入日期: 11-11-30 最近的帖子
Can you please paste exception stack trace here?

You should also check the sequence of spring and portlet context loader listener in web.xml of extracted portlet project.
thumbnail
francesco scamarcio,修改在11 年前。

RE: configure liferay datasource in spring+hibernate portlet

Regular Member 帖子: 104 加入日期: 09-8-17 最近的帖子
i follow this post and works well