You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by Mike Perham <mp...@us.ibm.com> on 2006/08/22 21:25:16 UTC

using JDBCBrokerFactory




I'm trying to get a Spring-loaded OpenJPA-based EMF working.  Here's my
configuration and the error I'm seeing:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
    version="1.0">
    <persistence-unit name ="spm">

<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
            <properties>
                  <property name="openjpa.BrokerFactory"

value="org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory" />
            </properties>
    </persistence-unit>
</persistence>

Caused by: java.lang.NullPointerException
        at
org.apache.openjpa.meta.MetaDataRepository.setMetaDataFactory(MetaDataRepository.java:180)
        at
org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1289)
        at
org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration(MappingRepository.java:1172)
        at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:306)
        at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:231)
        at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:99)
        at
org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:70)
        at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:853)

I presume I'm missing a property.  Is there a list of properties which need
to/can be set here?

mike

Re: using JDBCBrokerFactory

Posted by Mike Perham <mp...@us.ibm.com>.



Which jars do I need?


Abe White <aw...@bea.com> wrote on 08/22/2006 03:08:01 PM:

> Also, you don't need the openjpa.BrokerFactory property.  It defaults
> to the JDBC factory if you have the correct jars in your classpath.
> I agree with Marc: sounds like a classpath issue.

Re: using JDBCBrokerFactory

Posted by Abe White <aw...@bea.com>.
> That's a lousy error message, but I'm not sure what it causing it.  
> Do you have all of the openjpa-*.jar files in your CLASSPATH? It  
> almost sounds like one of the META-INF/services/ files that reports  
> the available metadata factories is not being found. How did you  
> create the jars? Did you use "mvn package", or some other mechanism?
>
> Also, if you try the persistence.xml file that is used with the  
> test cases (openjpa-persistence-jdbc/target/test-classes/META-INF/ 
> persistence.xml), do you see anything different?


Also, you don't need the openjpa.BrokerFactory property.  It defaults  
to the JDBC factory if you have the correct jars in your classpath.   
I agree with Marc: sounds like a classpath issue.
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

RE: using JDBCBrokerFactory

Posted by Patrick Linskey <pl...@bea.com>.
> Marc, you got me.  I brewed my own jar because I really didn't want to
> spend 1-2 hours figuring out how the jars all fit together.  
> So I unzipped
> openjpa*.zip and then zipped everything back into a single
> openjpa-0.9.0.jar.  The only problem I had was multiple
> META-INF/services/org.apache.openjpa.conf.ProductDerivation 
> files.  Would
> this cause such a problem?  Its contents are:
> 
> org.apache.openjpa.persistence.jdbc.JDBCPersistenceProductDerivation
> 
> which seems reasonable to me.

Yes -- there are several product derivations. You'll need all the jars
except the XML store jar. Or, you could manually merge the service
files.

-Patrick
_______________________________________________________________________
Notice:  This email message, together with any attachments, may contain
information  of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated
entities,  that may be confidential,  proprietary,  copyrighted  and/or
legally privileged, and is intended solely for the use of the individual
or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this
by email and then delete it.

Re: using JDBCBrokerFactory

Posted by Mike Perham <mp...@us.ibm.com>.




Marc, you got me.  I brewed my own jar because I really didn't want to
spend 1-2 hours figuring out how the jars all fit together.  So I unzipped
openjpa*.zip and then zipped everything back into a single
openjpa-0.9.0.jar.  The only problem I had was multiple
META-INF/services/org.apache.openjpa.conf.ProductDerivation files.  Would
this cause such a problem?  Its contents are:

org.apache.openjpa.persistence.jdbc.JDBCPersistenceProductDerivation

which seems reasonable to me.

The test persistence.xml gets the exact same error message.  I'm using an
IBM-internal drop of the code from about 2 weeks ago.

mike


"Marc Prud'hommeaux" <mp...@gmail.com> wrote on 08/22/2006
02:45:00 PM:

