openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hiran Chaudhuri <hiran.chaudh...@amadeus.com>
Subject Re: Ant based enhancement
Date Mon, 17 May 2010 15:01:48 GMT
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 <curtisr7@gmail.com> 
To
users@openjpa.apache.org
cc

bcc

Subject
Re: Ant based enhancement





Rick Curtis <curtisr7@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 <curtisr7@gmail.com>*
> To
> users@openjpa.apache.org
> cc
>   bcc
>   Subject
> Re: Ant based enhancement
>
>  *Rick Curtis <curtisr7@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/>
> >
> >
> >
> >
>
>
>
>
>
>






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