You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Andy Schlaikjer (JIRA)" <ji...@apache.org> on 2008/01/10 17:46:33 UTC

[jira] Created: (OPENJPA-482) PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition

PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition
---------------------------------------------------------------------------------------------------------

                 Key: OPENJPA-482
                 URL: https://issues.apache.org/jira/browse/OPENJPA-482
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.0.1
         Environment: Linux, Apache Ant 1.7.0, Sun JDK 1.6.0_01-b06
            Reporter: Andy Schlaikjer


I've noticed some irregular behavior from the PCEnhancer's "openjpac" Ant task: When I specify a custom classpath for the task using an embedded <classpath> element, the task is unable to properly locate my persistence.xml file in the default "META-INF/persistence.xml" location relative to this path. I must explicitly specify the location of the persistence.xml file using the "propertiesFile" attribute of the nested "config" element.

Here's an outline of the layout of my project files:

project/
  build.xml
  lib/classes/...(compiled class files)...
  lib/classes/log4j.properties
  lib/classes/META-INF/persistence.xml

The relevant code from build.xml:

<path id="build.classpath">
    <fileset dir="${basedir}/lib">
      <include name="**/*.jar" />
      <exclude name="**/${dist.name}.jar" />
    </fileset>
  </path>
...
    <taskdef name="openjpac"
             classname="org.apache.openjpa.ant.PCEnhancerTask"
             classpathref="build.classpath" />
    <openjpac>
      <classpath>
        <pathelement location="${basedir}/lib/classes" />
        <path refid="build.classpath"/>
      </classpath>
    </openjpac>

If i modify the openjpac element as follows, the persistence.xml file is picked up:

<openjpac>
      <classpath>
        <pathelement location="${basedir}/lib/classes" />
        <path refid="build.classpath"/>
      </classpath>
      <config propertiesFile="${basedir}/lib/classes/META-INF/persistence.xml"/>
    </openjpac>

Here's an additional point of interest: In my persistence.xml file I set <property name="openjpa.Log" value="log4j" /> to enable Log4j logging within OpenJPA. Notice that I have my log4j.properties file in the root of my classpath hierarchy, where it should be automatically found by Log4j on initialization. When I run ant using the second configuration listed above, I see this output:

 [openjpac] log4j:WARN No appenders could be found for logger (openjpa.Runtime).
 [openjpac] log4j:WARN Please initialize the log4j system properly.

My log4j properties file does contain all required configuration, but it isn't being found by Log4j, just like the PCEnhancer task isn't picking up my persistence.xml from the specified classpath. Perhaps the PCEnhancer task is somehow incorrectly incorporating this classpath, or failing to pass it along on initialization? Perhaps to get this to work properly a new runtime must be created (fork) so the classpath is available to everything uniformly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


RE: [jira] Created: (OPENJPA-482) PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition

Posted by Pinaki Poddar <pp...@bea.com>.
Try META-INF/persistence.xml#foo instead of META-INF/persistence.xml
where 'foo' is the name of your persistence unit. Some recent changes
have impacted how OpenJPA interprets the resource strings and I had
encountered similar regression.

-----Original Message-----
From: Andy Schlaikjer (JIRA) [mailto:jira@apache.org] 
Sent: Thursday, January 10, 2008 10:47 AM
To: dev@openjpa.apache.org
Subject: [jira] Created: (OPENJPA-482) PCEnhancer Ant task unable to
find persistence.xml in default location with explicit classpath
definition

PCEnhancer Ant task unable to find persistence.xml in default location
with explicit classpath definition
------------------------------------------------------------------------
---------------------------------

                 Key: OPENJPA-482
                 URL: https://issues.apache.org/jira/browse/OPENJPA-482
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.0.1
         Environment: Linux, Apache Ant 1.7.0, Sun JDK 1.6.0_01-b06
            Reporter: Andy Schlaikjer


