You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Adam Hardy <ad...@cyberspaceroad.com> on 2009/03/03 11:15:23 UTC
Re: [ANN] OpenJPA Maven Plugin 1.0 Released
I am using toolProperties to specify the persistence.xml and persistence unit.
The syntax:
<toolProperties>
<property>
<name>properties</name>
<value>
${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
</value>
</property>
</toolProperties>
means "use the persistence-unit 'OpenJpaTest' in the file persistence.xml",
where 'OpenJpaTest' is what I named the XML persistence-unit node in the file -
and I have several in one persistence.xml.
I have seen it mentioned on the openjpa list:
http://article.gmane.org/gmane.comp.apache.openjpa.user/3499
where it is done like this on the command line (for javaagent - different, I know):
-javaagent:C:/eclipse.workspaces/3.2.2/openjpa-1.2.0/openjpa-all/target/openjpa-1.2.0.jar=pu=OpenJPAPU
The code from svn gave this exception:
<openjpa-1.2.0-r422266:683325 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:1567)
at
org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1558)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
at
org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
at
org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
at
org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
at org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
at
org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4457)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4439)
at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:693)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
at
org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
but if I try specifying the persistence-unit name some other way, e.g. as a
toolProperties property 'pu', it ignores me and throws this exception
(OpenJpaTest was the one I was aiming for):
[INFO] [openjpa:enhance]
203 AtomicNoDB INFO [main] 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.
224 AtomicNoDB WARN [main] openjpa.Tool - Found no class to enhance.
44 OpenJpaTest INFO [main] 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.
WARNING: Found unrecognized persistence provider
"org.hibernate.ejb.HibernatePersistence" in place of OpenJPA provider. This
provider's properties will not be used.
[INFO] ------------------------------------------------------------------------
[ERROR] FATAL ERROR
[INFO] ------------------------------------------------------------------------
[INFO]
/home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
[INFO] ------------------------------------------------------------------------
[INFO] Trace
java.util.MissingResourceException:
/home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
at
org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:309)
at
org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:337)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
at org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
at
org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
at
org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
at
org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
So basically you need to get that persistence-unit name to the PCEnhancer or it
looks like it processes all the persistence-units.
Thanks
Adam
Mark Struberg on 28/02/09 22:03, wrote:
> Hi!
>
> @Randy, txs 4 the patch, good catch.
>
> As I also commented in JIRA: A few points are still open
>
> 1.) using a different configuration XML (other than persistence.xml) should
> be provided as own plugin attribute (and not in the 'additional properties'
> list).
>
> 2.) using a different configuration XML must also work for the openjpa:sql
> and openjpa:schema mojos.
>
> I will implement this after I'm back from vacation next week.
>
> @Adam: Can you please checkout the latest from SVN and try it with this
> version?
>
> svn co https://svn.codehaus.org/mojo/trunk/mojo/openjpa-maven-plugin
>
> Do you have other wishes? So we can plan to make a 1.1 with ~ end of march.
>
> txs and LieGrue, strub
>
>
>
> --- Randy Watler <wa...@wispertel.net> schrieb am Sa, 28.2.2009:
>
>> Von: Randy Watler <wa...@wispertel.net> Betreff: Re: [ANN] OpenJPA Maven
>> Plugin 1.0 Released An: users@openjpa.apache.org Datum: Samstag, 28.
>> Februar 2009, 5:38 Mark/Adam,
>>
>> I have filed a JIRA ticket with a patch for this issue:
>> http://jira.codehaus.org/browse/MOJO-1309
>>
>> I am not sure why Adam is specifying the 'properties' property, but we use
>> it to ensure the enhancement is processing based off of a specific project
>> persistence.xml file... there are multiple persistence.xml files on the
>> classpath. I feel this is a fairly important bug to fix since I think it is
>> generally a regression from the 1.0-alpha version.
>>
>> HTH,
>>
>> Randy Watler Apache Portals Jetspeed2 Committer
>>
>> Mark Struberg wrote:
>>> Adam,
>>>
>>> For what I've seen the 'properties'
>> property specifies a file which contains the configuration.
>>> So I'm honestly a bit confused about the value:
>>> META-INF/persistence.xml#OpenJpaTest
>>>
>>> Can you please tell me what you like to achieve and
>> how your config file really looks like (including real filename).
>>>
>>> Please note that the ant tasks imho calls the
>> PCEnhancer only via spawning an own java cmd. So any error occurring may
>> not get to your eyes there.
>>>
>>> txs, strub
>>>
>>> --- Mark Struberg <st...@yahoo.de> schrieb am
>> Fr, 27.2.2009:
>>>
>>>> Von: Mark Struberg <st...@yahoo.de> Betreff: Re: [ANN] OpenJPA Maven
>>>> Plugin 1.0
>> Released
>>>> An: users@openjpa.apache.org Datum: Freitag, 27. Februar 2009, 0:11
>>>> Thanks for the response Adam! I will try to create an integration test
>>>> based on
>> your
>>>> info.
>>>>
>>>> LieGrue, strub
>>>>
>>>>
>>>> --- Adam Hardy <ad...@cyberspaceroad.com>
>> schrieb
>>>> am Do, 26.2.2009:
>>>>
>>>>
>>>>> Von: Adam Hardy
>> <ad...@cyberspaceroad.com>
>>>>> Betreff: Re: [ANN] OpenJPA Maven Plugin 1.0
>> Released
>>>>> An: users@openjpa.apache.org Datum: Donnerstag, 26. Februar 2009,
>>>>> 0:59 Mark Struberg on 25/02/09 09:49, wrote:
>>>>>
>>>>>> The Maven team is pleased to announce the
>> release
>>>>>>
>>>> of
>>>>
>>>>> the
>>>>>
>>>>>> openjpa-maven-plugin-1.0
>>>>>>
>>>>>>
>>>>>> The plugin documentation can be found
>> here:
>>>>>>
>> http://mojo.codehaus.org/openjpa-maven-plugin/
>>>>>>
>>>>> I gave it a test run and I have an error.
>> After
>>>>>
>>>> looking
>>>>
>>>>> thro the docs, the source and looking at the
>> debug, I
>>>>>
>>>> still
>>>>
>>>>> can't figure it out. I get this error:
>>>>>
>>>>> org.apache.openjpa.lib.util.ParseException:
>>>>>
>>>>>
>> org.apache.openjpa.conf.OpenJPAConfigurationImpl@52dd4e95.properties
>>>>
>>>>> = META-INF/persistence.xml#OpenJpaTest at
>>>>>
>>>>>
>> org.apache.openjpa.lib.util.Options.setInto(Options.java:237)
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.lib.util.Options.setInto(Options.java:181)
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:357)
>>
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>>
>>>>
>>>>> .... Caused by:
>> java.lang.reflect.InvocationTargetException
>>>>> at
>>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>
>>>> Method)
>>>>
>>>>> at
>>>>>
>>>>>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>
>>>>
>>>>> at
>>>>>
>>>>>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>
>>>>
>>>>> at
>>>>>
>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.lib.util.Options.invoke(Options.java:401)
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.lib.util.Options.setInto(Options.java:234)
>>>>
>>>>> ... 27 more Caused by: java.util.MissingResourceException:
>>>>> META-INF/persistence.xml#OpenJpaTest#null at
>>>>>
>>>>>
>> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:272)
>>
>>>>
>>>>> at
>>>>>
>>>>>
>> org.apache.openjpa.lib.conf.ConfigurationImpl.setProperties(ConfigurationImpl.java:762)
>>
>>>>
>>>>> ... 33 more
>>>>>
>>>>>
>>>>> My config currently uses antrun, so I know I
>> don't
>>>>>
>>>> have
>>>>
>>>>> any major issues here. This is in my pom:
>>>>>
>>>>> <plugin>
>>>>>
>>>>>
>> <artifactId>maven-war-plugin</artifactId>
>>>>> <configuration>
>>>>>
>>>>>
>> <warName>${project.artifactId}</warName>
>>>>> </configuration> </plugin> <plugin>
>>>>>
>>>>>
>>>> <groupId>org.codehaus.mojo</groupId>
>>>>
>>>>>
>>>>>
>>>>>
>> <artifactId>openjpa-maven-plugin</artifactId>
>>>>
>>>>> <executions> <execution> <id>JPA Enhance</id>
>>>>>
>> <phase>process-classes</phase>
>>>>> <goals> <goal>enhance</goal> </goals> </execution> </executions>
>>>>> <configuration> <toolProperties> <property>
>>>>>
>> <name>properties</name>
>>>>>
>>>>>
>>>>>
>> <value>META-INF/persistence.xml#OpenJpaTest</value>
>>>>
>>>>> </property> </toolProperties> <classes>
>>>>>
>>>>>
>>>>>
>> ${build.outputDirectory}/org/permacode/patternrepo/domain/entity/
>>>>
>>>>> </classes> </configuration> </plugin>
>>>>>
>>>>> Any idea what it could be, seeing that extra #null on the end of the persistence filename?
Re: OpenJPA Maven Plugin
Posted by Randy Watler <wa...@wispertel.net>.
Sorry... I meant Mark!
Mark, let me know if you want me to submit a patch.
Randy
Randy Watler wrote:
> Adam,
>
> After rereading Matt's question and your original problem report, I
> believe you are asking how to get the target/test-classes directory
> within a single project added to the class path used to invoke the
> enhancer. By default, the existing target/classes directory is
> included, but not target/test-classes.
>
> I believe that we could add a new tag/mojo list member called
> "additionalClasspathElements". AFAICT, that is the conventional
> approach to this. We could also add a mojo member for
> testClasspathElements and use those if available... i.e. in the
> process-test-classes phase.
>
> Matt... do you want me to submit a patch with either change, or do you
> want to handle this?
>
> Randy
>
> Randy Watler wrote:
>> Adam,
>>
>> I stand corrected. Let me take a look for you.
>>
>> Randy
>>
>> Adam Hardy wrote:
>>> Randy Watler on 04/03/09 14:28, wrote:
>>>> Just to clarify.... this is also using version 1.0 of the plugin? I
>>>> dont think <classes> is supported if so. Did you try this?
>>>>
>>>> <includes>${build.testOutputDirectory}/org/permacode/atomic/domain/entity/*.class</includes>
>>>>
>>>>
>>>> Just checking before I diagnose for you,
>>>
>>> Yes, I mean 1.1-SNAPSHOT actually.
>>>
>>> Is this not the correct documentation?
>>>
>>> http://mojo.codehaus.org/openjpa-maven-plugin/enhance-mojo.html
>>>
>>>
>>
>>
>
>
Re: OpenJPA Maven Plugin
Posted by Randy Watler <wa...@wispertel.net>.
Adam,
After rereading Matt's question and your original problem report, I
believe you are asking how to get the target/test-classes directory
within a single project added to the class path used to invoke the
enhancer. By default, the existing target/classes directory is included,
but not target/test-classes.
I believe that we could add a new tag/mojo list member called
"additionalClasspathElements". AFAICT, that is the conventional approach
to this. We could also add a mojo member for testClasspathElements and
use those if available... i.e. in the process-test-classes phase.
Matt... do you want me to submit a patch with either change, or do you
want to handle this?
Randy
Randy Watler wrote:
> Adam,
>
> I stand corrected. Let me take a look for you.
>
> Randy
>
> Adam Hardy wrote:
>> Randy Watler on 04/03/09 14:28, wrote:
>>> Just to clarify.... this is also using version 1.0 of the plugin? I
>>> dont think <classes> is supported if so. Did you try this?
>>>
>>> <includes>${build.testOutputDirectory}/org/permacode/atomic/domain/entity/*.class</includes>
>>>
>>>
>>> Just checking before I diagnose for you,
>>
>> Yes, I mean 1.1-SNAPSHOT actually.
>>
>> Is this not the correct documentation?
>>
>> http://mojo.codehaus.org/openjpa-maven-plugin/enhance-mojo.html
>>
>>
>
>
Re: OpenJPA Maven Plugin
Posted by Adam Hardy <ad...@cyberspaceroad.com>.
No problem! I'm just glad someone's willing to look at it. I answered Mark
Struberg's message - although I didn't say much more than I've said already.
Randy Watler on 04/03/09 15:31, wrote:
> Adam,
>
> I stand corrected. Let me take a look for you.
>
> Randy
>
> Adam Hardy wrote:
>> Randy Watler on 04/03/09 14:28, wrote:
>>> Just to clarify.... this is also using version 1.0 of the plugin? I
>>> dont think <classes> is supported if so. Did you try this?
>>>
>>> <includes>${build.testOutputDirectory}/org/permacode/atomic/domain/entity/*.class</includes>
>>>
>>>
>>> Just checking before I diagnose for you,
>>
>> Yes, I mean 1.1-SNAPSHOT actually.
>>
>> Is this not the correct documentation?
>>
>> http://mojo.codehaus.org/openjpa-maven-plugin/enhance-mojo.html
>>
>>
>
>
Re: OpenJPA Maven Plugin
Posted by Randy Watler <wa...@wispertel.net>.
Adam,
I stand corrected. Let me take a look for you.
Randy
Adam Hardy wrote:
> Randy Watler on 04/03/09 14:28, wrote:
>> Just to clarify.... this is also using version 1.0 of the plugin? I
>> dont think <classes> is supported if so. Did you try this?
>>
>> <includes>${build.testOutputDirectory}/org/permacode/atomic/domain/entity/*.class</includes>
>>
>>
>> Just checking before I diagnose for you,
>
> Yes, I mean 1.1-SNAPSHOT actually.
>
> Is this not the correct documentation?
>
> http://mojo.codehaus.org/openjpa-maven-plugin/enhance-mojo.html
>
>
Re: OpenJPA Maven Plugin
Posted by Adam Hardy <ad...@cyberspaceroad.com>.
Randy Watler on 04/03/09 14:28, wrote:
> Just to clarify.... this is also using version 1.0 of the plugin? I dont
> think <classes> is supported if so. Did you try this?
>
> <includes>${build.testOutputDirectory}/org/permacode/atomic/domain/entity/*.class</includes>
>
>
> Just checking before I diagnose for you,
Yes, I mean 1.1-SNAPSHOT actually.
Is this not the correct documentation?
http://mojo.codehaus.org/openjpa-maven-plugin/enhance-mojo.html
Re: OpenJPA Maven Plugin
Posted by Randy Watler <wa...@wispertel.net>.
Adam,
Just to clarify.... this is also using version 1.0 of the plugin? I dont
think <classes> is supported if so. Did you try this?
<includes>${build.testOutputDirectory}/org/permacode/atomic/domain/entity/*.class</includes>
Just checking before I diagnose for you,
Randy
Adam Hardy wrote:
> I now use the openjpa-maven-plugin to enhance my persistence-enabled
> classes, but I have a couple of projects which rely on a superclass,
> which needs enhancing and testing.
>
> I put this in a seperate project and wrote some unit tests for it,
> which needed a few real entity beans to demonstrate parent-child
> relationships etc. So I coded up a couple of entity beans for testing
> only, in this project.
>
> I don't want these test-only entity beans in my jar, so I put them in
> the src/test/java directory, and this caused me some confusion when
> configuring openjpa-maven-plugin.
>
> I have a couple of issues getting this to work. From debug logging, i
> can see that openjpa-maven-plugin is not including the test directory
> in the classpath, despite this config:
>
> <execution>
> <phase>process-test-classes</phase>
> <id>enhanceTestEntities</id>
> <goals>
> <goal>enhance</goal>
> </goals>
> <configuration>
> <classes>
> ${build.testOutputDirectory}/org/permacode/atomic/domain/entity
> </classes>
> <outputDirectory>${build.testOutputDirectory}</outputDirectory>
> <toolProperties>
> <property>
> <name>properties</name>
> <value>
>
> ${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
> </value>
> </property>
> </toolProperties>
> </configuration>
> </execution>
>
> So it fails with a ClassNotFoundException - is there anything I can
> configure to get the test dir into the classpath?
>
> Thanks
> Adam
>
OpenJPA Maven Plugin
Posted by Adam Hardy <ad...@cyberspaceroad.com>.
I now use the openjpa-maven-plugin to enhance my persistence-enabled classes,
but I have a couple of projects which rely on a superclass, which needs
enhancing and testing.
I put this in a seperate project and wrote some unit tests for it, which needed
a few real entity beans to demonstrate parent-child relationships etc. So I
coded up a couple of entity beans for testing only, in this project.
I don't want these test-only entity beans in my jar, so I put them in the
src/test/java directory, and this caused me some confusion when configuring
openjpa-maven-plugin.
I have a couple of issues getting this to work. From debug logging, i can see
that openjpa-maven-plugin is not including the test directory in the classpath,
despite this config:
<execution>
<phase>process-test-classes</phase>
<id>enhanceTestEntities</id>
<goals>
<goal>enhance</goal>
</goals>
<configuration>
<classes>
${build.testOutputDirectory}/org/permacode/atomic/domain/entity
</classes>
<outputDirectory>${build.testOutputDirectory}</outputDirectory>
<toolProperties>
<property>
<name>properties</name>
<value>
${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
</value>
</property>
</toolProperties>
</configuration>
</execution>
So it fails with a ClassNotFoundException - is there anything I can configure to
get the test dir into the classpath?
Thanks
Adam
Re: [ANN] OpenJPA Maven Plugin 1.0 Released
Posted by Adam Hardy <ad...@cyberspaceroad.com>.
Randy Watler on 03/03/09 17:03, wrote:
> If you have a sample persistence.xml file, that might help as well...
> perhaps it is ignoring your persistence.xml for some reason?
False alarm!
I have 2 projects and I copied the config over from one pom to the other without
remembering to change the location of the persistence.xml - they're in different
places (there is a reason for it).
So the format works for me as it does for you, with the #pu name on the end.
Sorry for the aggro.
Regards
Adam
Re: [ANN] OpenJPA Maven Plugin 1.0 Released
Posted by Randy Watler <wa...@wispertel.net>.
Adam,
I was able to successfully use the <absolute path>#<pu name>
successfully, even with multiple persistence units defined.
I am wondering if you can try specifying a ${basedir}/src/main/resources
path to specify the target persistence.xml file? I am concerned that the
test resources may not be available in the process-classes phase where
the plugin is invoked. I was unable to use a resource path to specify
the persistence.xml file, so I believe there are unresolved classpath or
build phase deps that might be contributing to the confusion here.
If you have a sample persistence.xml file, that might help as well...
perhaps it is ignoring your persistence.xml for some reason?
Randy
Adam Hardy wrote:
> I am using toolProperties to specify the persistence.xml and
> persistence unit.
>
> The syntax:
>
> <toolProperties>
> <property>
> <name>properties</name>
> <value>
> ${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
> </value>
> </property>
> </toolProperties>
>
> means "use the persistence-unit 'OpenJpaTest' in the file
> persistence.xml", where 'OpenJpaTest' is what I named the XML
> persistence-unit node in the file - and I have several in one
> persistence.xml.
>
> I have seen it mentioned on the openjpa list:
>
> http://article.gmane.org/gmane.comp.apache.openjpa.user/3499
>
> where it is done like this on the command line (for javaagent -
> different, I know):
>
> -javaagent:C:/eclipse.workspaces/3.2.2/openjpa-1.2.0/openjpa-all/target/openjpa-1.2.0.jar=pu=OpenJPAPU
>
>
> The code from svn gave this exception:
>
> <openjpa-1.2.0-r422266:683325 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:1567)
>
> at
> org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1558)
>
> at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
>
> at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
>
> at
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
> at
> org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
>
> at
> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
> at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4457)
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4439)
> at
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> at
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> at
> org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:693)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
> at
> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
>
>
>
> but if I try specifying the persistence-unit name some other way, e.g.
> as a toolProperties property 'pu', it ignores me and throws this
> exception (OpenJpaTest was the one I was aiming for):
>
> [INFO] [openjpa:enhance]
> 203 AtomicNoDB INFO [main] 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.
> 224 AtomicNoDB WARN [main] openjpa.Tool - Found no class to enhance.
> 44 OpenJpaTest INFO [main] 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.
> WARNING: Found unrecognized persistence provider
> "org.hibernate.ejb.HibernatePersistence" in place of OpenJPA
> provider. This provider's properties will not be used.
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> /home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> java.util.MissingResourceException:
> /home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
>
> at
> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:309)
>
> at
> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:337)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
> at
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> at
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> at
> org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
> at
> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
>
>
>
>
> So basically you need to get that persistence-unit name to the
> PCEnhancer or it looks like it processes all the persistence-units.
>
> Thanks
> Adam
>
> Mark Struberg on 28/02/09 22:03, wrote:
>> Hi!
>>
>> @Randy, txs 4 the patch, good catch.
>>
>> As I also commented in JIRA: A few points are still open
>>
>> 1.) using a different configuration XML (other than persistence.xml)
>> should
>> be provided as own plugin attribute (and not in the 'additional
>> properties'
>> list).
>>
>> 2.) using a different configuration XML must also work for the
>> openjpa:sql
>> and openjpa:schema mojos.
>>
>> I will implement this after I'm back from vacation next week.
>>
>> @Adam: Can you please checkout the latest from SVN and try it with this
>> version?
>>
>> svn co https://svn.codehaus.org/mojo/trunk/mojo/openjpa-maven-plugin
>>
>> Do you have other wishes? So we can plan to make a 1.1 with ~ end of
>> march.
>>
>> txs and LieGrue, strub
>>
>>
>>
>> --- Randy Watler <wa...@wispertel.net> schrieb am Sa, 28.2.2009:
>>
>>> Von: Randy Watler <wa...@wispertel.net> Betreff: Re: [ANN] OpenJPA
>>> Maven
>>> Plugin 1.0 Released An: users@openjpa.apache.org Datum: Samstag, 28.
>>> Februar 2009, 5:38 Mark/Adam,
>>>
>>> I have filed a JIRA ticket with a patch for this issue:
>>> http://jira.codehaus.org/browse/MOJO-1309
>>>
>>> I am not sure why Adam is specifying the 'properties' property, but
>>> we use
>>> it to ensure the enhancement is processing based off of a specific
>>> project
>>> persistence.xml file... there are multiple persistence.xml files on the
>>> classpath. I feel this is a fairly important bug to fix since I
>>> think it is
>>> generally a regression from the 1.0-alpha version.
>>>
>>> HTH,
>>>
>>> Randy Watler Apache Portals Jetspeed2 Committer
>>>
>>> Mark Struberg wrote:
>>>> Adam,
>>>>
>>>> For what I've seen the 'properties'
>>> property specifies a file which contains the configuration.
>>>> So I'm honestly a bit confused about the value:
>>>> META-INF/persistence.xml#OpenJpaTest
>>>>
>>>> Can you please tell me what you like to achieve and
>>> how your config file really looks like (including real filename).
>>>>
>>>> Please note that the ant tasks imho calls the
>>> PCEnhancer only via spawning an own java cmd. So any error occurring
>>> may
>>> not get to your eyes there.
>>>>
>>>> txs, strub
>>>>
>>>> --- Mark Struberg <st...@yahoo.de> schrieb am
>>> Fr, 27.2.2009:
>>>>
>>>>> Von: Mark Struberg <st...@yahoo.de> Betreff: Re: [ANN] OpenJPA
>>>>> Maven
>>>>> Plugin 1.0
>>> Released
>>>>> An: users@openjpa.apache.org Datum: Freitag, 27. Februar 2009,
>>>>> 0:11 Thanks for the response Adam! I will try to create an
>>>>> integration test
>>>>> based on
>>> your
>>>>> info.
>>>>>
>>>>> LieGrue, strub
>>>>>
>>>>>
>>>>> --- Adam Hardy <ad...@cyberspaceroad.com>
>>> schrieb
>>>>> am Do, 26.2.2009:
>>>>>
>>>>>
>>>>>> Von: Adam Hardy
>>> <ad...@cyberspaceroad.com>
>>>>>> Betreff: Re: [ANN] OpenJPA Maven Plugin 1.0
>>> Released
>>>>>> An: users@openjpa.apache.org Datum: Donnerstag, 26. Februar 2009,
>>>>>> 0:59 Mark Struberg on 25/02/09 09:49, wrote:
>>>>>>
>>>>>>> The Maven team is pleased to announce the
>>> release
>>>>>>>
>>>>> of
>>>>>
>>>>>> the
>>>>>>
>>>>>>> openjpa-maven-plugin-1.0
>>>>>>>
>>>>>>>
>>>>>>> The plugin documentation can be found
>>> here:
>>>>>>>
>>> http://mojo.codehaus.org/openjpa-maven-plugin/
>>>>>>>
>>>>>> I gave it a test run and I have an error.
>>> After
>>>>>>
>>>>> looking
>>>>>
>>>>>> thro the docs, the source and looking at the
>>> debug, I
>>>>>>
>>>>> still
>>>>>
>>>>>> can't figure it out. I get this error:
>>>>>>
>>>>>> org.apache.openjpa.lib.util.ParseException:
>>>>>>
>>>>>>
>>> org.apache.openjpa.conf.OpenJPAConfigurationImpl@52dd4e95.properties
>>>>>
>>>>>> = META-INF/persistence.xml#OpenJpaTest at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.setInto(Options.java:237)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.setInto(Options.java:181)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:357)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>>>
>>>
>>>>>
>>>>>> .... Caused by:
>>> java.lang.reflect.InvocationTargetException
>>>>>> at
>>>>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>>
>>>>> Method)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.invoke(Options.java:401)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.setInto(Options.java:234)
>>>>>
>>>>>> ... 27 more Caused by: java.util.MissingResourceException:
>>>>>> META-INF/persistence.xml#OpenJpaTest#null at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:272)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.ConfigurationImpl.setProperties(ConfigurationImpl.java:762)
>>>
>>>
>>>>>
>>>>>> ... 33 more
>>>>>>
>>>>>>
>>>>>> My config currently uses antrun, so I know I
>>> don't
>>>>>>
>>>>> have
>>>>>
>>>>>> any major issues here. This is in my pom:
>>>>>>
>>>>>> <plugin>
>>>>>>
>>>>>>
>>> <artifactId>maven-war-plugin</artifactId>
>>>>>> <configuration>
>>>>>>
>>>>>>
>>> <warName>${project.artifactId}</warName>
>>>>>> </configuration> </plugin> <plugin>
>>>>>>
>>>>>>
>>>>> <groupId>org.codehaus.mojo</groupId>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>> <artifactId>openjpa-maven-plugin</artifactId>
>>>>>
>>>>>> <executions> <execution> <id>JPA Enhance</id>
>>>>>>
>>> <phase>process-classes</phase>
>>>>>> <goals> <goal>enhance</goal> </goals> </execution> </executions>
>>>>>> <configuration> <toolProperties> <property>
>>>>>>
>>> <name>properties</name>
>>>>>>
>>>>>>
>>>>>>
>>> <value>META-INF/persistence.xml#OpenJpaTest</value>
>>>>>
>>>>>> </property> </toolProperties> <classes>
>>>>>>
>>>>>>
>>>>>>
>>> ${build.outputDirectory}/org/permacode/patternrepo/domain/entity/
>>>>>
>>>>>> </classes> </configuration> </plugin>
>>>>>>
>>>>>> Any idea what it could be, seeing that extra #null on the end of
>>>>>> the persistence filename?
>
>
Re: [ANN] OpenJPA Maven Plugin 1.0 Released
Posted by Mark Struberg <st...@yahoo.de>.
Randy, Adam,
any help is welcome - especially since I'm currently on vacation ;)
The current plugin doesn't know of any special PersistenceUnit maven property. So the only way currently is to use the toolProperties.
LieGrue,
strub
--- Randy Watler <wa...@wispertel.net> schrieb am Di, 3.3.2009:
> Von: Randy Watler <wa...@wispertel.net>
> Betreff: Re: [ANN] OpenJPA Maven Plugin 1.0 Released
> An: users@openjpa.apache.org
> Datum: Dienstag, 3. März 2009, 14:53
> Mark,
>
> Do you want me to dig into this a little further to help
> out here, or do you have it covered?
>
> Let me know,
>
> Randy
>
> Adam Hardy wrote:
> > I am using toolProperties to specify the
> persistence.xml and persistence unit.
> >
> > The syntax:
> >
> > <toolProperties>
> > <property>
> > <name>properties</name>
> > <value>
> >
> ${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
> > </value>
> > </property>
> > </toolProperties>
> >
> > means "use the persistence-unit
> 'OpenJpaTest' in the file persistence.xml",
> where 'OpenJpaTest' is what I named the XML
> persistence-unit node in the file - and I have several in
> one persistence.xml.
> >
> > I have seen it mentioned on the openjpa list:
> >
> >
> http://article.gmane.org/gmane.comp.apache.openjpa.user/3499
> >
> > where it is done like this on the command line (for
> javaagent - different, I know):
> >
> >
> -javaagent:C:/eclipse.workspaces/3.2.2/openjpa-1.2.0/openjpa-all/target/openjpa-1.2.0.jar=pu=OpenJPAPU
>
> >
> > The code from svn gave this exception:
> >
> > <openjpa-1.2.0-r422266:683325 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:1567)
>
> > at
> org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1558)
>
> > at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
>
> > at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
>
> > at
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
> > at
> org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
>
> > at
> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
> > at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
>
> > at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4457)
> > at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4439)
> > at
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> > at
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> > at
> org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:693)
>
> > at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
> > at
> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
>
> >
> >
> > but if I try specifying the persistence-unit name some
> other way, e.g. as a toolProperties property 'pu',
> it ignores me and throws this exception (OpenJpaTest was the
> one I was aiming for):
> >
> > [INFO] [openjpa:enhance]
> > 203 AtomicNoDB INFO [main] 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.
> > 224 AtomicNoDB WARN [main] openjpa.Tool - Found no
> class to enhance.
> > 44 OpenJpaTest INFO [main] 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.
> > WARNING: Found unrecognized persistence provider
> "org.hibernate.ejb.HibernatePersistence" in place
> of OpenJPA provider. This provider's properties will
> not be used.
> > [INFO]
> ------------------------------------------------------------------------
> > [ERROR] FATAL ERROR
> > [INFO]
> ------------------------------------------------------------------------
> > [INFO]
> /home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
>
> > [INFO]
> ------------------------------------------------------------------------
> > [INFO] Trace
> > java.util.MissingResourceException:
> /home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
>
> > at
> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:309)
>
> > at
> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:337)
>
> > at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
> > at
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> > at
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> > at
> org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
>
> > at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
> > at
> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
>
> >
> >
> >
> > So basically you need to get that persistence-unit
> name to the PCEnhancer or it looks like it processes all the
> persistence-units.
> >
> > Thanks
> > Adam
> >
> > Mark Struberg on 28/02/09 22:03, wrote:
> >> Hi!
> >>
> >> @Randy, txs 4 the patch, good catch.
> >>
> >> As I also commented in JIRA: A few points are
> still open
> >>
> >> 1.) using a different configuration XML (other
> than persistence.xml) should
> >> be provided as own plugin attribute (and not in
> the 'additional properties'
> >> list).
> >>
> >> 2.) using a different configuration XML must also
> work for the openjpa:sql
> >> and openjpa:schema mojos.
> >>
> >> I will implement this after I'm back from
> vacation next week.
> >>
> >> @Adam: Can you please checkout the latest from SVN
> and try it with this
> >> version?
> >>
> >> svn co
> https://svn.codehaus.org/mojo/trunk/mojo/openjpa-maven-plugin
> >>
> >> Do you have other wishes? So we can plan to make a
> 1.1 with ~ end of march.
> >>
> >> txs and LieGrue, strub
> >>
> >>
> >>
> >> --- Randy Watler <wa...@wispertel.net>
> schrieb am Sa, 28.2.2009:
> >>
> >>> Von: Randy Watler <wa...@wispertel.net>
> Betreff: Re: [ANN] OpenJPA Maven
> >>> Plugin 1.0 Released An:
> users@openjpa.apache.org Datum: Samstag, 28.
> >>> Februar 2009, 5:38 Mark/Adam,
> >>>
> >>> I have filed a JIRA ticket with a patch for
> this issue: http://jira.codehaus.org/browse/MOJO-1309
> >>>
> >>> I am not sure why Adam is specifying the
> 'properties' property, but we use
> >>> it to ensure the enhancement is processing
> based off of a specific project
> >>> persistence.xml file... there are multiple
> persistence.xml files on the
> >>> classpath. I feel this is a fairly important
> bug to fix since I think it is
> >>> generally a regression from the 1.0-alpha
> version.
> >>>
> >>> HTH,
> >>>
> >>> Randy Watler Apache Portals Jetspeed2
> Committer
> >>>
> >>> Mark Struberg wrote:
> >>>> Adam,
> >>>>
> >>>> For what I've seen the
> 'properties'
> >>> property specifies a file which contains the
> configuration.
> >>>> So I'm honestly a bit confused about
> the value: META-INF/persistence.xml#OpenJpaTest
> >>>>
> >>>> Can you please tell me what you like to
> achieve and
> >>> how your config file really looks like
> (including real filename).
> >>>>
> >>>> Please note that the ant tasks imho calls
> the
> >>> PCEnhancer only via spawning an own java cmd.
> So any error occurring may
> >>> not get to your eyes there.
> >>>>
> >>>> txs, strub
> >>>>
> >>>> --- Mark Struberg
> <st...@yahoo.de> schrieb am
> >>> Fr, 27.2.2009:
> >>>>
> >>>>> Von: Mark Struberg
> <st...@yahoo.de> Betreff: Re: [ANN] OpenJPA Maven
> >>>>> Plugin 1.0
> >>> Released
> >>>>> An: users@openjpa.apache.org Datum:
> Freitag, 27. Februar 2009, 0:11 Thanks for the response
> Adam! I will try to create an integration test
> >>>>> based on
> >>> your
> >>>>> info.
> >>>>>
> >>>>> LieGrue, strub
> >>>>>
> >>>>>
> >>>>> --- Adam Hardy
> <ad...@cyberspaceroad.com>
> >>> schrieb
> >>>>> am Do, 26.2.2009:
> >>>>>
> >>>>>
> >>>>>> Von: Adam Hardy
> >>> <ad...@cyberspaceroad.com>
> >>>>>> Betreff: Re: [ANN] OpenJPA Maven
> Plugin 1.0
> >>> Released
> >>>>>> An: users@openjpa.apache.org
> Datum: Donnerstag, 26. Februar 2009,
> >>>>>> 0:59 Mark Struberg on 25/02/09
> 09:49, wrote:
> >>>>>>
> >>>>>>> The Maven team is pleased to
> announce the
> >>> release
> >>>>>>>
> >>>>> of
> >>>>>
> >>>>>> the
> >>>>>>
> >>>>>>> openjpa-maven-plugin-1.0
> >>>>>>>
> >>>>>>>
> >>>>>>> The plugin documentation can
> be found
> >>> here:
> >>>>>>>
> >>> http://mojo.codehaus.org/openjpa-maven-plugin/
> >>>>>>>
> >>>>>> I gave it a test run and I have an
> error.
> >>> After
> >>>>>>
> >>>>> looking
> >>>>>
> >>>>>> thro the docs, the source and
> looking at the
> >>> debug, I
> >>>>>>
> >>>>> still
> >>>>>
> >>>>>> can't figure it out. I get
> this error:
> >>>>>>
> >>>>>>
> org.apache.openjpa.lib.util.ParseException:
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.conf.OpenJPAConfigurationImpl@52dd4e95.properties
> >>>>>
> >>>>>> =
> META-INF/persistence.xml#OpenJpaTest at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.util.Options.setInto(Options.java:237)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.util.Options.setInto(Options.java:181)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:357)
>
> >>>
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> >>>
> >>>>>
> >>>>>> .... Caused by:
> >>> java.lang.reflect.InvocationTargetException
> >>>>>> at
> >>>>>>
> >>>
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >>>>>>
> >>>>> Method)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>
> >>>
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>
> >>>
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>
> java.lang.reflect.Method.invoke(Method.java:597)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.util.Options.invoke(Options.java:401)
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.util.Options.setInto(Options.java:234)
> >>>>>
> >>>>>> ... 27 more Caused by:
> java.util.MissingResourceException:
> META-INF/persistence.xml#OpenJpaTest#null at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:272)
>
> >>>
> >>>>>
> >>>>>> at
> >>>>>>
> >>>>>>
> >>>
> org.apache.openjpa.lib.conf.ConfigurationImpl.setProperties(ConfigurationImpl.java:762)
>
> >>>
> >>>>>
> >>>>>> ... 33 more
> >>>>>>
> >>>>>>
> >>>>>> My config currently uses antrun,
> so I know I
> >>> don't
> >>>>>>
> >>>>> have
> >>>>>
> >>>>>> any major issues here. This is in
> my pom:
> >>>>>>
> >>>>>> <plugin>
> >>>>>>
> >>>>>>
> >>>
> <artifactId>maven-war-plugin</artifactId>
> >>>>>> <configuration>
> >>>>>>
> >>>>>>
> >>>
> <warName>${project.artifactId}</warName>
> >>>>>> </configuration>
> </plugin> <plugin>
> >>>>>>
> >>>>>>
> >>>>>
> <groupId>org.codehaus.mojo</groupId>
> >>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>
> <artifactId>openjpa-maven-plugin</artifactId>
> >>>>>
> >>>>>> <executions>
> <execution> <id>JPA Enhance</id>
> >>>>>>
> >>> <phase>process-classes</phase>
> >>>>>> <goals>
> <goal>enhance</goal> </goals>
> </execution> </executions> <configuration>
> <toolProperties> <property>
> >>>>>>
> >>> <name>properties</name>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>
> <value>META-INF/persistence.xml#OpenJpaTest</value>
> >>>>>
> >>>>>> </property>
> </toolProperties> <classes>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>
> ${build.outputDirectory}/org/permacode/patternrepo/domain/entity/
> >>>>>
> >>>>>> </classes>
> </configuration> </plugin>
> >>>>>>
> >>>>>> Any idea what it could be, seeing
> that extra #null on the end of the persistence filename?
> >
> >
Re: [ANN] OpenJPA Maven Plugin 1.0 Released
Posted by Randy Watler <wa...@wispertel.net>.
Mark,
Do you want me to dig into this a little further to help out here, or do
you have it covered?
Let me know,
Randy
Adam Hardy wrote:
> I am using toolProperties to specify the persistence.xml and
> persistence unit.
>
> The syntax:
>
> <toolProperties>
> <property>
> <name>properties</name>
> <value>
> ${build.testOutputDirectory}/META-INF/persistence.xml#OpenJpaTest
> </value>
> </property>
> </toolProperties>
>
> means "use the persistence-unit 'OpenJpaTest' in the file
> persistence.xml", where 'OpenJpaTest' is what I named the XML
> persistence-unit node in the file - and I have several in one
> persistence.xml.
>
> I have seen it mentioned on the openjpa list:
>
> http://article.gmane.org/gmane.comp.apache.openjpa.user/3499
>
> where it is done like this on the command line (for javaagent -
> different, I know):
>
> -javaagent:C:/eclipse.workspaces/3.2.2/openjpa-1.2.0/openjpa-all/target/openjpa-1.2.0.jar=pu=OpenJPAPU
>
>
> The code from svn gave this exception:
>
> <openjpa-1.2.0-r422266:683325 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:1567)
>
> at
> org.apache.openjpa.meta.MetaDataRepository.endConfiguration(MetaDataRepository.java:1558)
>
> at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:505)
>
> at
> org.apache.openjpa.lib.conf.Configurations.configureInstance(Configurations.java:430)
>
> at
> org.apache.openjpa.lib.conf.PluginValue.instantiate(PluginValue.java:103)
> at
> org.apache.openjpa.conf.MetaDataRepositoryValue.instantiate(MetaDataRepositoryValue.java:68)
>
> at
> org.apache.openjpa.lib.conf.ObjectValue.instantiate(ObjectValue.java:83)
> at
> org.apache.openjpa.conf.OpenJPAConfigurationImpl.newMetaDataRepositoryInstance(OpenJPAConfigurationImpl.java:863)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4457)
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4439)
> at
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> at
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> at
> org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:693)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
> at
> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
>
>
>
> but if I try specifying the persistence-unit name some other way, e.g.
> as a toolProperties property 'pu', it ignores me and throws this
> exception (OpenJpaTest was the one I was aiming for):
>
> [INFO] [openjpa:enhance]
> 203 AtomicNoDB INFO [main] 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.
> 224 AtomicNoDB WARN [main] openjpa.Tool - Found no class to enhance.
> 44 OpenJpaTest INFO [main] 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.
> WARNING: Found unrecognized persistence provider
> "org.hibernate.ejb.HibernatePersistence" in place of OpenJPA
> provider. This provider's properties will not be used.
> [INFO]
> ------------------------------------------------------------------------
> [ERROR] FATAL ERROR
> [INFO]
> ------------------------------------------------------------------------
> [INFO]
> /home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
>
> [INFO]
> ------------------------------------------------------------------------
> [INFO] Trace
> java.util.MissingResourceException:
> /home/adam/projects/atomic/target/test-classes/META-INF/persistence.xml#HibernateTest
>
> at
> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:309)
>
> at
> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:337)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
> at
> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
> at
> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>
> at
> org.apache.openjpa.lib.conf.Configurations.runAgainstAllAnchors(Configurations.java:698)
>
> at
> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4404)
> at
> org.codehaus.mojo.openjpa.OpenJpaEnhancerMojo.enhance(OpenJpaEnhancerMojo.java:125)
>
>
>
>
> So basically you need to get that persistence-unit name to the
> PCEnhancer or it looks like it processes all the persistence-units.
>
> Thanks
> Adam
>
> Mark Struberg on 28/02/09 22:03, wrote:
>> Hi!
>>
>> @Randy, txs 4 the patch, good catch.
>>
>> As I also commented in JIRA: A few points are still open
>>
>> 1.) using a different configuration XML (other than persistence.xml)
>> should
>> be provided as own plugin attribute (and not in the 'additional
>> properties'
>> list).
>>
>> 2.) using a different configuration XML must also work for the
>> openjpa:sql
>> and openjpa:schema mojos.
>>
>> I will implement this after I'm back from vacation next week.
>>
>> @Adam: Can you please checkout the latest from SVN and try it with this
>> version?
>>
>> svn co https://svn.codehaus.org/mojo/trunk/mojo/openjpa-maven-plugin
>>
>> Do you have other wishes? So we can plan to make a 1.1 with ~ end of
>> march.
>>
>> txs and LieGrue, strub
>>
>>
>>
>> --- Randy Watler <wa...@wispertel.net> schrieb am Sa, 28.2.2009:
>>
>>> Von: Randy Watler <wa...@wispertel.net> Betreff: Re: [ANN] OpenJPA
>>> Maven
>>> Plugin 1.0 Released An: users@openjpa.apache.org Datum: Samstag, 28.
>>> Februar 2009, 5:38 Mark/Adam,
>>>
>>> I have filed a JIRA ticket with a patch for this issue:
>>> http://jira.codehaus.org/browse/MOJO-1309
>>>
>>> I am not sure why Adam is specifying the 'properties' property, but
>>> we use
>>> it to ensure the enhancement is processing based off of a specific
>>> project
>>> persistence.xml file... there are multiple persistence.xml files on the
>>> classpath. I feel this is a fairly important bug to fix since I
>>> think it is
>>> generally a regression from the 1.0-alpha version.
>>>
>>> HTH,
>>>
>>> Randy Watler Apache Portals Jetspeed2 Committer
>>>
>>> Mark Struberg wrote:
>>>> Adam,
>>>>
>>>> For what I've seen the 'properties'
>>> property specifies a file which contains the configuration.
>>>> So I'm honestly a bit confused about the value:
>>>> META-INF/persistence.xml#OpenJpaTest
>>>>
>>>> Can you please tell me what you like to achieve and
>>> how your config file really looks like (including real filename).
>>>>
>>>> Please note that the ant tasks imho calls the
>>> PCEnhancer only via spawning an own java cmd. So any error occurring
>>> may
>>> not get to your eyes there.
>>>>
>>>> txs, strub
>>>>
>>>> --- Mark Struberg <st...@yahoo.de> schrieb am
>>> Fr, 27.2.2009:
>>>>
>>>>> Von: Mark Struberg <st...@yahoo.de> Betreff: Re: [ANN] OpenJPA
>>>>> Maven
>>>>> Plugin 1.0
>>> Released
>>>>> An: users@openjpa.apache.org Datum: Freitag, 27. Februar 2009,
>>>>> 0:11 Thanks for the response Adam! I will try to create an
>>>>> integration test
>>>>> based on
>>> your
>>>>> info.
>>>>>
>>>>> LieGrue, strub
>>>>>
>>>>>
>>>>> --- Adam Hardy <ad...@cyberspaceroad.com>
>>> schrieb
>>>>> am Do, 26.2.2009:
>>>>>
>>>>>
>>>>>> Von: Adam Hardy
>>> <ad...@cyberspaceroad.com>
>>>>>> Betreff: Re: [ANN] OpenJPA Maven Plugin 1.0
>>> Released
>>>>>> An: users@openjpa.apache.org Datum: Donnerstag, 26. Februar 2009,
>>>>>> 0:59 Mark Struberg on 25/02/09 09:49, wrote:
>>>>>>
>>>>>>> The Maven team is pleased to announce the
>>> release
>>>>>>>
>>>>> of
>>>>>
>>>>>> the
>>>>>>
>>>>>>> openjpa-maven-plugin-1.0
>>>>>>>
>>>>>>>
>>>>>>> The plugin documentation can be found
>>> here:
>>>>>>>
>>> http://mojo.codehaus.org/openjpa-maven-plugin/
>>>>>>>
>>>>>> I gave it a test run and I have an error.
>>> After
>>>>>>
>>>>> looking
>>>>>
>>>>>> thro the docs, the source and looking at the
>>> debug, I
>>>>>>
>>>>> still
>>>>>
>>>>>> can't figure it out. I get this error:
>>>>>>
>>>>>> org.apache.openjpa.lib.util.ParseException:
>>>>>>
>>>>>>
>>> org.apache.openjpa.conf.OpenJPAConfigurationImpl@52dd4e95.properties
>>>>>
>>>>>> = META-INF/persistence.xml#OpenJpaTest at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.setInto(Options.java:237)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.setInto(Options.java:181)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.Configurations.populateConfiguration(Configurations.java:357)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4438)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.enhance.PCEnhancer$1.run(PCEnhancer.java:4409)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.Configurations.launchRunnable(Configurations.java:708)
>>>
>>>
>>>>>
>>>>>> .... Caused by:
>>> java.lang.reflect.InvocationTargetException
>>>>>> at
>>>>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>>>>>>
>>>>> Method)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>> java.lang.reflect.Method.invoke(Method.java:597)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.invoke(Options.java:401)
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.util.Options.setInto(Options.java:234)
>>>>>
>>>>>> ... 27 more Caused by: java.util.MissingResourceException:
>>>>>> META-INF/persistence.xml#OpenJpaTest#null at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.ProductDerivations.load(ProductDerivations.java:272)
>>>
>>>
>>>>>
>>>>>> at
>>>>>>
>>>>>>
>>> org.apache.openjpa.lib.conf.ConfigurationImpl.setProperties(ConfigurationImpl.java:762)
>>>
>>>
>>>>>
>>>>>> ... 33 more
>>>>>>
>>>>>>
>>>>>> My config currently uses antrun, so I know I
>>> don't
>>>>>>
>>>>> have
>>>>>
>>>>>> any major issues here. This is in my pom:
>>>>>>
>>>>>> <plugin>
>>>>>>
>>>>>>
>>> <artifactId>maven-war-plugin</artifactId>
>>>>>> <configuration>
>>>>>>
>>>>>>
>>> <warName>${project.artifactId}</warName>
>>>>>> </configuration> </plugin> <plugin>
>>>>>>
>>>>>>
>>>>> <groupId>org.codehaus.mojo</groupId>
>>>>>
>>>>>>
>>>>>>
>>>>>>
>>> <artifactId>openjpa-maven-plugin</artifactId>
>>>>>
>>>>>> <executions> <execution> <id>JPA Enhance</id>
>>>>>>
>>> <phase>process-classes</phase>
>>>>>> <goals> <goal>enhance</goal> </goals> </execution> </executions>
>>>>>> <configuration> <toolProperties> <property>
>>>>>>
>>> <name>properties</name>
>>>>>>
>>>>>>
>>>>>>
>>> <value>META-INF/persistence.xml#OpenJpaTest</value>
>>>>>
>>>>>> </property> </toolProperties> <classes>
>>>>>>
>>>>>>
>>>>>>
>>> ${build.outputDirectory}/org/permacode/patternrepo/domain/entity/
>>>>>
>>>>>> </classes> </configuration> </plugin>
>>>>>>
>>>>>> Any idea what it could be, seeing that extra #null on the end of
>>>>>> the persistence filename?
>
>