You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by infinity2heaven <in...@gmail.com> on 2011/06/06 21:11:13 UTC

openjpa build time enhance using maven plugin DOESN'T WORK

Been trying to run try to run openjpa:enhance goal but it works on one
persistence module and not other.

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>openjpa-maven-plugin</artifactId>
	<version>1.2</version>
	<configuration>
		<includes>xxx/core/entity/*.class</includes>
		<addDefaultConstructor>true</addDefaultConstructor>
		<enforcePropertyRestrictions>true</enforcePropertyRestrictions>                     
	</configuration>
	<executions>
		<execution>
			<id>JPA Enhance</id>
			<phase>process-classes</phase>
			<goals>
				<goal>enhance</goal>
			</goals>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>org.apache.openjpa</groupId>
			<artifactId>openjpa</artifactId>
			<version>${openjpa.version}</version>
		</dependency>
	</dependencies>
</plugin>

Exception thrown
Execution default-cli of goal
org.codehaus.mojo:openjpa-maven-plugin:1.2:enhance failed: 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.

The persistence.xml is in the CLASSPATH, yes. Everything is just fine I
double checked several times. Another module of mine doesn't have this
issue.

What am I missing?


--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6446547.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Michael Dick <mi...@gmail.com>.
I'm glad its working for you. The way I read the docs is that the warning
will come up if you do not have a LoadTimeWeaver configured (and it's safe
to ignore when it does happen).

I don't have a Spring environment handy to double check this though. If you
saw the opposite behavior I'm happy to take your word for it and make the
warning an error.

-mike

On Tue, Jun 7, 2011 at 1:24 PM, infinity2heaven
<in...@gmail.com>wrote:

> I had LoadTimeWeaver set in spring config. After looking at Spring docs and
> openjpa docs, it's clear now.
>
> Buildtime enhancing working now. Thank you.
>
> Perhaps, you could convert  http://openjpa.apache.org/integration.htmlthis
> warning  to an ERROR in a future release? It would have saved several
> hours.
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450836.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by infinity2heaven <in...@gmail.com>.
I had LoadTimeWeaver set in spring config. After looking at Spring docs and
openjpa docs, it's clear now.  

Buildtime enhancing working now. Thank you.

Perhaps, you could convert  http://openjpa.apache.org/integration.html this
warning  to an ERROR in a future release? It would have saved several hours.

--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450836.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Michael Dick <mi...@gmail.com>.
It looks to me like the unenhanced classes are being loaded with Spring. 

Can you use the same jar / class files in a standalone JSE environment? 

It might also be good to double check your Spring configuration. You should
not have a LoadTimeWeaver specified when using OpenJPA. 

-mike

--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450703.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by infinity2heaven <in...@gmail.com>.
Not sure if I follow. The test works fine with RuntimeEnhancement (althuogh
there are other bugs with RuntimeEnhancement) and the dependencies are
already included in the pom where the plugin exists.



--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450684.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Mark Struberg <st...@yahoo.de>.
Hiho!

It seems that your Datasource or any other setting in your persistence.xml needs some spring classes.

Please try to add a <dependencies> section with those dependencies directly to the <plugin> section!

<plugin>
   <artifactId>openjpa-maven-plugin...
...
   <dependencies>
     <dependency>
       <groupId>org.springframework...
       <artifactId>...
       <version>...
     </dependency>
   </dependencies>
</plugin


LieGrue,
strub


--- On Tue, 6/7/11, infinity2heaven <in...@gmail.com> wrote:

> From: infinity2heaven <in...@gmail.com>
> Subject: Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK
> To: users@openjpa.apache.org
> Date: Tuesday, June 7, 2011, 5:21 PM
> Tried exactly as you mentioned. The
> classes are being enhanced with
> implements org.apache.openjpa.enhance.PersistenceCapable.
> Still get the same
> error.
> 
> Dumping the stack trace from the unit test being run via
> eclipse. 
> 
> java.lang.IllegalStateException: Failed to load
> ApplicationContext
>     at
> org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
>     at
> org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
>     at
> org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
>     at
> org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
>     at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
>     at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
>     at
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
>     at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
>     at
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>     at
> org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
>     at
> org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
>     at
> org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
>     at
> org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
>     at
> org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
>     at
> org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
>     at
> org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
>     at
> org.junit.runners.ParentRunner.run(ParentRunner.java:236)
>     at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
>     at
> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
>     at
> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>     at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
> Caused by:
> org.springframework.beans.factory.BeanCreationException:
> Error
> creating bean with name 'profileSeedData' defined in file
> [C:\projects\tcms\TCMS.ProfileMaintenance\target\classes\xxx\profile\SeedData.class]:
> Invocation of init method failed; nested exception is
> <openjpa-1.2.2-r422266:898935 nonfatal user error>
> org.apache.openjpa.persistence.ArgumentException: This
> configuration
> disallows runtime optimization, but the following listed
> types were not
> enhanced at build time or at class load time with a
> javaagent: "[class
> xxx.profile.entity.AccountType, class
> xxx.profile.entity.ProfileLoadError,
> class xxx.profile.entity.Aba, class xxx.profile.entity.Can,
> class
> xxx.profile.entity.ProfileAudit, class
> xxx.profile.entity.ProfileAuditDetail, class
> xxx.profile.entity.ErrorCode]".
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
>     at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
>     at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
>     at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
>     at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
>     at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
>     at
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
>     at
> org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
>     at
> org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
>     at
> org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
>     ... 24 more
> Caused by: <openjpa-1.2.2-r422266:898935 nonfatal user
> error>
> org.apache.openjpa.persistence.ArgumentException: This
> configuration
> disallows runtime optimization, but the following listed
> types were not
> enhanced at build time or at class load time with a
> javaagent: "[class
> xxx.profile.entity.AccountType, class
> xxx.profile.entity.ProfileLoadError,
> class xxx.profile.entity.Aba, class xxx.profile.entity.Can,
> class
> xxx.profile.entity.ProfileAudit, class
> xxx.profile.entity.ProfileAuditDetail, class
> xxx.profile.entity.ErrorCode]".
>     at
> org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:102)
>     at
> org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:310)
>     at
> org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
>     at
> org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190)
>     at
> org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
>     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
>     at
> org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
>     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
>     at
> java.lang.reflect.Method.invoke(Method.java:612)
>     at
> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423)
>     at
> org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485)
>     at $Proxy19.createEntityManager(Unknown
> Source)
>     at
> org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:234)
>     at $Proxy20.persist(Unknown Source)
>     at
> xxx.profile.SeedData.afterPropertiesSet(SeedData.java:31)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
>     at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
>     ... 37 more
> 
> 
> 
> --
> View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450587.html
> Sent from the OpenJPA Users mailing list archive at
> Nabble.com.
> 

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by infinity2heaven <in...@gmail.com>.
Tried exactly as you mentioned. The classes are being enhanced with
implements org.apache.openjpa.enhance.PersistenceCapable. Still get the same
error.

Dumping the stack trace from the unit test being run via eclipse. 

java.lang.IllegalStateException: Failed to load ApplicationContext
	at
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:308)
	at
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:109)
	at
org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)
	at
org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:220)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:301)
	at
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:303)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:240)
	at
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at
org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)
	at
org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at
org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:180)
	at
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'profileSeedData' defined in file
[C:\projects\tcms\TCMS.ProfileMaintenance\target\classes\xxx\profile\SeedData.class]:
Invocation of init method failed; nested exception is
<openjpa-1.2.2-r422266:898935 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: This configuration
disallows runtime optimization, but the following listed types were not
enhanced at build time or at class load time with a javaagent: "[class
xxx.profile.entity.AccountType, class xxx.profile.entity.ProfileLoadError,
class xxx.profile.entity.Aba, class xxx.profile.entity.Can, class
xxx.profile.entity.ProfileAudit, class
xxx.profile.entity.ProfileAuditDetail, class xxx.profile.entity.ErrorCode]".
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
	at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
	at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
	at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
	at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
	at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
	at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
	at
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:84)
	at
org.springframework.test.context.support.AbstractGenericContextLoader.loadContext(AbstractGenericContextLoader.java:1)
	at
org.springframework.test.context.TestContext.loadApplicationContext(TestContext.java:280)
	at
org.springframework.test.context.TestContext.getApplicationContext(TestContext.java:304)
	... 24 more
Caused by: <openjpa-1.2.2-r422266:898935 nonfatal user error>
org.apache.openjpa.persistence.ArgumentException: This configuration
disallows runtime optimization, but the following listed types were not
enhanced at build time or at class load time with a javaagent: "[class
xxx.profile.entity.AccountType, class xxx.profile.entity.ProfileLoadError,
class xxx.profile.entity.Aba, class xxx.profile.entity.Can, class
xxx.profile.entity.ProfileAudit, class
xxx.profile.entity.ProfileAuditDetail, class xxx.profile.entity.ErrorCode]".
	at
org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:102)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:310)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:228)
	at
org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:190)
	at
org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
	at
org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:59)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:39)
	at java.lang.reflect.Method.invoke(Method.java:612)
	at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.invokeProxyMethod(AbstractEntityManagerFactoryBean.java:423)
	at
org.springframework.orm.jpa.AbstractEntityManagerFactoryBean$ManagedEntityManagerFactoryInvocationHandler.invoke(AbstractEntityManagerFactoryBean.java:485)
	at $Proxy19.createEntityManager(Unknown Source)
	at
org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:234)
	at $Proxy20.persist(Unknown Source)
	at xxx.profile.SeedData.afterPropertiesSet(SeedData.java:31)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
	at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
	... 37 more



--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450587.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Michael Dick <mi...@gmail.com>.
At least the tool is running.

The easiest way to verify that the classes were enhanced is to decompile
them and see if they implement the PersistenceCapable interface. Javap works
fine for this.

If your classes do not implement PersistenceCapable, try adding this to
persistence.xml to enable enhancement logging :
       <property name="openjpa.Log" value="Enhance=TRACE"/>

Then you should see something like this in your maven build :
252  BeanValidation  TRACE  [main] openjpa.Enhance - Enhancing type "class
org.apache.openjpa.example.gallery.model.Location" loaded by
java.net.URLClassLoader@1cc0a0f.
387  BeanValidation  TRACE  [main] openjpa.Enhance - Enhancing type "class
org.apache.openjpa.example.gallery.model.Album" loaded by
java.net.URLClassLoader@1cc0a0f.
433  BeanValidation  TRACE  [main] openjpa.Enhance - Enhancing type "class
org.apache.openjpa.example.gallery.model.Creator" loaded by
java.net.URLClassLoader@1cc0a0f.
499  BeanValidation  TRACE  [main] openjpa.Enhance - Enhancing type "class
org.apache.openjpa.example.gallery.model.Image" loaded by
java.net.URLClassLoader@1cc0a0f.

If the entities do implement PersistenceCapable, then there's a different
problem.

hope this helps,
-mike

On Tue, Jun 7, 2011 at 10:22 AM, infinity2heaven
<in...@gmail.com>wrote:

> just did that and get the same error:
> "This configuration disallows runtime optimization ...."
>
> How can I check if my .class files are actually enhanced?
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450082.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by infinity2heaven <in...@gmail.com>.
just did that and get the same error:
"This configuration disallows runtime optimization ...."

How can I check if my .class files are actually enhanced?

--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6450082.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Michael Dick <mi...@gmail.com>.
I took a look at the openjpa build where we also use this plugin. It looks
like the auto-detection of persistence.xml isn't working for the enhance
goal, but works for the enhance-tests goal. I'm not terribly familiar with
the plugin code though so I might be all wet.

Can you try adding the persistence.xml location to your pom file? Something
like this should work.
 <persistenceXmlFile>${project.basedir}/src/main/resources/META-INF/persistence.xml</persistenceXmlFile>

-mike

On Tue, Jun 7, 2011 at 9:36 AM, infinity2heaven
<in...@gmail.com>wrote:

> I'll take my original statement back. The original goal is a "success"
> build
> but when tests are run, it errors that classes are not enhanced.
>
>  --- openjpa-maven-plugin:1.2:enhance (default-cli) @ xxx.yyy ---
> [INFO]
> ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
>
> For the second module, I can't even run the enhancer.
>
>
>
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6449900.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by infinity2heaven <in...@gmail.com>.
I'll take my original statement back. The original goal is a "success" build
but when tests are run, it errors that classes are not enhanced.

 --- openjpa-maven-plugin:1.2:enhance (default-cli) @ xxx.yyy ---
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESS

For the second module, I can't even run the enhancer.




--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6449900.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Michael Dick <mi...@gmail.com>.
What's different between the working module, and the broken one?

You've checked that persistence.xml is on the classpath. Is it in
src/main/resources or src/test/resources, or some other location?

-mike

On Tue, Jun 7, 2011 at 8:08 AM, infinity2heaven
<in...@gmail.com>wrote:

> The issue still occurs in my end. Unfortunately, our dev environment has
> come
> to a standstill with RuntimeEnhancement not working and build time
> enhancement not working as specified.
>
> If anyone else has any ideas, appreciate it.
>
> --
> View this message in context:
> http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6449473.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>

Re: AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by infinity2heaven <in...@gmail.com>.
The issue still occurs in my end. Unfortunately, our dev environment has come
to a standstill with RuntimeEnhancement not working and build time
enhancement not working as specified.

If anyone else has any ideas, appreciate it.

--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6449473.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.

AW: openjpa build time enhance using maven plugin DOESN'T WORK

Posted by Boblitz John <Jo...@BERTSCHI.com>.
Good Morning,

Interestingly, I had the same issue yesterday, but with the Eclipse ANT enhancer.

Several of my programmers had not performed a clean synchronize / update from the  
Repostitory.  A full synch / update of the project cleared the problem.

Cheers,

John

-----Ursprüngliche Nachricht-----
Von: infinity2heaven [mailto:infinity2heaven@gmail.com] 
Gesendet: Montag, 6. Juni 2011 21:11
An: users@openjpa.apache.org
Betreff: openjpa build time enhance using maven plugin DOESN'T WORK

Been trying to run try to run openjpa:enhance goal but it works on one persistence module and not other.

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>openjpa-maven-plugin</artifactId>
	<version>1.2</version>
	<configuration>
		<includes>xxx/core/entity/*.class</includes>
		<addDefaultConstructor>true</addDefaultConstructor>
		<enforcePropertyRestrictions>true</enforcePropertyRestrictions>                     
	</configuration>
	<executions>
		<execution>
			<id>JPA Enhance</id>
			<phase>process-classes</phase>
			<goals>
				<goal>enhance</goal>
			</goals>
		</execution>
	</executions>
	<dependencies>
		<dependency>
			<groupId>org.apache.openjpa</groupId>
			<artifactId>openjpa</artifactId>
			<version>${openjpa.version}</version>
		</dependency>
	</dependencies>
</plugin>

Exception thrown
Execution default-cli of goal
org.codehaus.mojo:openjpa-maven-plugin:1.2:enhance failed: 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.

The persistence.xml is in the CLASSPATH, yes. Everything is just fine I double checked several times. Another module of mine doesn't have this issue.

What am I missing?


--
View this message in context: http://openjpa.208410.n2.nabble.com/openjpa-build-time-enhance-using-maven-plugin-DOESN-T-WORK-tp6446547p6446547.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.