I've noticed some irregular behavior from the PCEnhancer's "openjpac"
Ant task: When I specify a custom classpath for the task using an
embedded <classpath> element, the task is unable to properly locate my
persistence.xml file in the default "META-INF/persistence.xml" location
relative to this path. I must explicitly specify the location of the
persistence.xml file using the "propertiesFile" attribute of the nested
"config" element.

Here's an outline of the layout of my project files:

project/
  build.xml
  lib/classes/...(compiled class files)...
  lib/classes/log4j.properties
  lib/classes/META-INF/persistence.xml

The relevant code from build.xml:

<path id="build.classpath">
    <fileset dir="${basedir}/lib">
      <include name="**/*.jar" />
      <exclude name="**/${dist.name}.jar" />
    </fileset>
  </path>
...
    <taskdef name="openjpac"
             classname="org.apache.openjpa.ant.PCEnhancerTask"
             classpathref="build.classpath" />
    <openjpac>
      <classpath>
        <pathelement location="${basedir}/lib/classes" />
        <path refid="build.classpath"/>
      </classpath>
    </openjpac>

If i modify the openjpac element as follows, the persistence.xml file is
picked up:

<openjpac>
      <classpath>
        <pathelement location="${basedir}/lib/classes" />
        <path refid="build.classpath"/>
      </classpath>
      <config
propertiesFile="${basedir}/lib/classes/META-INF/persistence.xml"/>
    </openjpac>

Here's an additional point of interest: In my persistence.xml file I set
<property name="openjpa.Log" value="log4j" /> to enable Log4j logging
within OpenJPA. Notice that I have my log4j.properties file in the root
of my classpath hierarchy, where it should be automatically found by
Log4j on initialization. When I run ant using the second configuration
listed above, I see this output:

 [openjpac] log4j:WARN No appenders could be found for logger
(openjpa.Runtime).
 [openjpac] log4j:WARN Please initialize the log4j system properly.

My log4j properties file does contain all required configuration, but it
isn't being found by Log4j, just like the PCEnhancer task isn't picking
up my persistence.xml from the specified classpath. Perhaps the
PCEnhancer task is somehow incorrectly incorporating this classpath, or
failing to pass it along on initialization? Perhaps to get this to work
properly a new runtime must be created (fork) so the classpath is
available to everything uniformly?

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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.

[jira] Commented: (OPENJPA-482) PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition

Posted by "Andy Schlaikjer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/OPENJPA-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12557710#action_12557710 ] 

Andy Schlaikjer commented on OPENJPA-482:
-----------------------------------------

I've fallen back on using an explicit <java> task to invoke the enhancer:

<java failonerror="true"
          fork="true"
          classname="org.apache.openjpa.enhance.PCEnhancer">
      <classpath>
        <pathelement location="${basedir}/lib/classes" />
        <path refid="build.classpath" />
      </classpath>
    </java>

This allows both the persistence.xml and log4j.properties files to be recognized automatically.

> PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-482
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-482
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.0.1
>         Environment: Linux, Apache Ant 1.7.0, Sun JDK 1.6.0_01-b06
>            Reporter: Andy Schlaikjer
>
> I've noticed some irregular behavior from the PCEnhancer's "openjpac" Ant task: When I specify a custom classpath for the task using an embedded <classpath> element, the task is unable to properly locate my persistence.xml file in the default "META-INF/persistence.xml" location relative to this path. I must explicitly specify the location of the persistence.xml file using the "propertiesFile" attribute of the nested "config" element.
> Here's an outline of the layout of my project files:
> project/
>   build.xml
>   lib/classes/...(compiled class files)...
>   lib/classes/log4j.properties
>   lib/classes/META-INF/persistence.xml
> The relevant code from build.xml:
> <path id="build.classpath">
>     <fileset dir="${basedir}/lib">
>       <include name="**/*.jar" />
>       <exclude name="**/${dist.name}.jar" />
>     </fileset>
>   </path>
> ...
>     <taskdef name="openjpac"
>              classname="org.apache.openjpa.ant.PCEnhancerTask"
>              classpathref="build.classpath" />
>     <openjpac>
>       <classpath>
>         <pathelement location="${basedir}/lib/classes" />
>         <path refid="build.classpath"/>
>       </classpath>
>     </openjpac>
> If i modify the openjpac element as follows, the persistence.xml file is picked up:
> <openjpac>
>       <classpath>
>         <pathelement location="${basedir}/lib/classes" />
>         <path refid="build.classpath"/>
>       </classpath>
>       <config propertiesFile="${basedir}/lib/classes/META-INF/persistence.xml"/>
>     </openjpac>
> Here's an additional point of interest: In my persistence.xml file I set <property name="openjpa.Log" value="log4j" /> to enable Log4j logging within OpenJPA. Notice that I have my log4j.properties file in the root of my classpath hierarchy, where it should be automatically found by Log4j on initialization. When I run ant using the second configuration listed above, I see this output:
>  [openjpac] log4j:WARN No appenders could be found for logger (openjpa.Runtime).
>  [openjpac] log4j:WARN Please initialize the log4j system properly.
> My log4j properties file does contain all required configuration, but it isn't being found by Log4j, just like the PCEnhancer task isn't picking up my persistence.xml from the specified classpath. Perhaps the PCEnhancer task is somehow incorrectly incorporating this classpath, or failing to pass it along on initialization? Perhaps to get this to work properly a new runtime must be created (fork) so the classpath is available to everything uniformly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (OPENJPA-482) PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition

Posted by Fr...@capgroup.com.
Just an FYI -

I have the same situation with openJPA1.0.2.
I solved it the same way you did. I was not sure it was a bug so did no
reported it.

