论坛

主页 » Liferay Portal » English » 3. Development

组合视图 统一视图 树状图
讨论主题 [ 上一个 | 下一个 ]
toggle
francesco scamarcio
configure liferay datasource in spring+hibernate portlet
2012年5月28日 上午4:59
答复

francesco scamarcio

等级: Regular Member

帖子: 104

加入日期: 2009年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
RE: configure liferay datasource in spring+hibernate portlet
2012年5月28日 下午11:53
答复

Subhash Shah

等级: Junior Member

帖子: 77

加入日期: 2011年11月29日

最近的帖子

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.
francesco scamarcio
RE: configure liferay datasource in spring+hibernate portlet
2012年5月29日 上午3:25
答复

francesco scamarcio

等级: Regular Member

帖子: 104

加入日期: 2009年8月17日

最近的帖子

i follow this post and works well