You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Hiran Chaudhuri <hi...@amadeus.com> on 2010/05/17 15:31:19 UTC
Ant based enhancement
Hi there.
On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I
keep getting this error message:
<openjpa-2.0.0-r422266:935683 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.
So I figure it is something about my persistence.xml file (that already
worked for runtime enhanced classes). Now where exactly do I have to place
the file for OpenJPA to find it?
If there is a <properties> or <propertiesFile> attribute, how are these
specified for the ant task? Unfortunately the documentation seems not to
be in sync with this error message.
And finally - just if it is the security policy: What could I look out for
here?
Can somebody shed some more light on this?
Hiran
Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
Hosting & Regional Services (IH)
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com
Re: Ant based enhancement
Posted by Rick Curtis <cu...@gmail.com>.
Hiran -
I do recall some weirdness with getting the classpaths setup when writing
that blog post... I don't recall the details, but I do remember that it
wasn't entirely obvious why I had to do what I did.
Just because the enhancer didn't tell you that it did anything doesn't mean
that it didn't.... run javap on one of your Entities to see if it now
implements org.apache.openjpa.enhance.PersistenceCapable. If it does, you're
good to go. If not, try turning on trace to see if that sheds anymore light
as to what is going on.
<property name="openjpa.Log" value="DefaultLevel=trace"/>
Thanks,
Rick
On Mon, May 17, 2010 at 10:01 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi, Rick.
>
> I do feel quite comfortable with ant, so I do know what I'm doing there.
> However I am not too familiar with this special ant task.
> What I tried now is this:
>
> <path id="jpa.enhancement.classpath">
> <pathelement path="${javac.classpath}"/>
> <pathelement path="${build.classes.dir}"/>
> </path>
>
> <!-- define the openjpac task; this can be done at the top of the
> -->
> <!-- build.xml file, so it will be available for all targets
> -->
> <taskdef name="openjpac"
> classname="org.apache.openjpa.ant.PCEnhancerTask">
> <classpath refid="jpa.enhancement.classpath"/>
> </taskdef>
>
> <!-- invoke enhancer on all .class files -->
> <echo>Running OpenJPA enhancer ant task...</echo>
> <openjpac>
> <classpath refid="jpa.enhancement.classpath"/>
> </openjpac>
>
> So you can see I defined the openjpac task using the same classpath (which
> allows ant to find the OpenJPA enhancer) as running the enhancer so it can
> find my compiled classes. The referenced variables are predefined by
> Netbeans and point to all libraries used and the configured output
> directory. The openjpac call now looks exactly the same as in the blog post,
> I just use a different classpath.
> That script now gives me this output:
>
> Running OpenJPA enhancer ant task...
> 31 RMSPilot-app-clientPU WARN [exec_null_38] openjpa.Runtime - The
> configuration property named "openjpa.SynchronizeMappings" was not
> recognized and will be ignored, although the name closely matches a valid
> property called "openjpa.slice.Mapping".
> 94 RMSPilot-app-clientPU INFO [exec_null_38] openjpa.Tool - No targets
> were given. Running on all classes in your persistent classes list, or all
> metadata files in classpath directories if you have not listed your
> persistent classes. Use -help to display tool usage information.
>
> So I'm one step ahead. But the output does not tell me that any of my
> entity classes got enhanced. From looking at my persistence.xml, I think
> they should be listed:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" 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">
> <persistence-unit name="RMSPilot-app-clientPU"
> transaction-type="RESOURCE_LOCAL">
>
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
> <class>rmspilot.model.configuration.Customer</class>
> <class>rmspilot.model.configuration.CustomerGroup</class>
> <class>rmspilot.model.configuration.Property</class>
> <class>rmspilot.model.operational.Processing</class>
> <class>rmspilot.model.operational.ProcessingStep</class>
> <properties>
> <property name="openjpa.ConnectionPassword" value="rmsenv01"/>
> <property name="openjpa.ConnectionDriverName"
> value="oracle.jdbc.OracleDriver"/>
> <property name="openjpa.ConnectionUserName" value="rmsenv"/>
> <property name="openjpa.ConnectionURL" value="jdbc:oracle:thin:@
> //rmatstdb:31811/RMATSTDB"/>
> <property name="openjpa.SynchronizeMappings" value="buildSchema"/>
> <property name="openjpa.jdbc.MappingDefaults"
> value="ForeignKeyDeleteAction=restrict,
> JoinForeignKeyDeleteAction=restrict"/>
> <property name="openjpa.jdbc.SynchronizeMappings"
> value="buildSchema(ForeignKeys=true)"/>
> <property name="openjpa.ConnectionRetainMode" value="always"/>
> </properties>
> </persistence-unit>
> </persistence>
>
>
> So what could now prevent the enhancer from finding and enhancing this
> class?
> Or how do I specify a target as the error message suggests?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
> *Rick Curtis <cu...@gmail.com>*
> To
> users@openjpa.apache.org
> cc
> bcc
> Subject
> Re: Ant based enhancement
>
> *Rick Curtis <cu...@gmail.com>*
>
> Please respond to : users@openjpa.apache.org
> 17-05-10 16:25
>
>
> I'm not an ant expert, but I do notice that in the blog posting the
> openjpac
> task specifies a <classpath> element. Try working that element in to see if
> it clears up your problems.
>
> Thanks,
> Rick
>
> On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com> wrote:
>
> >
> > Hi, Rick.
> >
> > Thank you for the quick response. I read the blog, which clearly says the
> > persistence.xml file should be in the right location once the enhancer
> runs.
> > My build.xml file snippet looks like this:
> >
> > <openjpac directory="build/jar">
> > <fileset dir=".">
> > <include name="**/*.*" />
> > </fileset>
> > </openjpac>
> >
> > The build/jar directory is created by Netbeans 6.8, and it compiles all
> > java source files to that location.
> > So inside <dir hosting build.xml>/build/jar I find these entries:
> > log4j.properties (my log4j configuration file,
> which
> > will appear on the classpath later)
> > META-INF
> > -application-client.xml
> > -MANIFEST.MF
> > -persistence.xml (that is the file OpenJPA should look
> for,
> > right?)
> > rmspilot (the package hosting all my other
> > source files)
> >
> > So I guess Netbeans did the job for me already and the file is in place.
> > The content of the file has proven to be usable for runtime enhancement,
> so
> > I believe it is ok.
> >
> > What else could I look for now?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> > *Rick Curtis <cu...@gmail.com>*
>
> > To
> > users@openjpa.apache.org
> > cc
> > bcc
> > Subject
> > Re: Ant based enhancement
> >
> > *Rick Curtis <cu...@gmail.com>*
> >
> > Please respond to : users@openjpa.apache.org
> > 17-05-10 15:55
> >
> >
> >
> > Hiran -
> >
> > I'd suggest reading through this[1] blog posting which talks about
> > enhanecment. Most likely the net of the message is that OpenJPA can't
> find
> > your persistence.xml file. If your build directory is /bin, your
> > persistence.xml file should be at /bin/META-INF/persistence.xml. Lets
> start
> > with the simple solution before we go too far.
> >
> > Thanks,
> > Rick
> >
> > [1]
> >
> http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
> >
> > On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> > hiran.chaudhuri@amadeus.com> wrote:
> >
> > >
> > > Hi there.
> > >
> > > On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I
> > > keep getting this error message:
> > >
> > > <openjpa-2.0.0-r422266:935683 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.
> > >
> > >
> > > So I figure it is something about my persistence.xml file (that already
> > > worked for runtime enhanced classes). Now where exactly do I have to
> > place
> > > the file for OpenJPA to find it?
> > > If there is a <properties> or <propertiesFile> attribute, how are these
> > > specified for the ant task? Unfortunately the documentation seems not
> to
> > be
> > > in sync with this error message.
> > > And finally - just if it is the security policy: What could I look out
> > for
> > > here?
> > >
> > > Can somebody shed some more light on this?
> > >
> > > Hiran
> > >
> > >
> > > *Hiran Chaudhuri**
> > > System Support Programmer / Analyst*
> > > IT Service Assurance
> > > Hosting & Regional Services (IH)
> > > Amadeus Data Processing GmbH
> > > Berghamer Strasse 6
> > > 85435 Erding
> > > T: +49-8122-43x3662
> > > hiran.chaudhuri@amadeus.com*
> > > **http://www.amadeus.com* <http://www.amadeus.com/>
> > >
> > > [image: Amadeus logo] <http://www.amadeus.com/>
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
>
>
>
>
>
>
RE: Ant based enhancement
Posted by C N Davies <cn...@cndavies.com>.
Not so sure about NetBeans but in MyEclipse Ant is pretty fussy. I can set up <path id= to point to various libs and then a <path refid= to the main class path and openjpac doesn't find the classes. Now I find if I add my classes and libs to the openjpac class path instead of the ant config then it works. Not really sure why but don't really care either :)
I didn't have this issue on OpenJPA 1.2.x
Chris
-----Original Message-----
From: Rick Curtis [mailto:curtisr7@gmail.com]
Sent: Tuesday, 18 May 2010 12:25 AM
To: users@openjpa.apache.org
Subject: Re: Ant based enhancement
I'm not an ant expert, but I do notice that in the blog posting the openjpac
task specifies a <classpath> element. Try working that element in to see if
it clears up your problems.
Thanks,
Rick
On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi, Rick.
>
> Thank you for the quick response. I read the blog, which clearly says the
> persistence.xml file should be in the right location once the enhancer runs.
> My build.xml file snippet looks like this:
>
> <openjpac directory="build/jar">
> <fileset dir=".">
> <include name="**/*.*" />
> </fileset>
> </openjpac>
>
> The build/jar directory is created by Netbeans 6.8, and it compiles all
> java source files to that location.
> So inside <dir hosting build.xml>/build/jar I find these entries:
> log4j.properties (my log4j configuration file, which
> will appear on the classpath later)
> META-INF
> -application-client.xml
> -MANIFEST.MF
> -persistence.xml (that is the file OpenJPA should look for,
> right?)
> rmspilot (the package hosting all my other
> source files)
>
> So I guess Netbeans did the job for me already and the file is in place.
> The content of the file has proven to be usable for runtime enhancement, so
> I believe it is ok.
>
> What else could I look for now?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
> *Rick Curtis <cu...@gmail.com>*
> To
> users@openjpa.apache.org
> cc
> bcc
> Subject
> Re: Ant based enhancement
>
> *Rick Curtis <cu...@gmail.com>*
>
> Please respond to : users@openjpa.apache.org
> 17-05-10 15:55
>
>
>
> Hiran -
>
> I'd suggest reading through this[1] blog posting which talks about
> enhanecment. Most likely the net of the message is that OpenJPA can't find
> your persistence.xml file. If your build directory is /bin, your
> persistence.xml file should be at /bin/META-INF/persistence.xml. Lets start
> with the simple solution before we go too far.
>
> Thanks,
> Rick
>
> [1]
> http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
>
> On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com> wrote:
>
> >
> > Hi there.
> >
> > On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I
> > keep getting this error message:
> >
> > <openjpa-2.0.0-r422266:935683 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.
> >
> >
> > So I figure it is something about my persistence.xml file (that already
> > worked for runtime enhanced classes). Now where exactly do I have to
> place
> > the file for OpenJPA to find it?
> > If there is a <properties> or <propertiesFile> attribute, how are these
> > specified for the ant task? Unfortunately the documentation seems not to
> be
> > in sync with this error message.
> > And finally - just if it is the security policy: What could I look out
> for
> > here?
> >
> > Can somebody shed some more light on this?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> >
> >
>
>
>
>
>
>
Re: Ant based enhancement
Posted by Hiran Chaudhuri <hi...@amadeus.com>.
Hi, all.
The thing is solved now. I found a way to increase the logging level of
the enhancer like this:
<property name="openjpa.Log" value="DefaultLevel=WARN, Tool=TRACE"/>
Now the output is what I expect:
Running OpenJPA enhancer ant task...
0 RMSPilot-app-clientPU WARN [exec_null_43] openjpa.Runtime - The
configuration property named "openjpa.SynchronizeMappings" was not
recognized and will be ignored, although the name closely matches a valid
property called "openjpa.slice.Mapping".
63 RMSPilot-app-clientPU INFO [exec_null_43] openjpa.Tool - No targets
were given. Running on all classes in your persistent classes list, or
all metadata files in classpath directories if you have not listed your
persistent classes. Use -help to display tool usage information.
63 RMSPilot-app-clientPU TRACE [exec_null_43] openjpa.Tool - Enhancer
running on type "rmspilot.model.configuration.Customer".
250 RMSPilot-app-clientPU TRACE [exec_null_43] openjpa.Tool - Enhancer
running on type "rmspilot.model.configuration.Property".
328 RMSPilot-app-clientPU TRACE [exec_null_43] openjpa.Tool - Enhancer
running on type "rmspilot.model.configuration.CustomerGroup".
391 RMSPilot-app-clientPU TRACE [exec_null_43] openjpa.Tool - Enhancer
running on type "rmspilot.model.operational.Processing".
453 RMSPilot-app-clientPU TRACE [exec_null_43] openjpa.Tool - Enhancer
running on type "rmspilot.model.operational.ProcessingStep".
Thanks to all who spent a thought on it.
Hiran
Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
Hosting & Regional Services (IH)
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com
Hiran Chaudhuri <hi...@amadeus.com>
To
users@openjpa.apache.org
cc
users@openjpa.apache.org
bcc
Subject
Re: Ant based enhancement
Hiran Chaudhuri <hi...@amadeus.com>
Please respond to : users@openjpa.apache.org
17-05-10 17:01
Hi, Rick.
I do feel quite comfortable with ant, so I do know what I'm doing there.
However I am not too familiar with this special ant task.
What I tried now is this:
<path id="jpa.enhancement.classpath">
<pathelement path="${javac.classpath}"/>
<pathelement path="${build.classes.dir}"/>
</path>
<!-- define the openjpac task; this can be done at the top of the
-->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask">
<classpath refid="jpa.enhancement.classpath"/>
</taskdef>
<!-- invoke enhancer on all .class files -->
<echo>Running OpenJPA enhancer ant task...</echo>
<openjpac>
<classpath refid="jpa.enhancement.classpath"/>
</openjpac>
So you can see I defined the openjpac task using the same classpath (which
allows ant to find the OpenJPA enhancer) as running the enhancer so it can
find my compiled classes. The referenced variables are predefined by
Netbeans and point to all libraries used and the configured output
directory. The openjpac call now looks exactly the same as in the blog
post, I just use a different classpath.
That script now gives me this output:
Running OpenJPA enhancer ant task...
31 RMSPilot-app-clientPU WARN [exec_null_38] openjpa.Runtime - The
configuration property named "openjpa.SynchronizeMappings" was not
recognized and will be ignored, although the name closely matches a valid
property called "openjpa.slice.Mapping".
94 RMSPilot-app-clientPU INFO [exec_null_38] openjpa.Tool - No targets
were given. Running on all classes in your persistent classes list, or
all metadata files in classpath directories if you have not listed your
persistent classes. Use -help to display tool usage information.
So I'm one step ahead. But the output does not tell me that any of my
entity classes got enhanced. From looking at my persistence.xml, I think
they should be listed:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
<persistence-unit name="RMSPilot-app-clientPU"
transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>rmspilot.model.configuration.Customer</class>
<class>rmspilot.model.configuration.CustomerGroup</class>
<class>rmspilot.model.configuration.Property</class>
<class>rmspilot.model.operational.Processing</class>
<class>rmspilot.model.operational.ProcessingStep</class>
<properties>
<property name="openjpa.ConnectionPassword" value="rmsenv01"/>
<property name="openjpa.ConnectionDriverName"
value="oracle.jdbc.OracleDriver"/>
<property name="openjpa.ConnectionUserName" value="rmsenv"/>
<property name="openjpa.ConnectionURL"
value="jdbc:oracle:thin:@//rmatstdb:31811/RMATSTDB"/>
<property name="openjpa.SynchronizeMappings" value="buildSchema"/>
<property name="openjpa.jdbc.MappingDefaults"
value="ForeignKeyDeleteAction=restrict,
JoinForeignKeyDeleteAction=restrict"/>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.ConnectionRetainMode" value="always"/>
</properties>
</persistence-unit>
</persistence>
So what could now prevent the enhancer from finding and enhancing this
class?
Or how do I specify a target as the error message suggests?
Hiran
Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
Hosting & Regional Services (IH)
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com
Rick Curtis <cu...@gmail.com>
To
users@openjpa.apache.org
cc
bcc
Subject
Re: Ant based enhancement
Rick Curtis <cu...@gmail.com>
Please respond to : users@openjpa.apache.org
17-05-10 16:25
I'm not an ant expert, but I do notice that in the blog posting the
openjpac
task specifies a <classpath> element. Try working that element in to see
if
it clears up your problems.
Thanks,
Rick
On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi, Rick.
>
> Thank you for the quick response. I read the blog, which clearly says
the
> persistence.xml file should be in the right location once the enhancer
runs.
> My build.xml file snippet looks like this:
>
> <openjpac directory="build/jar">
> <fileset dir=".">
> <include name="**/*.*" />
> </fileset>
> </openjpac>
>
> The build/jar directory is created by Netbeans 6.8, and it compiles all
> java source files to that location.
> So inside <dir hosting build.xml>/build/jar I find these entries:
> log4j.properties (my log4j configuration file,
which
> will appear on the classpath later)
> META-INF
> -application-client.xml
> -MANIFEST.MF
> -persistence.xml (that is the file OpenJPA should look
for,
> right?)
> rmspilot (the package hosting all my
other
> source files)
>
> So I guess Netbeans did the job for me already and the file is in place.
> The content of the file has proven to be usable for runtime enhancement,
so
> I believe it is ok.
>
> What else could I look for now?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
> *Rick Curtis <cu...@gmail.com>*
> To
> users@openjpa.apache.org
> cc
> bcc
> Subject
> Re: Ant based enhancement
>
> *Rick Curtis <cu...@gmail.com>*
>
> Please respond to : users@openjpa.apache.org
> 17-05-10 15:55
>
>
>
> Hiran -
>
> I'd suggest reading through this[1] blog posting which talks about
> enhanecment. Most likely the net of the message is that OpenJPA can't
find
> your persistence.xml file. If your build directory is /bin, your
> persistence.xml file should be at /bin/META-INF/persistence.xml. Lets
start
> with the simple solution before we go too far.
>
> Thanks,
> Rick
>
> [1]
>
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
>
> On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com> wrote:
>
> >
> > Hi there.
> >
> > On OpenJPA 2.0.0 I try to use the ant based enhancement step. However
I
> > keep getting this error message:
> >
> > <openjpa-2.0.0-r422266:935683 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.
> >
> >
> > So I figure it is something about my persistence.xml file (that
already
> > worked for runtime enhanced classes). Now where exactly do I have to
> place
> > the file for OpenJPA to find it?
> > If there is a <properties> or <propertiesFile> attribute, how are
these
> > specified for the ant task? Unfortunately the documentation seems not
to
> be
> > in sync with this error message.
> > And finally - just if it is the security policy: What could I look out
> for
> > here?
> >
> > Can somebody shed some more light on this?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> >
> >
>
>
>
>
>
>
Re: Ant based enhancement
Posted by Hiran Chaudhuri <hi...@amadeus.com>.
Hi, Rick.
I do feel quite comfortable with ant, so I do know what I'm doing there.
However I am not too familiar with this special ant task.
What I tried now is this:
<path id="jpa.enhancement.classpath">
<pathelement path="${javac.classpath}"/>
<pathelement path="${build.classes.dir}"/>
</path>
<!-- define the openjpac task; this can be done at the top of the
-->
<!-- build.xml file, so it will be available for all targets -->
<taskdef name="openjpac"
classname="org.apache.openjpa.ant.PCEnhancerTask">
<classpath refid="jpa.enhancement.classpath"/>
</taskdef>
<!-- invoke enhancer on all .class files -->
<echo>Running OpenJPA enhancer ant task...</echo>
<openjpac>
<classpath refid="jpa.enhancement.classpath"/>
</openjpac>
So you can see I defined the openjpac task using the same classpath (which
allows ant to find the OpenJPA enhancer) as running the enhancer so it can
find my compiled classes. The referenced variables are predefined by
Netbeans and point to all libraries used and the configured output
directory. The openjpac call now looks exactly the same as in the blog
post, I just use a different classpath.
That script now gives me this output:
Running OpenJPA enhancer ant task...
31 RMSPilot-app-clientPU WARN [exec_null_38] openjpa.Runtime - The
configuration property named "openjpa.SynchronizeMappings" was not
recognized and will be ignored, although the name closely matches a valid
property called "openjpa.slice.Mapping".
94 RMSPilot-app-clientPU INFO [exec_null_38] openjpa.Tool - No targets
were given. Running on all classes in your persistent classes list, or
all metadata files in classpath directories if you have not listed your
persistent classes. Use -help to display tool usage information.
So I'm one step ahead. But the output does not tell me that any of my
entity classes got enhanced. From looking at my persistence.xml, I think
they should be listed:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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">
<persistence-unit name="RMSPilot-app-clientPU"
transaction-type="RESOURCE_LOCAL">
<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
<class>rmspilot.model.configuration.Customer</class>
<class>rmspilot.model.configuration.CustomerGroup</class>
<class>rmspilot.model.configuration.Property</class>
<class>rmspilot.model.operational.Processing</class>
<class>rmspilot.model.operational.ProcessingStep</class>
<properties>
<property name="openjpa.ConnectionPassword" value="rmsenv01"/>
<property name="openjpa.ConnectionDriverName"
value="oracle.jdbc.OracleDriver"/>
<property name="openjpa.ConnectionUserName" value="rmsenv"/>
<property name="openjpa.ConnectionURL"
value="jdbc:oracle:thin:@//rmatstdb:31811/RMATSTDB"/>
<property name="openjpa.SynchronizeMappings" value="buildSchema"/>
<property name="openjpa.jdbc.MappingDefaults"
value="ForeignKeyDeleteAction=restrict,
JoinForeignKeyDeleteAction=restrict"/>
<property name="openjpa.jdbc.SynchronizeMappings"
value="buildSchema(ForeignKeys=true)"/>
<property name="openjpa.ConnectionRetainMode" value="always"/>
</properties>
</persistence-unit>
</persistence>
So what could now prevent the enhancer from finding and enhancing this
class?
Or how do I specify a target as the error message suggests?
Hiran
Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
Hosting & Regional Services (IH)
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com
Rick Curtis <cu...@gmail.com>
To
users@openjpa.apache.org
cc
bcc
Subject
Re: Ant based enhancement
Rick Curtis <cu...@gmail.com>
Please respond to : users@openjpa.apache.org
17-05-10 16:25
I'm not an ant expert, but I do notice that in the blog posting the
openjpac
task specifies a <classpath> element. Try working that element in to see
if
it clears up your problems.
Thanks,
Rick
On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi, Rick.
>
> Thank you for the quick response. I read the blog, which clearly says
the
> persistence.xml file should be in the right location once the enhancer
runs.
> My build.xml file snippet looks like this:
>
> <openjpac directory="build/jar">
> <fileset dir=".">
> <include name="**/*.*" />
> </fileset>
> </openjpac>
>
> The build/jar directory is created by Netbeans 6.8, and it compiles all
> java source files to that location.
> So inside <dir hosting build.xml>/build/jar I find these entries:
> log4j.properties (my log4j configuration file,
which
> will appear on the classpath later)
> META-INF
> -application-client.xml
> -MANIFEST.MF
> -persistence.xml (that is the file OpenJPA should look
for,
> right?)
> rmspilot (the package hosting all my
other
> source files)
>
> So I guess Netbeans did the job for me already and the file is in place.
> The content of the file has proven to be usable for runtime enhancement,
so
> I believe it is ok.
>
> What else could I look for now?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
> *Rick Curtis <cu...@gmail.com>*
> To
> users@openjpa.apache.org
> cc
> bcc
> Subject
> Re: Ant based enhancement
>
> *Rick Curtis <cu...@gmail.com>*
>
> Please respond to : users@openjpa.apache.org
> 17-05-10 15:55
>
>
>
> Hiran -
>
> I'd suggest reading through this[1] blog posting which talks about
> enhanecment. Most likely the net of the message is that OpenJPA can't
find
> your persistence.xml file. If your build directory is /bin, your
> persistence.xml file should be at /bin/META-INF/persistence.xml. Lets
start
> with the simple solution before we go too far.
>
> Thanks,
> Rick
>
> [1]
>
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
>
> On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com> wrote:
>
> >
> > Hi there.
> >
> > On OpenJPA 2.0.0 I try to use the ant based enhancement step. However
I
> > keep getting this error message:
> >
> > <openjpa-2.0.0-r422266:935683 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.
> >
> >
> > So I figure it is something about my persistence.xml file (that
already
> > worked for runtime enhanced classes). Now where exactly do I have to
> place
> > the file for OpenJPA to find it?
> > If there is a <properties> or <propertiesFile> attribute, how are
these
> > specified for the ant task? Unfortunately the documentation seems not
to
> be
> > in sync with this error message.
> > And finally - just if it is the security policy: What could I look out
> for
> > here?
> >
> > Can somebody shed some more light on this?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> >
> >
>
>
>
>
>
>
Re: Ant based enhancement
Posted by Hiran Chaudhuri <hi...@amadeus.com>.
Hi, Mark.
I'm definitely using ant.
Tried to go for maven once but felt unfamiliar, therefore here I stick to
what I know about. ;-)
Hiran
Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
Hosting & Regional Services (IH)
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com
Mark Struberg <st...@yahoo.de>
To
users@openjpa.apache.org
cc
bcc
Subject
Re: Ant based enhancement
Mark Struberg <st...@yahoo.de>
Please respond to : users@openjpa.apache.org
17-05-10 16:34
Hiran, are you really using ant - or are you using maven and only are not
aware of the openjpa-maven-plugin [1]?
LieGrue,
strub
[1] http://mojo.codehaus.org/openjpa-maven-plugin/
--- On Mon, 5/17/10, Rick Curtis <cu...@gmail.com> wrote:
> From: Rick Curtis <cu...@gmail.com>
> Subject: Re: Ant based enhancement
> To: users@openjpa.apache.org
> Date: Monday, May 17, 2010, 2:25 PM
> I'm not an ant expert, but I do
> notice that in the blog posting the openjpac
> task specifies a <classpath> element. Try working
> that element in to see if
> it clears up your problems.
>
> Thanks,
> Rick
>
> On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com>
> wrote:
>
> >
> > Hi, Rick.
> >
> > Thank you for the quick response. I read the blog,
> which clearly says the
> > persistence.xml file should be in the right location
> once the enhancer runs.
> > My build.xml file snippet looks like this:
> >
> > <openjpac
> directory="build/jar">
> >
> <fileset dir=".">
> >
> <include name="**/*.*" />
> >
> </fileset>
> >
> </openjpac>
> >
> > The build/jar directory is created by Netbeans 6.8,
> and it compiles all
> > java source files to that location.
> > So inside <dir hosting build.xml>/build/jar I
> find these entries:
> > log4j.properties
> (my log4j
> configuration file, which
> > will appear on the classpath later)
> > META-INF
> >
> -application-client.xml
> > -MANIFEST.MF
> >
> -persistence.xml
> (that is the file OpenJPA should look for,
> > right?)
> > rmspilot
>
> (the package hosting all my other
> > source files)
> >
> > So I guess Netbeans did the job for me already and the
> file is in place.
> > The content of the file has proven to be usable for
> runtime enhancement, so
> > I believe it is ok.
> >
> > What else could I look for now?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> > *Rick Curtis <cu...@gmail.com>*
> > To
> > users@openjpa.apache.org
> > cc
> > bcc
> > Subject
> > Re: Ant based enhancement
> >
> > *Rick Curtis <cu...@gmail.com>*
> >
> > Please respond to : users@openjpa.apache.org
> > 17-05-10 15:55
> >
> >
> >
> > Hiran -
> >
> > I'd suggest reading through this[1] blog posting which
> talks about
> > enhanecment. Most likely the net of the message is
> that OpenJPA can't find
> > your persistence.xml file. If your build directory is
> /bin, your
> > persistence.xml file should be at
> /bin/META-INF/persistence.xml. Lets start
> > with the simple solution before we go too far.
> >
> > Thanks,
> > Rick
> >
> > [1]
> >
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
> >
> > On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> > hiran.chaudhuri@amadeus.com>
> wrote:
> >
> > >
> > > Hi there.
> > >
> > > On OpenJPA 2.0.0 I try to use the ant based
> enhancement step. However I
> > > keep getting this error message:
> > >
> > > <openjpa-2.0.0-r422266:935683 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.
> > >
> > >
> > > So I figure it is something about my
> persistence.xml file (that already
> > > worked for runtime enhanced classes). Now where
> exactly do I have to
> > place
> > > the file for OpenJPA to find it?
> > > If there is a <properties> or
> <propertiesFile> attribute, how are these
> > > specified for the ant task? Unfortunately the
> documentation seems not to
> > be
> > > in sync with this error message.
> > > And finally - just if it is the security policy:
> What could I look out
> > for
> > > here?
> > >
> > > Can somebody shed some more light on this?
> > >
> > > Hiran
> > >
> > >
> > > *Hiran Chaudhuri**
> > > System Support Programmer / Analyst*
> > > IT Service Assurance
> > > Hosting & Regional Services (IH)
> > > Amadeus Data Processing GmbH
> > > Berghamer Strasse 6
> > > 85435 Erding
> > > T: +49-8122-43x3662
> > > hiran.chaudhuri@amadeus.com*
> > > **http://www.amadeus.com* <http://www.amadeus.com/>
> > >
> > > [image: Amadeus logo] <http://www.amadeus.com/>
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
>
Re: Ant based enhancement
Posted by Mark Struberg <st...@yahoo.de>.
Hiran, are you really using ant - or are you using maven and only are not aware of the openjpa-maven-plugin [1]?
LieGrue,
strub
[1] http://mojo.codehaus.org/openjpa-maven-plugin/
--- On Mon, 5/17/10, Rick Curtis <cu...@gmail.com> wrote:
> From: Rick Curtis <cu...@gmail.com>
> Subject: Re: Ant based enhancement
> To: users@openjpa.apache.org
> Date: Monday, May 17, 2010, 2:25 PM
> I'm not an ant expert, but I do
> notice that in the blog posting the openjpac
> task specifies a <classpath> element. Try working
> that element in to see if
> it clears up your problems.
>
> Thanks,
> Rick
>
> On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com>
> wrote:
>
> >
> > Hi, Rick.
> >
> > Thank you for the quick response. I read the blog,
> which clearly says the
> > persistence.xml file should be in the right location
> once the enhancer runs.
> > My build.xml file snippet looks like this:
> >
> > <openjpac
> directory="build/jar">
> >
> <fileset dir=".">
> >
> <include name="**/*.*" />
> >
> </fileset>
> >
> </openjpac>
> >
> > The build/jar directory is created by Netbeans 6.8,
> and it compiles all
> > java source files to that location.
> > So inside <dir hosting build.xml>/build/jar I
> find these entries:
> > log4j.properties
> (my log4j
> configuration file, which
> > will appear on the classpath later)
> > META-INF
> >
> -application-client.xml
> > -MANIFEST.MF
> >
> -persistence.xml
> (that is the file OpenJPA should look for,
> > right?)
> > rmspilot
>
> (the package hosting all my other
> > source files)
> >
> > So I guess Netbeans did the job for me already and the
> file is in place.
> > The content of the file has proven to be usable for
> runtime enhancement, so
> > I believe it is ok.
> >
> > What else could I look for now?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> > *Rick Curtis <cu...@gmail.com>*
> > To
> > users@openjpa.apache.org
> > cc
> > bcc
> > Subject
> > Re: Ant based enhancement
> >
> > *Rick Curtis <cu...@gmail.com>*
> >
> > Please respond to : users@openjpa.apache.org
> > 17-05-10 15:55
> >
> >
> >
> > Hiran -
> >
> > I'd suggest reading through this[1] blog posting which
> talks about
> > enhanecment. Most likely the net of the message is
> that OpenJPA can't find
> > your persistence.xml file. If your build directory is
> /bin, your
> > persistence.xml file should be at
> /bin/META-INF/persistence.xml. Lets start
> > with the simple solution before we go too far.
> >
> > Thanks,
> > Rick
> >
> > [1]
> > http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
> >
> > On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> > hiran.chaudhuri@amadeus.com>
> wrote:
> >
> > >
> > > Hi there.
> > >
> > > On OpenJPA 2.0.0 I try to use the ant based
> enhancement step. However I
> > > keep getting this error message:
> > >
> > > <openjpa-2.0.0-r422266:935683 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.
> > >
> > >
> > > So I figure it is something about my
> persistence.xml file (that already
> > > worked for runtime enhanced classes). Now where
> exactly do I have to
> > place
> > > the file for OpenJPA to find it?
> > > If there is a <properties> or
> <propertiesFile> attribute, how are these
> > > specified for the ant task? Unfortunately the
> documentation seems not to
> > be
> > > in sync with this error message.
> > > And finally - just if it is the security policy:
> What could I look out
> > for
> > > here?
> > >
> > > Can somebody shed some more light on this?
> > >
> > > Hiran
> > >
> > >
> > > *Hiran Chaudhuri**
> > > System Support Programmer / Analyst*
> > > IT Service Assurance
> > > Hosting & Regional Services (IH)
> > > Amadeus Data Processing GmbH
> > > Berghamer Strasse 6
> > > 85435 Erding
> > > T: +49-8122-43x3662
> > > hiran.chaudhuri@amadeus.com*
> > > **http://www.amadeus.com* <http://www.amadeus.com/>
> > >
> > > [image: Amadeus logo] <http://www.amadeus.com/>
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
>
Re: Ant based enhancement
Posted by Rick Curtis <cu...@gmail.com>.
I'm not an ant expert, but I do notice that in the blog posting the openjpac
task specifies a <classpath> element. Try working that element in to see if
it clears up your problems.
Thanks,
Rick
On Mon, May 17, 2010 at 9:08 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi, Rick.
>
> Thank you for the quick response. I read the blog, which clearly says the
> persistence.xml file should be in the right location once the enhancer runs.
> My build.xml file snippet looks like this:
>
> <openjpac directory="build/jar">
> <fileset dir=".">
> <include name="**/*.*" />
> </fileset>
> </openjpac>
>
> The build/jar directory is created by Netbeans 6.8, and it compiles all
> java source files to that location.
> So inside <dir hosting build.xml>/build/jar I find these entries:
> log4j.properties (my log4j configuration file, which
> will appear on the classpath later)
> META-INF
> -application-client.xml
> -MANIFEST.MF
> -persistence.xml (that is the file OpenJPA should look for,
> right?)
> rmspilot (the package hosting all my other
> source files)
>
> So I guess Netbeans did the job for me already and the file is in place.
> The content of the file has proven to be usable for runtime enhancement, so
> I believe it is ok.
>
> What else could I look for now?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
> *Rick Curtis <cu...@gmail.com>*
> To
> users@openjpa.apache.org
> cc
> bcc
> Subject
> Re: Ant based enhancement
>
> *Rick Curtis <cu...@gmail.com>*
>
> Please respond to : users@openjpa.apache.org
> 17-05-10 15:55
>
>
>
> Hiran -
>
> I'd suggest reading through this[1] blog posting which talks about
> enhanecment. Most likely the net of the message is that OpenJPA can't find
> your persistence.xml file. If your build directory is /bin, your
> persistence.xml file should be at /bin/META-INF/persistence.xml. Lets start
> with the simple solution before we go too far.
>
> Thanks,
> Rick
>
> [1]
> http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
>
> On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
> hiran.chaudhuri@amadeus.com> wrote:
>
> >
> > Hi there.
> >
> > On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I
> > keep getting this error message:
> >
> > <openjpa-2.0.0-r422266:935683 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.
> >
> >
> > So I figure it is something about my persistence.xml file (that already
> > worked for runtime enhanced classes). Now where exactly do I have to
> place
> > the file for OpenJPA to find it?
> > If there is a <properties> or <propertiesFile> attribute, how are these
> > specified for the ant task? Unfortunately the documentation seems not to
> be
> > in sync with this error message.
> > And finally - just if it is the security policy: What could I look out
> for
> > here?
> >
> > Can somebody shed some more light on this?
> >
> > Hiran
> >
> >
> > *Hiran Chaudhuri**
> > System Support Programmer / Analyst*
> > IT Service Assurance
> > Hosting & Regional Services (IH)
> > Amadeus Data Processing GmbH
> > Berghamer Strasse 6
> > 85435 Erding
> > T: +49-8122-43x3662
> > hiran.chaudhuri@amadeus.com*
> > **http://www.amadeus.com* <http://www.amadeus.com/>
> >
> > [image: Amadeus logo] <http://www.amadeus.com/>
> >
> >
> >
> >
>
>
>
>
>
>
Re: Ant based enhancement
Posted by Hiran Chaudhuri <hi...@amadeus.com>.
Hi, Rick.
Thank you for the quick response. I read the blog, which clearly says the
persistence.xml file should be in the right location once the enhancer
runs.
My build.xml file snippet looks like this:
<openjpac directory="build/jar">
<fileset dir=".">
<include name="**/*.*" />
</fileset>
</openjpac>
The build/jar directory is created by Netbeans 6.8, and it compiles all
java source files to that location.
So inside <dir hosting build.xml>/build/jar I find these entries:
log4j.properties (my log4j configuration file,
which will appear on the classpath later)
META-INF
-application-client.xml
-MANIFEST.MF
-persistence.xml (that is the file OpenJPA should look for,
right?)
rmspilot (the package hosting all my other
source files)
So I guess Netbeans did the job for me already and the file is in place.
The content of the file has proven to be usable for runtime enhancement,
so I believe it is ok.
What else could I look for now?
Hiran
Hiran Chaudhuri
System Support Programmer / Analyst
IT Service Assurance
Hosting & Regional Services (IH)
Amadeus Data Processing GmbH
Berghamer Strasse 6
85435 Erding
T: +49-8122-43x3662
hiran.chaudhuri@amadeus.com
http://www.amadeus.com
Rick Curtis <cu...@gmail.com>
To
users@openjpa.apache.org
cc
bcc
Subject
Re: Ant based enhancement
Rick Curtis <cu...@gmail.com>
Please respond to : users@openjpa.apache.org
17-05-10 15:55
Hiran -
I'd suggest reading through this[1] blog posting which talks about
enhanecment. Most likely the net of the message is that OpenJPA can't find
your persistence.xml file. If your build directory is /bin, your
persistence.xml file should be at /bin/META-INF/persistence.xml. Lets
start
with the simple solution before we go too far.
Thanks,
Rick
[1]
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi there.
>
> On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I
> keep getting this error message:
>
> <openjpa-2.0.0-r422266:935683 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.
>
>
> So I figure it is something about my persistence.xml file (that already
> worked for runtime enhanced classes). Now where exactly do I have to
place
> the file for OpenJPA to find it?
> If there is a <properties> or <propertiesFile> attribute, how are these
> specified for the ant task? Unfortunately the documentation seems not to
be
> in sync with this error message.
> And finally - just if it is the security policy: What could I look out
for
> here?
>
> Can somebody shed some more light on this?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
>
>
Re: Ant based enhancement
Posted by Rick Curtis <cu...@gmail.com>.
Hiran -
I'd suggest reading through this[1] blog posting which talks about
enhanecment. Most likely the net of the message is that OpenJPA can't find
your persistence.xml file. If your build directory is /bin, your
persistence.xml file should be at /bin/META-INF/persistence.xml. Lets start
with the simple solution before we go too far.
Thanks,
Rick
[1]
http://webspherepersistence.blogspot.com/2009/02/openjpa-enhancement.html
On Mon, May 17, 2010 at 8:31 AM, Hiran Chaudhuri <
hiran.chaudhuri@amadeus.com> wrote:
>
> Hi there.
>
> On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I
> keep getting this error message:
>
> <openjpa-2.0.0-r422266:935683 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.
>
>
> So I figure it is something about my persistence.xml file (that already
> worked for runtime enhanced classes). Now where exactly do I have to place
> the file for OpenJPA to find it?
> If there is a <properties> or <propertiesFile> attribute, how are these
> specified for the ant task? Unfortunately the documentation seems not to be
> in sync with this error message.
> And finally - just if it is the security policy: What could I look out for
> here?
>
> Can somebody shed some more light on this?
>
> Hiran
>
>
> *Hiran Chaudhuri**
> System Support Programmer / Analyst*
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com*
> **http://www.amadeus.com* <http://www.amadeus.com/>
>
> [image: Amadeus logo] <http://www.amadeus.com/>
>
>
>
>
Re: Ant based enhancement
Posted by Jean-Baptiste BRIAUD -- Novlog <j-...@novlog.com>.
If it can helps, here is a repost of the ant macrodef I use to enhance at buildtime.
There is a weird thing around copying the persistence.xml as it was mentioned in the doc to do it knowing the writer didn't know why :-)
So I did it too ...
macrodef is really (really really) powerfull ant concept.
<macrodef name="enhance"
description="This will enhance annotated Java entity classes.">
<attribute name="class-dir"
description="The class folder where to find .class file annotated and enhanced using OpenJPA"/>
<attribute name="persistence-xml-file" description="The full path to the persistence.xml file"/>
<attribute name="lib-dir"
description="Folder where to find /openjpa and /jpa folders that contains all the .jar"/>
<sequential>
<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
<classpath>
<fileset dir="@{lib-dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="@{class-dir}"/>
</classpath>
</taskdef>
<openjpac>
<config propertiesFile="@{persistence-xml-file}"/>
<classpath>
<fileset dir="@{lib-dir}">
<include name="**/*.jar"/>
</fileset>
<pathelement location="@{class-dir}"/>
</classpath>
</openjpac>
<mkdir dir="@{class-dir}/META-INF"/>
<copy todir="@{class-dir}/META-INF" description="Copy persistence.xml to META-INF" overwrite="yes">
<fileset file="@{persistence-xml-file}"/>
</copy>
</sequential>
</macrodef>
To use that macro :
<target name="enhance-build">
<echo message="Enhancing build ..."/>
<enhance class-dir="${build-class-dir}" persistence-xml-file="${persistence-xml-file}" lib-dir="../lib"/>
<echo message="Enhancing build complete."/>
</target>
Hope this helps.
On 17 mai 2010, at 15:31, Hiran Chaudhuri wrote:
>
> Hi there.
>
> On OpenJPA 2.0.0 I try to use the ant based enhancement step. However I keep getting this error message:
>
> <openjpa-2.0.0-r422266:935683 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.
>
>
> So I figure it is something about my persistence.xml file (that already worked for runtime enhanced classes). Now where exactly do I have to place the file for OpenJPA to find it?
> If there is a <properties> or <propertiesFile> attribute, how are these specified for the ant task? Unfortunately the documentation seems not to be in sync with this error message.
> And finally - just if it is the security policy: What could I look out for here?
>
> Can somebody shed some more light on this?
>
> Hiran
>
>
> Hiran Chaudhuri
> System Support Programmer / Analyst
> IT Service Assurance
> Hosting & Regional Services (IH)
> Amadeus Data Processing GmbH
> Berghamer Strasse 6
> 85435 Erding
> T: +49-8122-43x3662
> hiran.chaudhuri@amadeus.com
> http://www.amadeus.com
>
>
>
>
>