Foros de discusión

Issue with configuring a Secondary Database with Liferay 6.2

Tulsi Rai, modificado hace 7 años.

Issue with configuring a Secondary Database with Liferay 6.2

New Member Mensajes: 18 Fecha de incorporación: 5/02/13 Mensajes recientes
Hello,
Here's my goal.
My project is up and running. I would like to configure the project with a different database specifially SQL Server 2008 that contains the business/project specific tables. We would not like to use the default database that Liferay requires to get up and running! So I am following the this link -
https://web.liferay.com/web/ssrikanthreddy1410/blog/-/blogs/connecting-to-different-database-using-liferay-service-builder

My project is based on -
  • Liferay 6.2
  • JDK 1.6.x
  • Primefaces 6.0


I did everything explained in the link above plus I put the sqljdbc.jar in liferay-portal-6.2-ce-ga6\tomcat-7.0.62\webapps\ROOT\WEB-INF\lib based on the blog I read.

I ran the service builder and all went fine. Now when I deployed the project, I get the following error -

01:10:18,952 WARN  [C3P0PooledConnectionPoolManager[identityToken->sBz3pYMo]-HelperThread-#7][BasicResourcePool:275] Having failed to acquire a resource, com.mchange.v2.resourcepool.BasicResourcePool@6ad248c6 is interrupting all Threads waiting on a resource to check out. Will try again in response to new client requests.
01:10:18,955 ERROR [localhost-startStop-1][HotDeployImpl:233] com.liferay.portal.kernel.deploy.hot.HotDeployException: Error initializing Spring for liferay-primefaces-poc-portletliferay-primefaces-poc-portlet
com.liferay.portal.kernel.deploy.hot.HotDeployException: Error initializing Spring for liferay-primefaces-poc-portletliferay-primefaces-poc-portlet
	at com.liferay.portal.kernel.deploy.hot.BaseHotDeployListener.throwHotDeployException(BaseHotDeployListener.java:46)
	at com.liferay.portal.deploy.hot.SpringHotDeployListener.invokeDeploy(SpringHotDeployListener.java:44)
	at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:230)
	at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:257)
	at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:257)
	at com.liferay.portal.deploy.hot.HotDeployImpl.doFireDeployEvent(HotDeployImpl.java:257)
	at com.liferay.portal.deploy.hot.HotDeployImpl.fireDeployEvent(HotDeployImpl.java:96)
	at com.liferay.portal.kernel.deploy.hot.HotDeployUtil.fireDeployEvent(HotDeployUtil.java:28)
	at com.liferay.portal.kernel.servlet.PluginContextListener.fireDeployEvent(PluginContextListener.java:164)
	at com.liferay.portal.kernel.servlet.PluginContextListener.doPortalInit(PluginContextListener.java:154)
	at com.liferay.portal.kernel.util.BasePortalLifecycle.portalInit(BasePortalLifecycle.java:44)
	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:74)
	at com.liferay.portal.kernel.util.PortalLifecycleUtil.register(PortalLifecycleUtil.java:58)
	at com.liferay.portal.kernel.util.BasePortalLifecycle.registerPortalLifecycle(BasePortalLifecycle.java:54)
	at com.liferay.portal.kernel.servlet.PluginContextListener.contextInitialized(PluginContextListener.java:116)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5016)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5528)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
	at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1263)
	at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1948)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
	at java.lang.Thread.run(Thread.java:662)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.StudentLocalService' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.StudentService' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.persistence.StudentPersistence' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Cannot resolve reference to bean 'rdmSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Cannot resolve reference to bean 'rdmHibernateSessionFactory' while setting bean property 'sessionFactoryImplementor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
	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:585)
	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:85)
	at com.liferay.portal.deploy.hot.SpringHotDeployListener.doInvokeDeploy(SpringHotDeployListener.java:85)
	at com.liferay.portal.deploy.hot.SpringHotDeployListener.invokeDeploy(SpringHotDeployListener.java:41)
	... 27 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.StudentService' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.persistence.StudentPersistence' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Cannot resolve reference to bean 'rdmSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Cannot resolve reference to bean 'rdmHibernateSessionFactory' while setting bean property 'sessionFactoryImplementor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
	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 com.liferay.portal.spring.bean.BeanReferenceAnnotationBeanPostProcessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:133)
	at com.liferay.portal.spring.bean.BeanReferenceAnnotationBeanPostProcessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:177)
	at com.liferay.portal.spring.bean.BeanReferenceAnnotationBeanPostProcessor.postProcessBeforeInitialization(BeanReferenceAnnotationBeanPostProcessor.java:83)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:393)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1415)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
	... 41 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.persistence.StudentPersistence' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Cannot resolve reference to bean 'rdmSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Cannot resolve reference to bean 'rdmHibernateSessionFactory' while setting bean property 'sessionFactoryImplementor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
	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 com.liferay.portal.spring.bean.BeanReferenceAnnotationBeanPostProcessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:133)
	at com.liferay.portal.spring.bean.BeanReferenceAnnotationBeanPostProcessor._autoInject(BeanReferenceAnnotationBeanPostProcessor.java:177)
	at com.liferay.portal.spring.bean.BeanReferenceAnnotationBeanPostProcessor.postProcessBeforeInitialization(BeanReferenceAnnotationBeanPostProcessor.java:83)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:393)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1415)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
	... 52 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Cannot resolve reference to bean 'rdmHibernateSessionFactory' while setting bean property 'sessionFactoryImplementor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1327)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1085)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:516)
	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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
	... 67 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1422)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:518)
	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.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)
	... 77 more