> Mike-
>
> That's a lousy error message, but I'm not sure what it causing it. Do
> you have all of the openjpa-*.jar files in your CLASSPATH? It almost
> sounds like one of the META-INF/services/ files that reports the
> available metadata factories is not being found. How did you create
> the jars? Did you use "mvn package", or some other mechanism?
>
> Also, if you try the persistence.xml file that is used with the test
> cases (openjpa-persistence-jdbc/target/test-classes/META-INF/
> persistence.xml), do you see anything different?
>
>
> On Aug 22, 2006, at 12:25 PM, Mike Perham wrote:
>
> >
> >
> >
> >
> > I'm trying to get a Spring-loaded OpenJPA-based EMF working.
> > Here's my
> > configuration and the error I'm seeing:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <persistence xmlns="http://java.sun.com/xml/ns/persistence"
> >     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> > http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
> >     version="1.0">
> >     <persistence-unit name ="spm">
> >
> > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</
> > provider>
> >             <properties>
> >                   <property name="openjpa.BrokerFactory"
> >
> > value="org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory" />
> >             </properties>
> >     </persistence-unit>
> > </persistence>
> >
> > Caused by: java.lang.NullPointerException
> >         at
> > org.apache.openjpa.meta.MetaDataRepository.setMetaDataFactory
> > (MetaDataRepository.java:180)
> >         at
> > org.apache.openjpa.meta.MetaDataRepository.endConfiguration
> > (MetaDataRepository.java:1289)
> >         at
> > org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration
> > (MappingRepository.java:1172)
> >         at
> > org.apache.openjpa.lib.conf.Configurations.configureInstance
> > (Configurations.java:306)
> >         at
> > org.apache.openjpa.lib.conf.Configurations.configureInstance
> > (Configurations.java:231)
> >         at
> > org.apache.openjpa.lib.conf.PluginValue.instantiate
> > (PluginValue.java:99)
> >         at
> > org.apache.openjpa.lib.conf.ObjectValue.instantiate
> > (ObjectValue.java:70)
> >         at
> > org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepository
> > Instance(OpenJPAConfigurationImpl.java:853)
> >
> > I presume I'm missing a property.  Is there a list of properties
> > which need
> > to/can be set here?
> >
> > mike
>

Re: using JDBCBrokerFactory

Posted by Marc Prud'hommeaux <mp...@apache.org>.
Mike-

That's a lousy error message, but I'm not sure what it causing it. Do  
you have all of the openjpa-*.jar files in your CLASSPATH? It almost  
sounds like one of the META-INF/services/ files that reports the  
available metadata factories is not being found. How did you create  
the jars? Did you use "mvn package", or some other mechanism?

Also, if you try the persistence.xml file that is used with the test  
cases (openjpa-persistence-jdbc/target/test-classes/META-INF/ 
persistence.xml), do you see anything different?


On Aug 22, 2006, at 12:25 PM, Mike Perham wrote:

>
>
>
>
> I'm trying to get a Spring-loaded OpenJPA-based EMF working.   
> Here's my
> configuration and the error I'm seeing:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence xmlns="http://java.sun.com/xml/ns/persistence"
>     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
>     version="1.0">
>     <persistence-unit name ="spm">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</ 
> provider>
>             <properties>
>                   <property name="openjpa.BrokerFactory"
>
> value="org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory" />
>             </properties>
>     </persistence-unit>
> </persistence>
>
> Caused by: java.lang.NullPointerException
>         at
> org.apache.openjpa.meta.MetaDataRepository.setMetaDataFactory 
> (MetaDataRepository.java:180)
>         at
> org.apache.openjpa.meta.MetaDataRepository.endConfiguration 
> (MetaDataRepository.java:1289)
>         at
> org.apache.openjpa.jdbc.meta.MappingRepository.endConfiguration 
> (MappingRepository.java:1172)
>         at
> org.apache.openjpa.lib.conf.Configurations.configureInstance 
> (Configurations.java:306)
>         at
> org.apache.openjpa.lib.conf.Configurations.configureInstance 
> (Configurations.java:231)
>         at
> org.apache.openjpa.lib.conf.PluginValue.instantiate 
> (PluginValue.java:99)
>         at
> org.apache.openjpa.lib.conf.ObjectValue.instantiate 
> (ObjectValue.java:70)
>         at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.getMetaDataRepository 
> Instance(OpenJPAConfigurationImpl.java:853)
>
> I presume I'm missing a property.  Is there a list of properties  
> which need
> to/can be set here?
>
> mike