Welcome to the OpenJPA project! Depending on your environment, getting the Enhancement processing to find your persistence.xml can be tricky sometimes. I'm assuming you have looked at the available documentation for getting this setup properly [1]. The key is probably in the error message you received:
"..Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, or that the properties file you are using for configuration is available." The contents of your persistence.xml looks fine, so the issue is probably with just finding your persistence.xml. You have to ensure that this is available via your classpath that is used for your enhancement processing. With maven, it's sometimes useful to run with the -X option to see how your properties, environment variables, and classpaths are getting setup. Another idea that is simple is to use the javaagent approach for getting the enhancement processing done. This is especially useful for test purposes, but can also be used for jse production usage. Sorry that we don't have a definitive answer for you. It looks like some experimentation and understanding of your specific environment will be required to get the enhancement done. Good luck! Please post back with either success or continued issues. Thanks. This has nothing to do with your enhancement processing, but I would suggest adding another property to your persistence.xml which will help with foreign key processing: <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/> Kevin [1] http://openjpa.apache.org/entity-enhancement.html On Mon, Feb 18, 2013 at 10:37 AM, laudio.info <[email protected]> wrote: > Hello > i am trying to make my fisrt openjpa project. > i am using maven. > i have create the persistence.xml file (bellow) but when i try to compile > my projects appears one error: > [INFO] [openjpa:test-enhance {execution: enhancer}] > [INFO] > ------------------------------------------------------------------------ > [ERROR] FATAL ERROR > [INFO] > ------------------------------------------------------------------------ > [INFO] MetaDataFactory could not be configured > (conf.newMetaDataFactoryInstance() returned null). This might mean that no > configuration properties were found. Ensure that you have a > META-INF/persistence.xml file, that it is available in your classpath, or > that the properties file you are using for configuration is available. If > you are using Ant, please see the <properties> or <propertiesFile> > attributes of the task's nested <config> element. This can also occur if > your OpenJPA distribution jars are corrupt, or if your security policy is > overly strict. > [INFO] > ------------------------------------------------------------------------ > [INFO] Trace > <openjpa-2.1.1-r422266:1148538 fatal user error> > org.apache.openjpa.util.MetaDataException: MetaDataFactory could not be > configured (conf.newMetaDataFactoryInstance() returned null). This might > mean that no configuration properties were found. Ensure that you have a > META-INF/persistence.xml file, that it is available in your classpath, or > that the properties file you are using for configuration is available. If > you are using Ant, please see the <properties> or <propertiesFile> > attributes of the task's nested <config> element. This can also occur if > your OpenJPA distribution jars are corrupt, or if your security policy is > overly strict. > at > > org.apache.openjpa.meta.MetaDataRepository.initializeMetaDataFactory(MetaDataRepository.java:1904) > at > > org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1885) > at > > org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:518) > at > > org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:443) > > My persistence.xml file is into the META-INF directory and has this: > <?xml version="1.0" encoding="UTF-8"?> > <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0"> > <persistence-unit name="example" transaction-type="RESOURCE_LOCAL"> > > <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider> > <class>com.caf.db.jpa.entities.Myrequest</class> > <class>com.caf.db.jpa.entities.Myresponse</class> > <properties> > <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" > /> > <property name="openjpa.ConnectionDriverName" > value="org.apache.derby.jdbc.EmbeddedDriver" /> > <property name="openjpa.ConnectionURL" > value="jdbc:derby:C:\Curro\My\prototipoWorkspace\MyDB\MyDB" /> > <property name="openjpa.ConnectionUserName" value="" /> > <property name="openjpa.ConnectionPassword" value="" /> > </properties> > </persistence-unit> > </persistence> > > thanks >
