openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pawel Veselov <pawel.vese...@gmail.com>
Subject Race condition in dictionary determination?
Date Sun, 30 Jun 2013 07:59:33 GMT
Hi.

Using OpenJPA 2.1.1, I ran into this problem after I switched to custom
implementation of the data source. I guess what's happening is that
dictionary can no longer be determined from the class name, so it attempts
to look at the URL, but the data source object is not yet populated.
Everything works perfectly if I use original data source. Anything I can
do? The database is postgres.

persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="Snap">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<non-jta-data-source>snap_db_jpa</non-jta-data-source>
<!-- entities defined here -->
<properties>
<property name="openjpa.Log" value="File=/tmp/jpa.log, DefaultLevel=WARN,
SQL=TRACE"/>
<property name="openjpa.jdbc.SynchronizeMappings"
value="refresh(ForeignKeys=true,PrimaryKeys=true,Indexes=true,DropUnusedComponents=true,)"/>
</properties>
</persistence-unit>
</persistence>


Exception:
Caused by: <openjpa-2.2.1-r422266:1396819 fatal user error>
org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or
DataSource class name must be specified in the ConnectionDriverName
property. Available properties in configuration are
"org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@f237a66c".
        at
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:72)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFactory(JDBCConfigurationImpl.java:844)
        at
org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInstance(JDBCConfigurationImpl.java:602)
        at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1518)
        at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518)
        at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443)
        at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:104)
        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:638)
        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
com.excelfore.util.ThreadContext.getEntityManager(ThreadContext.java:215)

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