You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Pawel Veselov <pa...@gmail.com> on 2013/07/02 09:56:42 UTC

Re: Race condition in dictionary determination?

On Sun, Jun 30, 2013 at 2:02 PM, Rick Curtis <cu...@gmail.com> wrote:

> I seem to remember seeing this problem a while back where the provided
> data-source wasn't found.... and we throw this misleading exception.
>

The only change I made to start getting these exceptions, was to change
binding
the JNDI name to an instance of PGPoolingDataSource to my own extension of
it,
which also was a static inner class. May be there was a problem somwhere
down
instantiating the class that was swallowed up, but I should've seen that.

Interestingly enough, I then decided to do away with PGPoolingDataSource
all together,
and use Tomcat pool instead, and I never seen that exception from
getDBDictionaryInstance
anymore. Which is strange, considering that JPA shouldn't be able to
determine the
dictionary directly from a Tomcat pool...


> Perhaps someone else can chime in with details?
>
> One thing you can do is set :
>
> <property name="openjpa.jdbc.DBDictionary" value="postgres"/>
>

Thanks!


>
>
> On Sun, Jun 30, 2013 at 2:59 AM, Pawel Veselov <pawel.veselov@gmail.com
> >wrote:
>
> > 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)
> >
>
>
>
> --
> *Rick Curtis*
>



-- 
With best of best regards
Pawel S. Veselov