openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marc Prud'hommeaux <mprud...@apache.org>
Subject Re: Help - following the docs but just can't get it to work
Date Fri, 26 Oct 2007 06:11:26 GMT
Brill-

The excerpt from your persistence.xml looks OK to me. Are you sure it  
is really in your runtime environment? If, in your test code, you  
check for getClass().getResource("/META-INF/persistence.xml"), does  
it return something?

Also, are you able to run the examples? In the openjpa distribution,  
you should be able to go to "examples/hellojpa/" and run "ant", and  
the example should run. If it doesn't run, there might be something  
wrong with the distribution you are using.



On Oct 25, 2007, at 11:02 PM, Brill Pappin wrote:

> I can't wait to use this library... it's simplicity is exciting...
> However I just can't seem to get it to work.
>
> I just keep getting an exception:
> <openjpa-1.0.0-r420667:568756 fatal user error>
> org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or
> DataSource class name must be specified in the ConnectionDriverName
> property.
>  at
> org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource 
> (DataSourceFac
> tory.java:72)
>  at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.createConnectionFac 
> tory(J
> DBCConfigurationImpl.java:803)
>  at
> org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.getDBDictionaryInst 
> ance(J
> DBCConfigurationImpl.java:568)
>  at
> org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration 
> (MappingRepos
> itory.java:1221)
>  at
> org.apache.openjpa.lib.conf.Configurations.configureInstance 
> (Configurations.
> java:467)
>  at
> org.apache.openjpa.lib.conf.Configurations.configureInstance 
> (Configurations.
> java:392)
>  at
> org.apache.openjpa.lib.conf.PluginValue.instantiate 
> (PluginValue.java:102)
>  at org.apache.openjpa.lib.conf.ObjectValue.instantiate 
> (ObjectValue.java:82)
>  at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepository 
> Instan
> ce(OpenJPAConfigurationImpl.java:857)
>  at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepository 
> Instan
> ce(OpenJPAConfigurationImpl.java:852)
>  at
> org.apache.openjpa.kernel.AbstractBrokerFactory.makeReadOnly 
> (AbstractBrokerF
> actory.java:628)
>  at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker 
> (AbstractBrokerFact
> ory.java:169)
>  at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker 
> (DelegatingBroker
> Factory.java:142)
>  at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa 
> nager(
> EntityManagerFactoryImpl.java:192)
>  at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa 
> nager(
> EntityManagerFactoryImpl.java:145)
>  at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityMa 
> nager(
> EntityManagerFactoryImpl.java:56)
> [...]
>
> As far as I can tell after reading the documention, i've got the  
> config
> properly set up as:
>
> META-INF/persistence.xml
>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
>  <persistence-unit name="lobbythem">
>   <transaction-type>JTA</transaction-type>
>   <provider>
>    org.apache.openjpa.persistence.PersistenceProviderImpl
>   </provider>
>   <class>...</class>
>   ... <= all the classes here.
>   <properties>
>    <property name="openjpa.jdbc.DBDictionary" value="mysql" />
>    <property name="openjpa.ConnectionURL"
>     value="jdbc:mysql://<standard jdbc url>" />
>    <property name="openjpa.ConnectionDriverName"
>     value="com.mysql.jdbc.Driver" />
>    <property name="openjpa.ConnectionUserName" value="<username>" />
>    <property name="openjpa.ConnectionPassword" value="<password>" />
>    <property name="openjpa.Log" value="DefaultLevel=WARN,  
> Tool=INFO" />
>   </properties>
>  </persistence-unit>
> </persistence>
>
>
> I've also tried:
> - removing the "openjpa." in the property names.
> - using the openjpa.xml instead.
>
> In case it helps, all the tools give the same error. the stop  
> complaining
> when I specify the property names on the command line (havn't  
> actually got
> them to work but thats a different problem).
> Also, I'm a Maven 2 user, so my classes are in src/main/java and my
> resources are in src/main/resources and the openjpa-maven-plugin  
> gives the
> same error (so its not liking the config as well).
>
> does anyone have any idea what the heck is going on?
>
> - Brill Pappin
>


Mime
View raw message