You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@openjpa.apache.org by Na...@gmx.de on 2009/05/18 15:06:31 UTC

Runtime Enhancement: Problems with Ant Task in Eclipse

Hello everybody,

I have got another problem. This time it is a problem with runtime enhancement.

I am enhancing my classes with the following ant script started from Eclipse:

<project name="jpa_enhance_builder">
	
	<path id="enhance.cp">
		<pathelement location="${basedir}${file.separator}bin"/>
		
		<fileset dir="${basedir}${file.separator}lib/OpenJPA_1.2.1">
			<include name="**/*.jar"/>
		</fileset>
	</path>
	
	<path id="compile.classpath">
		<fileset dir="${basedir}${file.separator}/lib">
			<include name="**/*.jar"/>
		</fileset>
		
		<fileset dir="C:\GhostTO\workspace\XFTu\bin">
			<include name="**/*.class"/>
		</fileset>
		
		<fileset dir="${src}">
			<include name="**/*.class"/>
		</fileset>
	</path>
	
	<property name="cp" refid="enhance.cp"/>
	<property name="src" value="${basedir}${file.separator}src"/>
	<property name="bin" value="${basedir}${file.separator}bin"/>

	
	<target name="enhance">
		<echo message="${cp}"/>
		<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
			<classpath refid="enhance.cp"/>
		</taskdef>
		<openjpac>
			<classpath refid="enhance.cp"/>
			<config propertiesFile="./src/META-INF/persistence.xml"/>
		    <fileset dir="${src}">
		      <include name="**/entities/*.java" />
		    </fileset>
		</openjpac>
	</target>
</project>

The build runs without any problems and with setting openjpa.Log = TRACE it seems that all classes are enhanced. But if I run my application, I still get the message:

Creating subclass for "[...]". This means that your application will be less efficient and will consume more memory than it would if you ran the OpenJPA enhancer. Additionally, lazy loading will not be available for one-to-one and many-to-one persistent attributes in types using field access; they will be loaded eagerly instead.

Any ideas?
Can it be that Eclipse is somehow overwriting my enhanced classes on startup? 
-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
I tried to invoke it after a build, but the problem is that it is not invoked if I use CTRL + B or the corresponding menu items.

I just tried to delete all content from my binary folder and then starting a build, but this did not work either. Honestly, there are also no classes created. I can only generate classes by using the "Clean" command (that is why I invoked the Ant task after a "Clean").

For the case it could really be an Eclipse problem (actually seems so...): I am using Ganymede Eclipse 3.4.2 

Thank you again for your answers :)

-------- Original-Nachricht --------
> Datum: Mon, 18 May 2009 07:48:34 -0700 (PDT)
> Von: Rick Curtis <cu...@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> 
> -Naomi
> I don't think you want to invoke the script after a "Clean", my vauge
> understanding is that would be used to clean up resources that Eclipse
> wouldn't have cleaned up as part of a normal clean. In the blog posting,
> it
> shows to invoke the enhancer script on a manual and auto build, have you
> tried that yet? 
> 
> -Rick
> 
> 
> Naomi-san wrote:
> > 
> > Hi Rick,
> > 
> > I also had that thought, but the message lists all of my entities, so I
> > think they all have not been enhanced.
> > 
> > I oriented on the following tutorial for creating and invoking the build
> > script:
> > 
> >
> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
> > 
> > I edited the XML to avoid setting and checking the arguments and
> > additionally added my entities to the build path.
> > 
> > I also invoked the script on Eclipse's "Clean" process (does not make
> > sense, I think, does it?) and I started it "manually" (right click on
> the
> > enhance task and choosing "run as" - "Ant build").
> > 
> > -Naomi
> > 
> > -------- Original-Nachricht --------
> >> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
> >> Von: Rick Curtis <cu...@gmail.com>
> >> An: users@openjpa.apache.org
> >> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> > 
> >> 
> >> Is it possible that only a portion of your Entities are being enhanced
> by
> >> the
> >> build script? How are you invoking the ant build script?
> >> 
> >> -Rick
> >> -- 
> >> View this message in context:
> >>
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > 
> > -- 
> > Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> > Telefonanschluss für nur 17,95 Euro/mtl.!*
> > http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> > 
> > 
> 
> -- 
> View this message in context:
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933532.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
-Naomi
I don't think you want to invoke the script after a "Clean", my vauge
understanding is that would be used to clean up resources that Eclipse
wouldn't have cleaned up as part of a normal clean. In the blog posting, it
shows to invoke the enhancer script on a manual and auto build, have you
tried that yet? 

-Rick


Naomi-san wrote:
> 
> Hi Rick,
> 
> I also had that thought, but the message lists all of my entities, so I
> think they all have not been enhanced.
> 
> I oriented on the following tutorial for creating and invoking the build
> script:
> 
> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
> 
> I edited the XML to avoid setting and checking the arguments and
> additionally added my entities to the build path.
> 
> I also invoked the script on Eclipse's "Clean" process (does not make
> sense, I think, does it?) and I started it "manually" (right click on the
> enhance task and choosing "run as" - "Ant build").
> 
> -Naomi
> 
> -------- Original-Nachricht --------
>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
>> Von: Rick Curtis <cu...@gmail.com>
>> An: users@openjpa.apache.org
>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> 
>> 
>> Is it possible that only a portion of your Entities are being enhanced by
>> the
>> build script? How are you invoking the ant build script?
>> 
>> -Rick
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 
> -- 
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> Telefonanschluss für nur 17,95 Euro/mtl.!*
> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> 
> 

-- 
View this message in context: http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933532.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
-Naomi 

Is it possible that your application is running off some classes(perhaps in
another jar) that you compiled previously before you setup the enhancer? 

-Rick


