openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Abhishek Bafna <bafna.i...@gmail.com>
Subject mysql master/slave connection issue
Date Tue, 05 Apr 2016 08:30:15 GMT
Hi,

I am trying to setup the Mysql master/slave configuration using openjpa
datasource. Version 2.2.2
Here are the properties I am setting:

*openjpa.ConnectionProperties* =
DriverClassName=com.mysql.jdbc.ReplicationDriver,Url=jdbc:mysql:replication://master,slave/db,Username=abc,Password=123,MaxActive=10,TestOnBorrow=true,TestOnReturn=true,TestWhileIdle=true,timeBetweenEvictionRunsMillis=300000,numTestsPerEvictionRun=10*openjpa**.ConnectionDriverName*
= org.apache.commons.dbcp.BasicDataSource

>From this:
http://openjpa.apache.org/builds/1.2.3/apache-openjpa/docs/ref_guide_dbsetup.html

when listed driver is a *javax.sql.DataSource*, the string will be treated
as a plugin properties string, and matched to the bean setter methods of
the *DataSource* instance.

I am using BasicDataSource. When I use the single master DB, it works fine,
But the moment I setup the master,slave host, it fails with the below
exception:
-------------------------------------------------------------------------------------
Caused by: <openjpa-2.2.2-r422266:1468616 fatal general error>
org.apache.openjpa.persistence.PersistenceException: *Cannot create
PoolableConnectionFactory (Must specify at least one slave host to connect
to for master/slave replication load-balancing functionality)*
at
org.apache.openjpa.jdbc.sql.DBDictionaryFactory.newDBDictionary(DBDictionaryFactory.java:102)
at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:603)
at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:531)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:456)
at org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:120)
at
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:967)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:958)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly(AbstractBrokerFactory.java:644)
at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:203)
at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:156)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:227)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:154)
at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:60)
at org.apache.oozie.service.JPAService.getEntityManager(JPAService.java:500)
at org.apache.oozie.service.JPAService.init(JPAService.java:201)
at org.apache.oozie.service.Services.setServiceInternal(Services.java:386)
at org.apache.oozie.service.Services.setService(Services.java:372)
at org.apache.oozie.service.Services.loadServices(Services.java:305)
... 26 more
-------------------------------------------------------------------------------------

How can I solve this problem?

Thanks,
Abhishek

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message