F



                                                                           
             "Andy Schlaikjer                                              
             (JIRA)"                                                       
             <ji...@apache.org>                                          To 
                                       dev@openjpa.apache.org              
                                                                        cc 
             04/03/2008 04:19                                              
             PM                                                    Subject 
                                       [jira] Updated: (OPENJPA-482)       
                                       PCEnhancer Ant task unable to find  
             Please respond to         persistence.xml in default location 
             dev@openjpa.apach         with explicit classpath definition  
                   e.org                                                   
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           





     [
https://issues.apache.org/jira/browse/OPENJPA-482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Schlaikjer updated OPENJPA-482:
------------------------------------

    Component/s: build / infrastructure
       Priority: Minor  (was: Major)

> PCEnhancer Ant task unable to find persistence.xml in default location
with explicit classpath definition
>
---------------------------------------------------------------------------------------------------------

>
>                 Key: OPENJPA-482
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-482
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: build / infrastructure
>    Affects Versions: 1.0.1
>         Environment: Linux, Apache Ant 1.7.0, Sun JDK 1.6.0_01-b06
>            Reporter: Andy Schlaikjer
>            Priority: Minor
>
> I've noticed some irregular behavior from the PCEnhancer's "openjpac" Ant
task: When I specify a custom classpath for the task using an embedded
<classpath> element, the task is unable to properly locate my
persistence.xml file in the default "META-INF/persistence.xml" location
relative to this path. I must explicitly specify the location of the
persistence.xml file using the "propertiesFile" attribute of the nested
"config" element.
> Here's an outline of the layout of my project files:
> project/
>   build.xml
>   lib/classes/...(compiled class files)...
>   lib/classes/log4j.properties
>   lib/classes/META-INF/persistence.xml
> The relevant code from build.xml:
> <path id="build.classpath">
>     <fileset dir="${basedir}/lib">
>       <include name="**/*.jar" />
>       <exclude name="**/${dist.name}.jar" />
>     </fileset>
>   </path>
> ...
>     <taskdef name="openjpac"
>              classname="org.apache.openjpa.ant.PCEnhancerTask"
>              classpathref="build.classpath" />
>     <openjpac>
>       <classpath>
>         <pathelement location="${basedir}/lib/classes" />
>         <path refid="build.classpath"/>
>       </classpath>
>     </openjpac>
> If i modify the openjpac element as follows, the persistence.xml file is
picked up:
> <openjpac>
>       <classpath>
>         <pathelement location="${basedir}/lib/classes" />
>         <path refid="build.classpath"/>
>       </classpath>
>       <config
propertiesFile="${basedir}/lib/classes/META-INF/persistence.xml"/>
>     </openjpac>
> Here's an additional point of interest: In my persistence.xml file I set
<property name="openjpa.Log" value="log4j" /> to enable Log4j logging
within OpenJPA. Notice that I have my log4j.properties file in the root of
my classpath hierarchy, where it should be automatically found by Log4j on
initialization. When I run ant using the second configuration listed above,
I see this output:
>  [openjpac] log4j:WARN No appenders could be found for logger
(openjpa.Runtime).
>  [openjpac] log4j:WARN Please initialize the log4j system properly.
> My log4j properties file does contain all required configuration, but it
isn't being found by Log4j, just like the PCEnhancer task isn't picking up
my persistence.xml from the specified classpath. Perhaps the PCEnhancer
task is somehow incorrectly incorporating this classpath, or failing to
pass it along on initialization? Perhaps to get this to work properly a new
runtime must be created (fork) so the classpath is available to everything
uniformly?

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.




[jira] Updated: (OPENJPA-482) PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition

Posted by "Andy Schlaikjer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENJPA-482?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andy Schlaikjer updated OPENJPA-482:
------------------------------------

    Component/s: build / infrastructure
       Priority: Minor  (was: Major)

> PCEnhancer Ant task unable to find persistence.xml in default location with explicit classpath definition
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-482
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-482
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: build / infrastructure
>    Affects Versions: 1.0.1
>         Environment: Linux, Apache Ant 1.7.0, Sun JDK 1.6.0_01-b06
>            Reporter: Andy Schlaikjer
>            Priority: Minor
>
> I've noticed some irregular behavior from the PCEnhancer's "openjpac" Ant task: When I specify a custom classpath for the task using an embedded <classpath> element, the task is unable to properly locate my persistence.xml file in the default "META-INF/persistence.xml" location relative to this path. I must explicitly specify the location of the persistence.xml file using the "propertiesFile" attribute of the nested "config" element.
> Here's an outline of the layout of my project files:
> project/
>   build.xml
>   lib/classes/...(compiled class files)...
>   lib/classes/log4j.properties
>   lib/classes/META-INF/persistence.xml
> The relevant code from build.xml:
> <path id="build.classpath">
>     <fileset dir="${basedir}/lib">
>       <include name="**/*.jar" />
>       <exclude name="**/${dist.name}.jar" />
>     </fileset>
>   </path>
> ...
>     <taskdef name="openjpac"
>              classname="org.apache.openjpa.ant.PCEnhancerTask"
>              classpathref="build.classpath" />
>     <openjpac>
>       <classpath>
>         <pathelement location="${basedir}/lib/classes" />
>         <path refid="build.classpath"/>
>       </classpath>
>     </openjpac>
> If i modify the openjpac element as follows, the persistence.xml file is picked up:
> <openjpac>
>       <classpath>
>         <pathelement location="${basedir}/lib/classes" />
>         <path refid="build.classpath"/>
>       </classpath>
>       <config propertiesFile="${basedir}/lib/classes/META-INF/persistence.xml"/>
>     </openjpac>
> Here's an additional point of interest: In my persistence.xml file I set <property name="openjpa.Log" value="log4j" /> to enable Log4j logging within OpenJPA. Notice that I have my log4j.properties file in the root of my classpath hierarchy, where it should be automatically found by Log4j on initialization. When I run ant using the second configuration listed above, I see this output:
>  [openjpac] log4j:WARN No appenders could be found for logger (openjpa.Runtime).
>  [openjpac] log4j:WARN Please initialize the log4j system properly.
> My log4j properties file does contain all required configuration, but it isn't being found by Log4j, just like the PCEnhancer task isn't picking up my persistence.xml from the specified classpath. Perhaps the PCEnhancer task is somehow incorrectly incorporating this classpath, or failing to pass it along on initialization? Perhaps to get this to work properly a new runtime must be created (fork) so the classpath is available to everything uniformly?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.