Naomi-san wrote:
> 
> Hey David,
> 
> thank you for the tip!
> 
> I checked one of my entities with javap:
> 
> 1. After a clean and manually invoking the enhance task
> 2. After execution of my application
> 
> Both times the class has pc* methods, so it seems that they are enhanced
> and not overwritten by Eclipse.
> So why the error message? :(
> 
> -Naomi
> 
> -------- Original-Nachricht --------
>> Datum: Mon, 18 May 2009 11:13:02 -0400
>> Von: David Ezzio <de...@apache.org>
>> An: users@openjpa.apache.org
>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> 
>> Hi Naomi,
>> 
>> Three easy ways to verify that your classes have been enhanced.
>> 
>> One install DJ Decompiler (Windows) or another decompiler and verify 
>> that the class file is enhanced.
>> 
>> Two, run the JDK command:
>> javap -c <classname-without-dot-class>
>> and look for a bunch of methods with names that start with "pc".
>> 
>> Three, do a clean (unenhanced compile) and note file sizes.
>> Then do the enhancement step and expect to see a 4+ KB gain in file 
>> sizes for enhanced files.
>> 
>> Once you can tell unequivocally whether a file is enhanced, I'm sure 
>> you'll have luck troubleshooting the issue.
>> 
>> Cheers,
>> 
>> David
>> 
>> Naomi-san@gmx.de wrote:
>> > Hi Rick,
>> > 
>> > I also had that thought, but the message lists all of my entities, so I
>> think they all have not been enhanced.
>> > 
>> > I oriented on the following tutorial for creating and invoking the
>> build
>> script:
>> > 
>> >
>> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
>> > 
>> > I edited the XML to avoid setting and checking the arguments and
>> additionally added my entities to the build path.
>> > 
>> > I also invoked the script on Eclipse's "Clean" process (does not make
>> sense, I think, does it?) and I started it "manually" (right click on the
>> enhance task and choosing "run as" - "Ant build").
>> > 
>> > -Naomi
>> > 
>> > -------- Original-Nachricht --------
>> >> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
>> >> Von: Rick Curtis <cu...@gmail.com>
>> >> An: users@openjpa.apache.org
>> >> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>> > 
>> >> Is it possible that only a portion of your Entities are being enhanced
>> by
>> >> the
>> >> build script? How are you invoking the ant build script?
>> >>
>> >> -Rick
>> >> -- 
>> >> View this message in context:
>> >>
>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
>> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>> > 
> 
> -- 
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> Telefonanschluss für nur 17,95 Euro/mtl.!*
> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> 
> 

-- 
View this message in context: http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933919.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hi,

okay, this really makes sense. Even the Spring documentation says:

"Not all JPA providers impose the need of a JVM agent (Hibernate being an example). If your provider does not require an agent or you have other alternatives (for example applying enhancements at build time through a custom compiler or an ant task) the load time weaver should not be used."

So the warnings because of the missing LoadTimeWeaver really are just warnings and do not restrict the application, provided that the entities are already enhanced.

But even without any LoadTimeWeaver, lazy fetching does not work. Are there any OpenJPA settings I might have forgotten, or again some bad Spring configuration?

So far, I have my entityManagerFactory configured this way:

<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
	<property name="persistenceUnitName" value="GhostTO" />
	<property name="jpaVendorAdapter">
		<bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
			<property name="database" value="MYSQL"/>
			<property name="showSql" value="true"/>
		</bean>
	</property>
	<property name="jpaDialect">
              <bean class="org.springframework.orm.jpa.vendor.OpenJpaDialect"/>
        </property>
</bean>

Greetings!
Naomi

-------- Original-Nachricht --------
> Datum: Wed, 20 May 2009 06:26:55 -0700 (PDT)
> Von: Rick Curtis <cu...@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> 
> Naomi-
> 
> I was thinking about this problem some more this morning and since you're
> enhancing your Entities at build time, there isn't any reason to have a
> Spring weaver configured. I did some digging around and found a forum post
> regarding this very issue [1]. 
> 
> -Rick
> 
> [1] http://forum.springsource.org/showthread.php?t=44299
> 
> 
> Naomi-san wrote:
> > 
> > Hi Rick,
> > 
> > thank you so much for your time you spent!
> > 
> > Aww, I knew, that there was a time I did not have that enhance-message,
> > but I thought I just imagined it ;)
> > I already used the InstrumentationLoadTimeWeaver some time before (that
> is
> > why it was commented out in db.xml), but got warning messages that I had
> > to use it with a Java agent. Because configuration examples for Spring
> and
> > OpenJPA which I found in the internet used SimpleLoadTimeWeaver, I also
> > did so.
> > 
> > Thanks to you I had a hint where the problem might be and could search
> > more specificly and found this discussion:
> > 
> > https://issues.apache.org/jira/browse/OPENJPA-40
> > 
> > It seems that the LoadTimeWeavers provided by Spring have problems with
> > the possible byte code enhancement at runtime (or something like that). 
> > There is also an alternative "OpenJpaLoadTimeWeaver" attached, which
> just
> > excludes the org.apache.openjpa package (don't know why this helps...).
> I
> > could not find it in the Spring package where it should reside, so I
> just
> > added the source to my project, and included it in my db.xml as
> > LoadTimeWeaver.
> > 
> > Now it works without the error message but still I have another problem.
> I
> > first thought it was because the classes are not enhanced / the error
> > message, but as we found out, this is not the case:
> > 
> > I can not use lazy fetching for relations where I set the
> FetchType.LAZY.
> > If I want to get the content of the specific attributes, I always get a
> > null value (and there definitely should be any content).
> > Lazy fetching for attributes that where mapped with FetchType.EAGER but
> > reached the MaxFetchDepth does not seem to be a problem.
> > 
> > Any ideas? ^^"
> > 
> > Greetings!
> > Naomi
> > 
> > -------- Original-Nachricht --------
> >> Datum: Tue, 19 May 2009 11:05:17 -0700 (PDT)
> >> Von: Rick Curtis <cu...@gmail.com>
> >> An: users@openjpa.apache.org
> >> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> > 
> >> 
> >> Naomi --
> >> 
> >> I've spent the better part of my morning trying to figure out what was
> >> going
> >> on and I finally have an answer for you. Please don't ask me to explain
> >> why
> >> I did what I did, because honestly I'm not entirely sure what the
> problem
> >> is. Through debugging I found that there was some class definition
> >> oddness
> >> when your JUnit started running through Spring code. Please let me know
> >> if
> >> you would like more details, otherwise see below for a
> 'fix'/workaround.
> >> 
> >> In your db.xml file you define a loadTimeWeaver property for bean
> >> id="entityManagerFactory". I noticed that you had two properties and
> one
> >> of
> >> them was commented out.  When I switched from
> >> org.springframework.instrument.classloading.SimpleLoadTimeWeaver to
> >>
> org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver,
> >> the JUnit passed. Please give that a shot. 
> >> 
> >> -Rick
> >> -- 
> >> View this message in context:
> >>
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2941253.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > 
> > -- 
> > Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> > Telefonanschluss für nur 17,95 Euro/mtl.!*
> >
> http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a
> > 
> > 
> 
> -- 
> View this message in context:
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2946115.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
Naomi-

I was thinking about this problem some more this morning and since you're
enhancing your Entities at build time, there isn't any reason to have a
Spring weaver configured. I did some digging around and found a forum post
regarding this very issue [1]. 

-Rick

[1] http://forum.springsource.org/showthread.php?t=44299


Naomi-san wrote:
> 
> Hi Rick,
> 
> thank you so much for your time you spent!
> 
> Aww, I knew, that there was a time I did not have that enhance-message,
> but I thought I just imagined it ;)
> I already used the InstrumentationLoadTimeWeaver some time before (that is
> why it was commented out in db.xml), but got warning messages that I had
> to use it with a Java agent. Because configuration examples for Spring and
> OpenJPA which I found in the internet used SimpleLoadTimeWeaver, I also
> did so.
> 
> Thanks to you I had a hint where the problem might be and could search
> more specificly and found this discussion:
> 
> https://issues.apache.org/jira/browse/OPENJPA-40
> 
> It seems that the LoadTimeWeavers provided by Spring have problems with
> the possible byte code enhancement at runtime (or something like that). 
> There is also an alternative "OpenJpaLoadTimeWeaver" attached, which just
> excludes the org.apache.openjpa package (don't know why this helps...). I
> could not find it in the Spring package where it should reside, so I just
> added the source to my project, and included it in my db.xml as
> LoadTimeWeaver.
> 
> Now it works without the error message but still I have another problem. I
> first thought it was because the classes are not enhanced / the error
> message, but as we found out, this is not the case:
> 
> I can not use lazy fetching for relations where I set the FetchType.LAZY.
> If I want to get the content of the specific attributes, I always get a
> null value (and there definitely should be any content).
> Lazy fetching for attributes that where mapped with FetchType.EAGER but
> reached the MaxFetchDepth does not seem to be a problem.
> 
> Any ideas? ^^"
> 
> Greetings!
> Naomi
> 
> -------- Original-Nachricht --------
>> Datum: Tue, 19 May 2009 11:05:17 -0700 (PDT)
>> Von: Rick Curtis <cu...@gmail.com>
>> An: users@openjpa.apache.org
>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> 
>> 
>> Naomi --
>> 
>> I've spent the better part of my morning trying to figure out what was
>> going
>> on and I finally have an answer for you. Please don't ask me to explain
>> why
>> I did what I did, because honestly I'm not entirely sure what the problem
>> is. Through debugging I found that there was some class definition
>> oddness
>> when your JUnit started running through Spring code. Please let me know
>> if
>> you would like more details, otherwise see below for a 'fix'/workaround.
>> 
>> In your db.xml file you define a loadTimeWeaver property for bean
>> id="entityManagerFactory". I noticed that you had two properties and one
>> of
>> them was commented out.  When I switched from
>> org.springframework.instrument.classloading.SimpleLoadTimeWeaver to
>> org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver,
>> the JUnit passed. Please give that a shot. 
>> 
>> -Rick
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2941253.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 
> -- 
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> Telefonanschluss für nur 17,95 Euro/mtl.!*
> http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a
> 
> 

-- 
View this message in context: http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2946115.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hi Rick,

thank you so much for your time you spent!

Aww, I knew, that there was a time I did not have that enhance-message, but I thought I just imagined it ;)
I already used the InstrumentationLoadTimeWeaver some time before (that is why it was commented out in db.xml), but got warning messages that I had to use it with a Java agent. Because configuration examples for Spring and OpenJPA which I found in the internet used SimpleLoadTimeWeaver, I also did so.

