openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From José Luis Cetina <maxtorz...@gmail.com>
Subject Re: openjpa, maven and persistence.xml. help me please
Date Tue, 19 Feb 2013 16:28:01 GMT
Here is my pom.xml maybe can help you

 <build>
        <plugins>
            <plugin>
                <groupId>org.bsc.maven</groupId>
                <artifactId>maven-processor-plugin</artifactId>
                <version>${plugins.maven.processor.plugin}</version>
                <executions>
                    <execution>
                        <id>process</id>
                        <goals>
                            <goal>process</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <processors>

<processor>org.apache.openjpa.persistence.meta.AnnotationProcessor6</processor>
                            </processors>
                            <optionMap>
                                <openjpa.metamodel>true</openjpa.metamodel>
                            </optionMap>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>${plugins.build-helper-maven-plugin}</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>

<source>${project.build.directory}/generated-sources/apt</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--OPENJPA ENHANCMENT-->
            <plugin>
                <groupId>org.apache.openjpa</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <version>${plugins.openjpa.maven.plugin}</version>
                <configuration>
                    <addDefaultConstructor>true</addDefaultConstructor>

<enforcePropertyRestrictions>true</enforcePropertyRestrictions>
                </configuration>
                <executions>
                    <execution>
                        <id>enhancer</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.apache.openjpa</groupId>
                        <artifactId>openjpa</artifactId>
                        <version>${apache.openjpa.version}</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>


2013/2/19 Kevin Sutter <kwsutter@gmail.com>

> definitely sounds like a maven pom.xml configuration issue...  Something
> isn't getting passed from the parent to the sub-modules that is required
> for this compile/enhance step... Good luck.
>
> Kevin
>
> On Tue, Feb 19, 2013 at 3:49 AM, Aitor Iturriondobeitia <
> laudio.info@gmail.com> wrote:
>
> > thanks
> > i have more information about this.
> > i think that is not jpa problem. My poersistencefile is into the
> META-INF.
> > I think tha is maven problem.
> > when i intall (compile) my applicaion without the parent it runs ok but
> > when i intall from the parent it does't run
> > what do you think about this? do you occur anythig?
> > thanks
> >
> >
> > 2013/2/18 Kevin Sutter <kwsutter@gmail.com>
> >
> > > 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 <laudio.info@gmail.com>
> > > 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
> > > >
> > >
> >
>



-- 
-------------------------------------------------------------------
*SCJA. José Luis Cetina*
-------------------------------------------------------------------

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message