Thanks Marc,

That got me past the previous problem... Seems I had a typo in the name of
the META-INF directory.

I'm not getting a SAX exception for the xml :) but that's a problem for
another night:

javax.persistence.PersistenceException: Provider error. Provider:
org.apache.openjpa.persistence.PersistenceProviderImpl
        at javax.persistence.Persistence.createFactory(Persistence.java:175)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:11
1)
        at
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:65
)
[...]
Caused by: <openjpa-1.0.0-r420667:568756 nonfatal general error>
org.apache.openjpa.util.GeneralException: org.xml.sax.SAXException:
file:/D:/sw1workspace/lobbythem-model/target/classes/META-INF/persistence.xm
l [Location: Line: 4, C: 21]: org.xml.sax.SAXParseException:
cvc-complex-type.2.4.a: Invalid content was found starting with element
'transaction-type'. One of
'{"http://java.sun.com/xml/ns/persistence":description,
"http://java.sun.com/xml/ns/persistence":provider,
"http://java.sun.com/xml/ns/persistence":jta-data-source,
"http://java.sun.com/xml/ns/persistence":non-jta-data-source,
"http://java.sun.com/xml/ns/persistence":mapping-file,
"http://java.sun.com/xml/ns/persistence":jar-file,
"http://java.sun.com/xml/ns/persistence":class,
"http://java.sun.com/xml/ns/persistence":exclude-unlisted-classes,
"http://java.sun.com/xml/ns/persistence":properties}' is expected.
        at
org.apache.openjpa.lib.meta.XMLMetaDataParser.parseNewResource(XMLMetaDataPa
rser.java:379)
[...]

Seems the schema doesn't like the type node...
I'll look again after a good nights sleep :)

- Brill

> -----Original Message-----
> From: Marc Prud'hommeaux [mailto:[EMAIL PROTECTED] On 
> Behalf Of Marc Prud'hommeaux
> Sent: October 26, 2007 2:11 AM
> To: users@openjpa.apache.org
> Subject: Re: Help - following the docs but just can't get it to work
> 
> 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
> >
> 

Reply via email to