Thanks to you I had a hint where the problem might be and could search more specificly and found this discussion:

https://issues.apache.org/jira/browse/OPENJPA-40

It seems that the LoadTimeWeavers provided by Spring have problems with the possible byte code enhancement at runtime (or something like that). 
There is also an alternative "OpenJpaLoadTimeWeaver" attached, which just excludes the org.apache.openjpa package (don't know why this helps...). I could not find it in the Spring package where it should reside, so I just added the source to my project, and included it in my db.xml as LoadTimeWeaver.

Now it works without the error message but still I have another problem. I first thought it was because the classes are not enhanced / the error message, but as we found out, this is not the case:

I can not use lazy fetching for relations where I set the FetchType.LAZY. If I want to get the content of the specific attributes, I always get a null value (and there definitely should be any content).
Lazy fetching for attributes that where mapped with FetchType.EAGER but reached the MaxFetchDepth does not seem to be a problem.

Any ideas? ^^"

Greetings!
Naomi

-------- Original-Nachricht --------
> Datum: Tue, 19 May 2009 11:05:17 -0700 (PDT)
> Von: Rick Curtis <cu...@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> 
> Naomi --
> 
> I've spent the better part of my morning trying to figure out what was
> going
> on and I finally have an answer for you. Please don't ask me to explain
> why
> I did what I did, because honestly I'm not entirely sure what the problem
> is. Through debugging I found that there was some class definition oddness
> when your JUnit started running through Spring code. Please let me know if
> you would like more details, otherwise see below for a 'fix'/workaround.
> 
> In your db.xml file you define a loadTimeWeaver property for bean
> id="entityManagerFactory". I noticed that you had two properties and one
> of
> them was commented out.  When I switched from
> org.springframework.instrument.classloading.SimpleLoadTimeWeaver to
> org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver,
> the JUnit passed. Please give that a shot. 
> 
> -Rick
> -- 
> View this message in context:
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2941253.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-aktionspreis/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
Naomi --

I've spent the better part of my morning trying to figure out what was going
on and I finally have an answer for you. Please don't ask me to explain why
I did what I did, because honestly I'm not entirely sure what the problem
is. Through debugging I found that there was some class definition oddness
when your JUnit started running through Spring code. Please let me know if
you would like more details, otherwise see below for a 'fix'/workaround.

In your db.xml file you define a loadTimeWeaver property for bean
id="entityManagerFactory". I noticed that you had two properties and one of
them was commented out.  When I switched from
org.springframework.instrument.classloading.SimpleLoadTimeWeaver to
org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver,
the JUnit passed. Please give that a shot. 

-Rick
-- 
View this message in context: http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2941253.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hello everybody,

I spent the whole morning to create a new small project and could not make it work, too. Also here I get the error message.

I send you the project with this mail (hopefully this works with this mailing list).

I removed the libraries from the lib folder to not make the file that big. You need the following libraries in your classpath:

OpenJPA 
(libraries have to be in the lib/OpenJPA_1.2.1 folder for the Ant script)
Spring
Commons Logging
Mysql Driver
JUnit / DbUnit / SLF4J
(I implemented a simple JUnit test with dbUnit Flatfile for testing, you also can implement your own tests without these three libraries)

I created the following model:
An Owner can own certain Kiosks. Documents can be sold by certain Kiosks and Kiosks can sell certain Documents. Available Documents are Newspapers or Magazines.

You need a MySQL database (myisam), which has the name "kioskdb" (do not forget to update the db settings in db.xml, persistence.xml and test.junit.AbstractTest). I think you can generate the DDL from the entities.

I implemented a simple JUnit test in package test.junit.KioskTest.



Today, I also tested the nightly build for enhancement and for application testing instead of the version 1.2.1 and there was also the error message, but additionally some messages for each of my entities of that type:

openjpa.Enhance - Type "class ..." is already persistence capable; skipping.

Strange, isn't it? O.o"

-Naomi


-------- Original-Nachricht --------
> Datum: Mon, 18 May 2009 13:31:10 -0700 (PDT)
> Von: Rick Curtis <cu...@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> 
> Naomi -
> I'm stumped as well... I'd say start over with a new small project and see
> if you can get that working. If you are unable to get the small project
> working, you can post a zip for us and someone will look at it. I'm still
> leaning toward an environment problem.
> 
> -Rick
> 
> 
> Craig L Russell wrote:
> > 
> > Hi Naomi,
> > 
> > On May 18, 2009, at 1:11 PM, Naomi-san@gmx.de wrote:
> > 
> >> Hi,
> >>
> >> so far, I just worked with one binary folder and did not create jars  
> >> from the project, too. I checked the whole workspace and the eclipse  
> >> classpath but did not find any double classes or imports. I even  
> >> removed all classes from the binary folder and rebuilt them.
> >>
> >> I debugged my application and had a look at the entity classes. They  
> >> contain an pcDetachedState and a pcStateManager field. Is this a  
> >> sign that the classes have been enhanced or do these fields also  
> >> occur in unenhanced classes?
> > 
> > These are a sign that the classes have been enhanced. I'm stumped.  
> > Perhaps someone could give you the location of the code inside openjpa  
> > that checks to see if the classes have been enhanced. There might be a  
> > bug there.
> > 
> > Craig
> >>
> >>
> >> -Naomi
> >>
> >> -------- Original-Nachricht --------
> >>> Datum: Mon, 18 May 2009 09:17:33 -0700
> >>> Von: Craig L Russell <Cr...@Sun.COM>
> >>> An: users@openjpa.apache.org
> >>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> >>
> >>> Hi Naomi,
> >>>
> >>> On May 18, 2009, at 8:34 AM, Naomi-san@gmx.de wrote:
> >>>
> >>>> Hey David,
> >>>>
> >>>> thank you for the tip!
> >>>>
> >>>> I checked one of my entities with javap:
> >>>>
> >>>> 1. After a clean and manually invoking the enhance task
> >>>> 2. After execution of my application
> >>>>
> >>>> Both times the class has pc* methods, so it seems that they are
> >>>> enhanced and not overwritten by Eclipse.
> >>>> So why the error message? :(
> >>>
> >>> Perhaps there is a packaging issue. Is it possible that there are
> >>> multiple versions of the classes in your classpath when you run your
> >>> project?
> >>>
> >>> Regards,
> >>>
> >>> Craig
> >>>>
> >>>>
> >>>> -Naomi
> >>>>
> >>>> -------- Original-Nachricht --------
> >>>>> Datum: Mon, 18 May 2009 11:13:02 -0400
> >>>>> Von: David Ezzio <de...@apache.org>
> >>>>> An: users@openjpa.apache.org
> >>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> >>>>
> >>>>> Hi Naomi,
> >>>>>
> >>>>> Three easy ways to verify that your classes have been enhanced.
> >>>>>
> >>>>> One install DJ Decompiler (Windows) or another decompiler and  
> >>>>> verify
> >>>>> that the class file is enhanced.
> >>>>>
> >>>>> Two, run the JDK command:
> >>>>> javap -c <classname-without-dot-class>
> >>>>> and look for a bunch of methods with names that start with "pc".
> >>>>>
> >>>>> Three, do a clean (unenhanced compile) and note file sizes.
> >>>>> Then do the enhancement step and expect to see a 4+ KB gain in file
> >>>>> sizes for enhanced files.
> >>>>>
> >>>>> Once you can tell unequivocally whether a file is enhanced, I'm  
> >>>>> sure
> >>>>> you'll have luck troubleshooting the issue.
> >>>>>
> >>>>> Cheers,
> >>>>>
> >>>>> David
> >>>>>
> >>>>> Naomi-san@gmx.de wrote:
> >>>>>> Hi Rick,
> >>>>>>
> >>>>>> I also had that thought, but the message lists all of my entities,
> >>>>>> so I
> >>>>> think they all have not been enhanced.
> >>>>>>
> >>>>>> I oriented on the following tutorial for creating and invoking the
> >>>>>> build
> >>>>> script:
> >>>>>>
> >>>>>>
> >>>>>
> >>>
> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
> >>>>>>
> >>>>>> I edited the XML to avoid setting and checking the arguments and
> >>>>> additionally added my entities to the build path.
> >>>>>>
> >>>>>> I also invoked the script on Eclipse's "Clean" process (does not
> >>>>>> make
> >>>>> sense, I think, does it?) and I started it "manually" (right click
> >>>>> on the
> >>>>> enhance task and choosing "run as" - "Ant build").
> >>>>>>
> >>>>>> -Naomi
> >>>>>>
> >>>>>> -------- Original-Nachricht --------
> >>>>>>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
> >>>>>>> Von: Rick Curtis <cu...@gmail.com>
> >>>>>>> An: users@openjpa.apache.org
> >>>>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in  
> >>>>>>> Eclipse
> >>>>>>
> >>>>>>> Is it possible that only a portion of your Entities are being
> >>>>>>> enhanced
> >>>>> by
> >>>>>>> the
> >>>>>>> build script? How are you invoking the ant build script?
> >>>>>>>
> >>>>>>> -Rick
> >>>>>>> -- 
> >>>>>>> View this message in context:
> >>>>>>>
> >>>>>
> >>>
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
> >>>>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >>>>>>
> >>>>
> >>>> -- 
> >>>> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
> >>>> Telefonanschluss für nur 17,95 Euro/mtl.!*
> >>> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> >>>
> >>> Craig L Russell
> >>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> >>> 408 276-5638 mailto:Craig.Russell@sun.com
> >>> P.S. A good JDO? O, Gasp!
> >>>
> >>
> >> -- 
> >> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +  
> >> Telefonanschluss für nur 17,95 Euro/mtl.!*
> >> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> > 
> > Craig L Russell
> > Architect, Sun Java Enterprise System http://db.apache.org/jdo
> > 408 276-5638 mailto:Craig.Russell@sun.com
> > P.S. A good JDO? O, Gasp!
> > 
> > 
> >  
> > 
> 
> -- 
> View this message in context:
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2935498.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
Naomi -
I'm stumped as well... I'd say start over with a new small project and see
if you can get that working. If you are unable to get the small project
working, you can post a zip for us and someone will look at it. I'm still
leaning toward an environment problem.

-Rick


Craig L Russell wrote:
> 
> Hi Naomi,
> 
> On May 18, 2009, at 1:11 PM, Naomi-san@gmx.de wrote:
> 
>> Hi,
>>
>> so far, I just worked with one binary folder and did not create jars  
>> from the project, too. I checked the whole workspace and the eclipse  
>> classpath but did not find any double classes or imports. I even  
>> removed all classes from the binary folder and rebuilt them.
>>
>> I debugged my application and had a look at the entity classes. They  
>> contain an pcDetachedState and a pcStateManager field. Is this a  
>> sign that the classes have been enhanced or do these fields also  
>> occur in unenhanced classes?
> 
> These are a sign that the classes have been enhanced. I'm stumped.  
> Perhaps someone could give you the location of the code inside openjpa  
> that checks to see if the classes have been enhanced. There might be a  
> bug there.
> 
> Craig
>>
>>
>> -Naomi
>>
>> -------- Original-Nachricht --------
>>> Datum: Mon, 18 May 2009 09:17:33 -0700
>>> Von: Craig L Russell <Cr...@Sun.COM>
>>> An: users@openjpa.apache.org
>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>>
>>> Hi Naomi,
>>>
>>> On May 18, 2009, at 8:34 AM, Naomi-san@gmx.de wrote:
>>>
>>>> Hey David,
>>>>
>>>> thank you for the tip!
>>>>
>>>> I checked one of my entities with javap:
>>>>
>>>> 1. After a clean and manually invoking the enhance task
>>>> 2. After execution of my application
>>>>
>>>> Both times the class has pc* methods, so it seems that they are
>>>> enhanced and not overwritten by Eclipse.
>>>> So why the error message? :(
>>>
>>> Perhaps there is a packaging issue. Is it possible that there are
>>> multiple versions of the classes in your classpath when you run your
>>> project?
>>>
>>> Regards,
>>>
>>> Craig
>>>>
>>>>
>>>> -Naomi
>>>>
>>>> -------- Original-Nachricht --------
>>>>> Datum: Mon, 18 May 2009 11:13:02 -0400
>>>>> Von: David Ezzio <de...@apache.org>
>>>>> An: users@openjpa.apache.org
>>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>>>>
>>>>> Hi Naomi,
>>>>>
>>>>> Three easy ways to verify that your classes have been enhanced.
>>>>>
>>>>> One install DJ Decompiler (Windows) or another decompiler and  
>>>>> verify
>>>>> that the class file is enhanced.
>>>>>
>>>>> Two, run the JDK command:
>>>>> javap -c <classname-without-dot-class>
>>>>> and look for a bunch of methods with names that start with "pc".
>>>>>
>>>>> Three, do a clean (unenhanced compile) and note file sizes.
>>>>> Then do the enhancement step and expect to see a 4+ KB gain in file
>>>>> sizes for enhanced files.
>>>>>
>>>>> Once you can tell unequivocally whether a file is enhanced, I'm  
>>>>> sure
>>>>> you'll have luck troubleshooting the issue.
>>>>>
>>>>> Cheers,
>>>>>
>>>>> David
>>>>>
>>>>> Naomi-san@gmx.de wrote:
>>>>>> Hi Rick,
>>>>>>
>>>>>> I also had that thought, but the message lists all of my entities,
>>>>>> so I
>>>>> think they all have not been enhanced.
>>>>>>
>>>>>> I oriented on the following tutorial for creating and invoking the
>>>>>> build
>>>>> script:
>>>>>>
>>>>>>
>>>>>
>>> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
>>>>>>
>>>>>> I edited the XML to avoid setting and checking the arguments and
>>>>> additionally added my entities to the build path.
>>>>>>
>>>>>> I also invoked the script on Eclipse's "Clean" process (does not
>>>>>> make
>>>>> sense, I think, does it?) and I started it "manually" (right click
>>>>> on the
>>>>> enhance task and choosing "run as" - "Ant build").
>>>>>>
>>>>>> -Naomi
>>>>>>
>>>>>> -------- Original-Nachricht --------
>>>>>>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
>>>>>>> Von: Rick Curtis <cu...@gmail.com>
>>>>>>> An: users@openjpa.apache.org
>>>>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in  
>>>>>>> Eclipse
>>>>>>
>>>>>>> Is it possible that only a portion of your Entities are being
>>>>>>> enhanced
>>>>> by
>>>>>>> the
>>>>>>> build script? How are you invoking the ant build script?
>>>>>>>
>>>>>>> -Rick
>>>>>>> -- 
>>>>>>> View this message in context:
>>>>>>>
>>>>>
>>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
>>>>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>>>>
>>>>
>>>> -- 
>>>> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
>>>> Telefonanschluss für nur 17,95 Euro/mtl.!*
>>> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
>>>
>>> Craig L Russell
>>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>>> 408 276-5638 mailto:Craig.Russell@sun.com
>>> P.S. A good JDO? O, Gasp!
>>>
>>
>> -- 
>> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +  
>> Telefonanschluss für nur 17,95 Euro/mtl.!*
>> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> 
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
> 
> 
>  
> 

-- 
View this message in context: http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2935498.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Naomi,

On May 18, 2009, at 1:11 PM, Naomi-san@gmx.de wrote:

> Hi,
>
> so far, I just worked with one binary folder and did not create jars  
> from the project, too. I checked the whole workspace and the eclipse  
> classpath but did not find any double classes or imports. I even  
> removed all classes from the binary folder and rebuilt them.
>
> I debugged my application and had a look at the entity classes. They  
> contain an pcDetachedState and a pcStateManager field. Is this a  
> sign that the classes have been enhanced or do these fields also  
> occur in unenhanced classes?

These are a sign that the classes have been enhanced. I'm stumped.  
Perhaps someone could give you the location of the code inside openjpa  
that checks to see if the classes have been enhanced. There might be a  
bug there.

Craig
>
>
> -Naomi
>
> -------- Original-Nachricht --------
>> Datum: Mon, 18 May 2009 09:17:33 -0700
>> Von: Craig L Russell <Cr...@Sun.COM>
>> An: users@openjpa.apache.org
>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>
>> Hi Naomi,
>>
>> On May 18, 2009, at 8:34 AM, Naomi-san@gmx.de wrote:
>>
>>> Hey David,
>>>
>>> thank you for the tip!
>>>
>>> I checked one of my entities with javap:
>>>
>>> 1. After a clean and manually invoking the enhance task
>>> 2. After execution of my application
>>>
>>> Both times the class has pc* methods, so it seems that they are
>>> enhanced and not overwritten by Eclipse.
>>> So why the error message? :(
>>
>> Perhaps there is a packaging issue. Is it possible that there are
>> multiple versions of the classes in your classpath when you run your
>> project?
>>
>> Regards,
>>
>> Craig
>>>
>>>
>>> -Naomi
>>>
>>> -------- Original-Nachricht --------
>>>> Datum: Mon, 18 May 2009 11:13:02 -0400
>>>> Von: David Ezzio <de...@apache.org>
>>>> An: users@openjpa.apache.org
>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>>>
>>>> Hi Naomi,
>>>>
>>>> Three easy ways to verify that your classes have been enhanced.
>>>>
>>>> One install DJ Decompiler (Windows) or another decompiler and  
>>>> verify
>>>> that the class file is enhanced.
>>>>
>>>> Two, run the JDK command:
>>>> javap -c <classname-without-dot-class>
>>>> and look for a bunch of methods with names that start with "pc".
>>>>
>>>> Three, do a clean (unenhanced compile) and note file sizes.
>>>> Then do the enhancement step and expect to see a 4+ KB gain in file
>>>> sizes for enhanced files.
>>>>
>>>> Once you can tell unequivocally whether a file is enhanced, I'm  
>>>> sure
>>>> you'll have luck troubleshooting the issue.
>>>>
>>>> Cheers,
>>>>
>>>> David
>>>>
>>>> Naomi-san@gmx.de wrote:
>>>>> Hi Rick,
>>>>>
>>>>> I also had that thought, but the message lists all of my entities,
>>>>> so I
>>>> think they all have not been enhanced.
>>>>>
>>>>> I oriented on the following tutorial for creating and invoking the
>>>>> build
>>>> script:
>>>>>
>>>>>
>>>>
>> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
>>>>>
>>>>> I edited the XML to avoid setting and checking the arguments and
>>>> additionally added my entities to the build path.
>>>>>
>>>>> I also invoked the script on Eclipse's "Clean" process (does not
>>>>> make
>>>> sense, I think, does it?) and I started it "manually" (right click
>>>> on the
>>>> enhance task and choosing "run as" - "Ant build").
>>>>>
>>>>> -Naomi
>>>>>
>>>>> -------- Original-Nachricht --------
>>>>>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
>>>>>> Von: Rick Curtis <cu...@gmail.com>
>>>>>> An: users@openjpa.apache.org
>>>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in  
>>>>>> Eclipse
>>>>>
>>>>>> Is it possible that only a portion of your Entities are being
>>>>>> enhanced
>>>> by
>>>>>> the
>>>>>> build script? How are you invoking the ant build script?
>>>>>>
>>>>>> -Rick
>>>>>> -- 
>>>>>> View this message in context:
>>>>>>
>>>>
>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
>>>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>>>
>>>
>>> -- 
>>> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +
>>> Telefonanschluss für nur 17,95 Euro/mtl.!*
>> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
>>
>> Craig L Russell
>> Architect, Sun Java Enterprise System http://db.apache.org/jdo
>> 408 276-5638 mailto:Craig.Russell@sun.com
>> P.S. A good JDO? O, Gasp!
>>
>
> -- 
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +  
> Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hi,

so far, I just worked with one binary folder and did not create jars from the project, too. I checked the whole workspace and the eclipse classpath but did not find any double classes or imports. I even removed all classes from the binary folder and rebuilt them.

I debugged my application and had a look at the entity classes. They contain an pcDetachedState and a pcStateManager field. Is this a sign that the classes have been enhanced or do these fields also occur in unenhanced classes?

-Naomi 

-------- Original-Nachricht --------
> Datum: Mon, 18 May 2009 09:17:33 -0700
> Von: Craig L Russell <Cr...@Sun.COM>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> Hi Naomi,
> 
> On May 18, 2009, at 8:34 AM, Naomi-san@gmx.de wrote:
> 
> > Hey David,
> >
> > thank you for the tip!
> >
> > I checked one of my entities with javap:
> >
> > 1. After a clean and manually invoking the enhance task
> > 2. After execution of my application
> >
> > Both times the class has pc* methods, so it seems that they are  
> > enhanced and not overwritten by Eclipse.
> > So why the error message? :(
> 
> Perhaps there is a packaging issue. Is it possible that there are  
> multiple versions of the classes in your classpath when you run your  
> project?
> 
> Regards,
> 
> Craig
> >
> >
> > -Naomi
> >
> > -------- Original-Nachricht --------
> >> Datum: Mon, 18 May 2009 11:13:02 -0400
> >> Von: David Ezzio <de...@apache.org>
> >> An: users@openjpa.apache.org
> >> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> >
> >> Hi Naomi,
> >>
> >> Three easy ways to verify that your classes have been enhanced.
> >>
> >> One install DJ Decompiler (Windows) or another decompiler and verify
> >> that the class file is enhanced.
> >>
> >> Two, run the JDK command:
> >> javap -c <classname-without-dot-class>
> >> and look for a bunch of methods with names that start with "pc".
> >>
> >> Three, do a clean (unenhanced compile) and note file sizes.
> >> Then do the enhancement step and expect to see a 4+ KB gain in file
> >> sizes for enhanced files.
> >>
> >> Once you can tell unequivocally whether a file is enhanced, I'm sure
> >> you'll have luck troubleshooting the issue.
> >>
> >> Cheers,
> >>
> >> David
> >>
> >> Naomi-san@gmx.de wrote:
> >>> Hi Rick,
> >>>
> >>> I also had that thought, but the message lists all of my entities,  
> >>> so I
> >> think they all have not been enhanced.
> >>>
> >>> I oriented on the following tutorial for creating and invoking the  
> >>> build
> >> script:
> >>>
> >>>
> >>
> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
> >>>
> >>> I edited the XML to avoid setting and checking the arguments and
> >> additionally added my entities to the build path.
> >>>
> >>> I also invoked the script on Eclipse's "Clean" process (does not  
> >>> make
> >> sense, I think, does it?) and I started it "manually" (right click  
> >> on the
> >> enhance task and choosing "run as" - "Ant build").
> >>>
> >>> -Naomi
> >>>
> >>> -------- Original-Nachricht --------
> >>>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
> >>>> Von: Rick Curtis <cu...@gmail.com>
> >>>> An: users@openjpa.apache.org
> >>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> >>>
> >>>> Is it possible that only a portion of your Entities are being  
> >>>> enhanced
> >> by
> >>>> the
> >>>> build script? How are you invoking the ant build script?
> >>>>
> >>>> -Rick
> >>>> -- 
> >>>> View this message in context:
> >>>>
> >>
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
> >>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >>>
> >
> > -- 
> > Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +  
> > Telefonanschluss für nur 17,95 Euro/mtl.!*
> http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a
> 
> Craig L Russell
> Architect, Sun Java Enterprise System http://db.apache.org/jdo
> 408 276-5638 mailto:Craig.Russell@sun.com
> P.S. A good JDO? O, Gasp!
> 

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Craig L Russell <Cr...@Sun.COM>.
Hi Naomi,

On May 18, 2009, at 8:34 AM, Naomi-san@gmx.de wrote:

> Hey David,
>
> thank you for the tip!
>
> I checked one of my entities with javap:
>
> 1. After a clean and manually invoking the enhance task
> 2. After execution of my application
>
> Both times the class has pc* methods, so it seems that they are  
> enhanced and not overwritten by Eclipse.
> So why the error message? :(

Perhaps there is a packaging issue. Is it possible that there are  
multiple versions of the classes in your classpath when you run your  
project?

Regards,

Craig
>
>
> -Naomi
>
> -------- Original-Nachricht --------
>> Datum: Mon, 18 May 2009 11:13:02 -0400
>> Von: David Ezzio <de...@apache.org>
>> An: users@openjpa.apache.org
>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>
>> Hi Naomi,
>>
>> Three easy ways to verify that your classes have been enhanced.
>>
>> One install DJ Decompiler (Windows) or another decompiler and verify
>> that the class file is enhanced.
>>
>> Two, run the JDK command:
>> javap -c <classname-without-dot-class>
>> and look for a bunch of methods with names that start with "pc".
>>
>> Three, do a clean (unenhanced compile) and note file sizes.
>> Then do the enhancement step and expect to see a 4+ KB gain in file
>> sizes for enhanced files.
>>
>> Once you can tell unequivocally whether a file is enhanced, I'm sure
>> you'll have luck troubleshooting the issue.
>>
>> Cheers,
>>
>> David
>>
>> Naomi-san@gmx.de wrote:
>>> Hi Rick,
>>>
>>> I also had that thought, but the message lists all of my entities,  
>>> so I
>> think they all have not been enhanced.
>>>
>>> I oriented on the following tutorial for creating and invoking the  
>>> build
>> script:
>>>
>>>
>> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
>>>
>>> I edited the XML to avoid setting and checking the arguments and
>> additionally added my entities to the build path.
>>>
>>> I also invoked the script on Eclipse's "Clean" process (does not  
>>> make
>> sense, I think, does it?) and I started it "manually" (right click  
>> on the
>> enhance task and choosing "run as" - "Ant build").
>>>
>>> -Naomi
>>>
>>> -------- Original-Nachricht --------
>>>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
>>>> Von: Rick Curtis <cu...@gmail.com>
>>>> An: users@openjpa.apache.org
>>>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
>>>
>>>> Is it possible that only a portion of your Entities are being  
>>>> enhanced
>> by
>>>> the
>>>> build script? How are you invoking the ant build script?
>>>>
>>>> -Rick
>>>> -- 
>>>> View this message in context:
>>>>
>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
>>>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
>>>
>
> -- 
> Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate +  
> Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Craig L Russell
Architect, Sun Java Enterprise System http://db.apache.org/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hey David,

thank you for the tip!

I checked one of my entities with javap:

1. After a clean and manually invoking the enhance task
2. After execution of my application

Both times the class has pc* methods, so it seems that they are enhanced and not overwritten by Eclipse.
So why the error message? :(

-Naomi

-------- Original-Nachricht --------
> Datum: Mon, 18 May 2009 11:13:02 -0400
> Von: David Ezzio <de...@apache.org>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> Hi Naomi,
> 
> Three easy ways to verify that your classes have been enhanced.
> 
> One install DJ Decompiler (Windows) or another decompiler and verify 
> that the class file is enhanced.
> 
> Two, run the JDK command:
> javap -c <classname-without-dot-class>
> and look for a bunch of methods with names that start with "pc".
> 
> Three, do a clean (unenhanced compile) and note file sizes.
> Then do the enhancement step and expect to see a 4+ KB gain in file 
> sizes for enhanced files.
> 
> Once you can tell unequivocally whether a file is enhanced, I'm sure 
> you'll have luck troubleshooting the issue.
> 
> Cheers,
> 
> David
> 
> Naomi-san@gmx.de wrote:
> > Hi Rick,
> > 
> > I also had that thought, but the message lists all of my entities, so I
> think they all have not been enhanced.
> > 
> > I oriented on the following tutorial for creating and invoking the build
> script:
> > 
> >
> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
> > 
> > I edited the XML to avoid setting and checking the arguments and
> additionally added my entities to the build path.
> > 
> > I also invoked the script on Eclipse's "Clean" process (does not make
> sense, I think, does it?) and I started it "manually" (right click on the
> enhance task and choosing "run as" - "Ant build").
> > 
> > -Naomi
> > 
> > -------- Original-Nachricht --------
> >> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
> >> Von: Rick Curtis <cu...@gmail.com>
> >> An: users@openjpa.apache.org
> >> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> > 
> >> Is it possible that only a portion of your Entities are being enhanced
> by
> >> the
> >> build script? How are you invoking the ant build script?
> >>
> >> -Rick
> >> -- 
> >> View this message in context:
> >>
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
> >> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> > 

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by David Ezzio <de...@apache.org>.
Hi Naomi,

Three easy ways to verify that your classes have been enhanced.

One install DJ Decompiler (Windows) or another decompiler and verify 
that the class file is enhanced.

Two, run the JDK command:
javap -c <classname-without-dot-class>
and look for a bunch of methods with names that start with "pc".

Three, do a clean (unenhanced compile) and note file sizes.
Then do the enhancement step and expect to see a 4+ KB gain in file 
sizes for enhanced files.

Once you can tell unequivocally whether a file is enhanced, I'm sure 
you'll have luck troubleshooting the issue.

Cheers,

David

Naomi-san@gmx.de wrote:
> Hi Rick,
> 
> I also had that thought, but the message lists all of my entities, so I think they all have not been enhanced.
> 
> I oriented on the following tutorial for creating and invoking the build script:
> 
> http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html
> 
> I edited the XML to avoid setting and checking the arguments and additionally added my entities to the build path.
> 
> I also invoked the script on Eclipse's "Clean" process (does not make sense, I think, does it?) and I started it "manually" (right click on the enhance task and choosing "run as" - "Ant build").
> 
> -Naomi
> 
> -------- Original-Nachricht --------
>> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
>> Von: Rick Curtis <cu...@gmail.com>
>> An: users@openjpa.apache.org
>> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse
> 
>> Is it possible that only a portion of your Entities are being enhanced by
>> the
>> build script? How are you invoking the ant build script?
>>
>> -Rick
>> -- 
>> View this message in context:
>> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
>> Sent from the OpenJPA Users mailing list archive at Nabble.com.
> 

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hi Rick,

I also had that thought, but the message lists all of my entities, so I think they all have not been enhanced.

I oriented on the following tutorial for creating and invoking the build script:

http://webspherepersistence.blogspot.com/2009/04/openjpa-enhancement-eclipse-builder.html

I edited the XML to avoid setting and checking the arguments and additionally added my entities to the build path.

I also invoked the script on Eclipse's "Clean" process (does not make sense, I think, does it?) and I started it "manually" (right click on the enhance task and choosing "run as" - "Ant build").

-Naomi

-------- Original-Nachricht --------
> Datum: Mon, 18 May 2009 07:06:16 -0700 (PDT)
> Von: Rick Curtis <cu...@gmail.com>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> 
> Is it possible that only a portion of your Entities are being enhanced by
> the
> build script? How are you invoking the ant build script?
> 
> -Rick
> -- 
> View this message in context:
> http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
> Sent from the OpenJPA Users mailing list archive at Nabble.com.

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Rick Curtis <cu...@gmail.com>.
Is it possible that only a portion of your Entities are being enhanced by the
build script? How are you invoking the ant build script?

-Rick
-- 
View this message in context: http://n2.nabble.com/Runtime-Enhancement%3A-Problems-with-Ant-Task-in-Eclipse-tp2932839p2933295.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.


Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Na...@gmx.de.
Hello Donald, 

thank you very much for your answer.

I already heard of that plug-in and would use it in case of doubt. But because of some security restrictions in my company also including Eclipse plug-ins, I would prefer an Ant solution to be able to hand-off the project without forcing everybody to install this plug-in.

-Naomi

-------- Original-Nachricht --------
> Datum: Mon, 18 May 2009 09:43:39 -0400
> Von: Donald Woods <dw...@apache.org>
> An: users@openjpa.apache.org
> Betreff: Re: Runtime Enhancement: Problems with Ant Task in Eclipse

> Since you're using Eclipse, maybe taking a look at the experimental 
> Eclipse plugin for OpenJPA 1.2 would help?
> 
> http://people.apache.org/~ppoddar/eclipse/
> 
> 
> -Donald
> 
> 
> Naomi-san@gmx.de wrote:
> > Hello everybody,
> > 
> > I have got another problem. This time it is a problem with runtime
> enhancement.
> > 
> > I am enhancing my classes with the following ant script started from
> Eclipse:
> > 
> > <project name="jpa_enhance_builder">
> > 	
> > 	<path id="enhance.cp">
> > 		<pathelement location="${basedir}${file.separator}bin"/>
> > 		
> > 		<fileset dir="${basedir}${file.separator}lib/OpenJPA_1.2.1">
> > 			<include name="**/*.jar"/>
> > 		</fileset>
> > 	</path>
> > 	
> > 	<path id="compile.classpath">
> > 		<fileset dir="${basedir}${file.separator}/lib">
> > 			<include name="**/*.jar"/>
> > 		</fileset>
> > 		
> > 		<fileset dir="C:\GhostTO\workspace\XFTu\bin">
> > 			<include name="**/*.class"/>
> > 		</fileset>
> > 		
> > 		<fileset dir="${src}">
> > 			<include name="**/*.class"/>
> > 		</fileset>
> > 	</path>
> > 	
> > 	<property name="cp" refid="enhance.cp"/>
> > 	<property name="src" value="${basedir}${file.separator}src"/>
> > 	<property name="bin" value="${basedir}${file.separator}bin"/>
> > 
> > 	
> > 	<target name="enhance">
> > 		<echo message="${cp}"/>
> > 		<taskdef name="openjpac"
> classname="org.apache.openjpa.ant.PCEnhancerTask">
> > 			<classpath refid="enhance.cp"/>
> > 		</taskdef>
> > 		<openjpac>
> > 			<classpath refid="enhance.cp"/>
> > 			<config propertiesFile="./src/META-INF/persistence.xml"/>
> > 		    <fileset dir="${src}">
> > 		      <include name="**/entities/*.java" />
> > 		    </fileset>
> > 		</openjpac>
> > 	</target>
> > </project>
> > 
> > The build runs without any problems and with setting openjpa.Log = TRACE
> it seems that all classes are enhanced. But if I run my application, I
> still get the message:
> > 
> > Creating subclass for "[...]". This means that your application will be
> less efficient and will consume more memory than it would if you ran the
> OpenJPA enhancer. Additionally, lazy loading will not be available for
> one-to-one and many-to-one persistent attributes in types using field access;
> they will be loaded eagerly instead.
> > 
> > Any ideas?
> > Can it be that Eclipse is somehow overwriting my enhanced classes on
> startup? 

-- 
Neu: GMX FreeDSL Komplettanschluss mit DSL 6.000 Flatrate + Telefonanschluss für nur 17,95 Euro/mtl.!* http://dslspecial.gmx.de/freedsl-surfflat/?ac=OM.AD.PD003K11308T4569a

Re: Runtime Enhancement: Problems with Ant Task in Eclipse

Posted by Donald Woods <dw...@apache.org>.
Since you're using Eclipse, maybe taking a look at the experimental 
Eclipse plugin for OpenJPA 1.2 would help?

http://people.apache.org/~ppoddar/eclipse/


-Donald


Naomi-san@gmx.de wrote:
> Hello everybody,
> 
> I have got another problem. This time it is a problem with runtime enhancement.
> 
> I am enhancing my classes with the following ant script started from Eclipse:
> 
> <project name="jpa_enhance_builder">
> 	
> 	<path id="enhance.cp">
> 		<pathelement location="${basedir}${file.separator}bin"/>
> 		
> 		<fileset dir="${basedir}${file.separator}lib/OpenJPA_1.2.1">
> 			<include name="**/*.jar"/>
> 		</fileset>
> 	</path>
> 	
> 	<path id="compile.classpath">
> 		<fileset dir="${basedir}${file.separator}/lib">
> 			<include name="**/*.jar"/>
> 		</fileset>
> 		
> 		<fileset dir="C:\GhostTO\workspace\XFTu\bin">
> 			<include name="**/*.class"/>
> 		</fileset>
> 		
> 		<fileset dir="${src}">
> 			<include name="**/*.class"/>
> 		</fileset>
> 	</path>
> 	
> 	<property name="cp" refid="enhance.cp"/>
> 	<property name="src" value="${basedir}${file.separator}src"/>
> 	<property name="bin" value="${basedir}${file.separator}bin"/>
> 
> 	
> 	<target name="enhance">
> 		<echo message="${cp}"/>
> 		<taskdef name="openjpac" classname="org.apache.openjpa.ant.PCEnhancerTask">
> 			<classpath refid="enhance.cp"/>
> 		</taskdef>
> 		<openjpac>
> 			<classpath refid="enhance.cp"/>
> 			<config propertiesFile="./src/META-INF/persistence.xml"/>
> 		    <fileset dir="${src}">
> 		      <include name="**/entities/*.java" />
> 		    </fileset>
> 		</openjpac>
> 	</target>
> </project>
> 
> The build runs without any problems and with setting openjpa.Log = TRACE it seems that all classes are enhanced. But if I run my application, I still get the message:
> 
> Creating subclass for "[...]". This means that your application will be less efficient and will consume more memory than it would if you ran the OpenJPA enhancer. Additionally, lazy loading will not be available for one-to-one and many-to-one persistent attributes in types using field access; they will be loaded eagerly instead.
> 
> Any ideas?
> Can it be that Eclipse is somehow overwriting my enhanced classes on startup?