Liferay service Builder error

thumbnail
Murali Krishna, modified 8 Years ago. Junior Member Posts: 47 Join Date: 1/17/12 Recent Posts
HI Team,

i am getting the following error, while trying to connect to another DB.

service.xml:

<entity cache-enabled="true" table="TBL_ACCOUNT" name="TBL_ACCOUNT" local-service="true" remote-service="true" data-source="customerDataSource" >
<column name="ACCOUNTID" type="long" primary="true" />
<column name="ACCOUNTNAME" type="String" />
<column name="ACCOUNTSTATUS" type="long" />
<column name="ACCOUNTTYPE" type="long" />
<column name="PARENTACCOUNTID" type="long" />
<column name="CREATEDATE" type="Date" />
<column name="CREATEDABY" type="String" />
<column name="LASTUPDATEDDATE" type="Date" />
<column name="LASTUPDATEDBY" type="String" />

<finder return-type="Collection" name="name">
<finder-column name="ACCOUNTNAME"></finder-column>
</finder>
</entity>

ext-db-spring.xml:

<?xml version="1.0"?>

<beans
default-destroy-method="destroy"
default-init-method="afterPropertiesSet"
xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"
>

<!--
NOTE: Current restriction in LR7's handling of external data sources requires us to redefine the
liferayDataSource bean in our spring configuration.

The following beans define a new liferayDataSource based on the jdbc.ext. prefix in portal-ext.properties.
-->
<bean class="com.liferay.portal.dao.jdbc.spring.DataSourceFactoryBean" id="liferayDataSourceImpl">
<property name="propertyPrefix" value="jdbc.customer." />
</bean>

<bean class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy" id="liferayDataSource">
<property name="targetDataSource" ref="liferayDataSourceImpl" />
</bean>

<!--
So our entities are all appropriately tagged with the extDataSource, we'll alias the above
liferayDataSource so it matches the entities.
-->

<alias alias="customerDataSource" name="liferayDataSource" />
</beans>


while doing deployment, i am getting the following error:

19:27:53,793 ERROR [localhost-startStop-1][vf-goop-webservices-service:97] Unable to start vf-goop-webservices-service
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.liferay.portal.spring.aop.ServiceBeanAutoProxyCreator#0' defined in URL [bundleentry://344.fwk52906764/META-INF/spring/parent/base-spring.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy] for bean with name 'liferayDataSource' defined in URL [bundleentry://44.fwk52906764/META-INF/spring/ext-db-spring.xml]; nested exception is java.lang.ClassNotFoundException: org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy

can you please let me know, is i missed any configuration?

Thanks,
Murali
thumbnail
David H Nebinger, modified 8 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
You have to add the spring jar that provides the class, I think it's spring-jdbc.
thumbnail
Murali Krishna, modified 8 Years ago. Junior Member Posts: 47 Join Date: 1/17/12 Recent Posts
David H Nebinger:
You have to add the spring jar that provides the class, I think it's spring-jdbc.



Hi David,

Spring-jdbc.jar is not needed for another db connection. we are using the OSGI services for service builder and we deploying services as jar not war.. after making couple of changes in configuration files, it's working fine. able to connect to another database.

Thanks,
Murali
Jean-Marie DESSERTAUX, modified 8 Years ago. New Member Post: 1 Join Date: 11/22/10 Recent Posts
after making couple of changes in configuration files, it's working fine. able to connect to another database.

Hi Murali Krishna
Please Murali can you please share your working configurations

Thanks

jmd