Caused by: java.lang.NullPointerException
	at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:169)
	at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2863)
	at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2859)
	at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1870)
	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:860)
	at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:779)
	at com.liferay.portal.spring.hibernate.PortalHibernateConfiguration.buildSessionFactory(PortalHibernateConfiguration.java:64)
	at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1479)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1419)
	... 84 more


Can you please help me what's missing here?
Also, is the approach explained in this article to configure a secondary database the RIGHT one? or I should do it differently?

Thank you.
thumbnail
Mario Aballe Rodriguez, modificado hace 7 años.

RE: Issue with configuring a Secondary Database with Liferay 6.2

Junior Member Mensajes: 34 Fecha de incorporación: 20/01/10 Mensajes recientes
hello that (https://web.liferay.com/web/ssrikanthreddy1410/blog/-/blogs/connecting-to-different-database-using-liferay-service-builder) is the nice article. I create last year a demo by conect to db2(logic) and liferayDB in MySql or PostgreSQL. Yo have mistake in your service.xml or code because that
(Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.StudentLocalService' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.StudentService' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.agia.liferay.primefaces.sample.service.persistence.StudentPersistence' defined in ServletContext resource [/WEB-INF/classes/META-INF/portlet-spring.xml]: Cannot resolve reference to bean 'rdmSessionFactory' while setting bean property 'sessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Cannot resolve reference to bean 'rdmHibernateSessionFactory' while setting bean property 'sessionFactoryImplementor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'rdmHibernateSessionFactory' defined in ServletContext resource [/WEB-INF/classes/META-INF/ext-spring.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException)

Any question write me. !!
Tulsi Rai, modificado hace 7 años.

RE: Issue with configuring a Secondary Database with Liferay 6.2

New Member Mensajes: 18 Fecha de incorporación: 5/02/13 Mensajes recientes
This is resolved!
Here's my conifguration that's working. I would appreciate if you could please confirm the confirmation is RIGHT. Also, would appreciate your feedback for improvement!
C:/liferay_projects/liferay-portal-6.2-ce-ga6/ is my liferay home folder.
As suggested in the liferay document, I deleted everything in the C:/liferay_projects/liferay-portal-6.2-ce-ga6/portal-setup-wizard.properties
, thus it is empty now.
1. C:/liferay_projects/liferay-portal-6.2-ce-ga6/portal-ext.properties
has the following settings.


########## Liferay Portal MySQL Database Configuration ##########
setup.wizard.enabled=false
admin.email.from.address=test@liferay.com
admin.email.from.name=Test Test
jdbc.default.driverClassName=com.mysql.jdbc.Driver

jdbc.default.username=root
jdbc.default.password=admin
jdbc.default.url=jdbc:mysql://localhost/lportal?useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false
liferay.home=C:/apps/liferay-portal-6.2-ce-ga6

########## Application/Business Database - SQL Server Database Configuration ##########
jdbc.rdm.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
jdbc.rdm.username=user1
jdbc.rdm.password=password1
jdbc.rdm.url=jdbc:sqlserver://SQLSERVERNANAME:1433;databaseName=DBNAME;user=user1;password=password1;


I created an ext-spring.xml as the following project structure -

liferay-plugins-sdk-6.2/portlets/liferay-primefaces-poc-portlet
	|
	 docroot/WEB-INF/src
		|
		 META-INF
			|
			 ext-spring.xml

The ext-spring.xml has the following configurations -

<!--?xml version="1.0"?-->

<beans xmlns="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemalocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

	<aop:config>
		<aop:pointcut id="transactionOperation" expression="bean(*Service.impl)" />
		<aop:advisor advice-ref="transactionAdvice" pointcut-ref="transactionOperation" />
	</aop:config>

	<bean id="basePersistence" abstract="true">
		<property name="dataSource" ref="rdmDataSource" />
		<property name="sessionFactory" ref="rdmSessionFactory" />
	</bean>

	<bean id="rdmHibernateSessionFactory" class="com.liferay.portal.spring.hibernate.PortletHibernateConfiguration" lazy-init="true">
		<property name="dataSource" ref="rdmDataSource" />
	</bean>

	<bean id="rdmSessionFactory" class="com.liferay.portal.dao.orm.hibernate.SessionFactoryImpl" lazy-init="true">
		<property name="sessionFactoryImplementor" ref="rdmHibernateSessionFactory" />
	</bean>

	<bean id="rdmTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager" lazy-init="true">
		<property name="dataSource" ref="rdmDataSource" />
		<property name="globalRollbackOnParticipationFailure" value="false" />
		<property name="sessionFactory" ref="rdmHibernateSessionFactory" />
	</bean>

	<bean id="rdmDataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
		<property name="targetDataSource">
			<bean class="com.liferay.portal.dao.jdbc.util.DataSourceFactoryBean">
				<property name="propertyPrefix" value="jdbc.rdm." />
			</bean>
		</property>
	</bean>
</beans> 

The service.xml contains my Entity settings as shown below -


<!--?xml version="1.0" encoding="UTF-8"?-->

<service-builder package-path="com.agia.liferay.primefaces.sample">
	<author>trai</author>
	<namespace>PR</namespace>

	<entity name="Student" local-service="true" cache-enabled="false" data-source="rdmDataSource" session-factory="rdmSessionFactory" tx-manager="rdmTransactionManager">
		<column primary="true" name="studentId" type="int" id-type="increment"></column>
		<column name="name" type="String"></column>
		<column name="lastname" type="String"></column>
		<column name="std" type="String"></column>
		<column name="address" type="String"></column>
		<column name="phone" type="String"></column>
		<column name="gender" type="String"></column>
	</entity>
</service-builder>


Note that I didn't have to do anything in the service.properties located as shown below wher e ext-spring.xml is at the end.

liferay-primefaces-poc-portlet
|
	 docroot/WEB-INF/src
		|
		 service.properties
The contents -
include-and-override=${base.path}/service-ext.properties

##
## Build
##

    build.namespace=PR
    build.number=10
    build.date=1485586085747
    build.auto.upgrade=true

##
## Spring
##

    #
    # Input a list of comma delimited Spring configurations. These will be
    # loaded after the bean definitions specified in the
    # portalContextConfigLocation parameter in web.xml.
    #
    spring.configs=\
        WEB-INF/classes/META-INF/base-spring.xml,\
        \
        WEB-INF/classes/META-INF/hibernate-spring.xml,\
        WEB-INF/classes/META-INF/infrastructure-spring.xml,\
        \
        WEB-INF/classes/META-INF/cluster-spring.xml,\
        \
        WEB-INF/classes/META-INF/portlet-spring.xml,\
        \
        WEB-INF/classes/META-INF/shard-data-source-spring.xml,\
        \
        WEB-INF/classes/META-INF/ext-spring.xml


With these configuration shown above, I am able to use the TWO database, one ie. mysql for liferay configuration and another ie SQL Server for business application. The project is up and running!

The only thing I have not done yet is to accomodate for lock ie. cuncurrency. As you know, in spring/hibernate based application, we explicitly create a versionid column in each table that needs to be dealt with locking. Is this still true in liferay based application?

Thank you all for your help and guidance through my Liferay journey!
Tulsi
thumbnail
Mario Aballe Rodriguez, modificado hace 7 años.

RE: Issue with configuring a Secondary Database with Liferay 6.2

Junior Member Mensajes: 34 Fecha de incorporación: 20/01/10 Mensajes recientes
Hi !! Im write this example last year, download it: https://github.com/maballer/liferay-examples
Im used JDNI config in my web server (jboss).
I'll review your configuration portlet,!!
Tulsi Rai, modificado hace 7 años.

RE: Issue with configuring a Secondary Database with Liferay 6.2

New Member Mensajes: 18 Fecha de incorporación: 5/02/13 Mensajes recientes
Thanks Mario.
thumbnail
Mario Aballe Rodriguez, modificado hace 7 años.

RE: Issue with configuring a Secondary Database with Liferay 6.2

Junior Member Mensajes: 34 Fecha de incorporación: 20/01/10 Mensajes recientes
Hi, you welcome!!
Do you resolved the problem ?
nice day Tulsi.
thumbnail
Kyle Joseph Stiemann, modificado hace 7 años.

Moved.

Liferay Master Mensajes: 760 Fecha de incorporación: 14/01/13 Mensajes recientes
Moved to the Home » Liferay Portal » English » 1. Installation / Deployment / Setup category.