I have an application that uses Eclipselink 2.5, and when running the Junit test cases, I always receive this warning:
[EL Warning]: metadata: 2013-08-19 01:14:05.142--ServerSession(14351551)--
Reverting the lazy setting on the OneToOne or ManyToOne attribute [currentTransit]
for the entity class [class ......persistent.entity.BPExecutionEntity] since
weaving was not enabled or did not occur.
So, I wrote a 'weaving' task on my Ant build file like this:
<target name="define.task" description="New task definition for EclipseLink static weaving">
<taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/>
</target>
<target name="weaving" description="perform weaving" depends="define.task">
<weave source="D:\...\dist\${ant.project.name}.jar"
target="D:\...\dist\woven-${ant.project.name}.jar"
persistenceinfo="D:\...\lib\persistence.jar">
<classpath>
</classpath>
</weave>
</target>
OK, everything works, and when I compile the code it generates a woven file half the size of the compiled jar. But, when I run the tests of the project then I still receive the same warning blah blah blah... since weaving was not enabled or did not occur.
Anybody knows how to remove this warning from my tests?
I finally solved the situation using dynamic weaving. As I'm using Netbeans 7.3.1, I went to the Project Options | Run | VM options
and added this text: -javaagent:C:\eclipselink\jlib\eclipselink.jar
, you can change the address to whatever address you have located the eclipselink.jar.
Then I added this line to the persistence.xml
:
<property name="eclipselink.weaving" value="true"/>
That's all. This configuration enables dynamic weaving to execute test cases and removes the [EL Warning] Reverting the lazy setting on the OneToOne or ManyToOne attribute...etc.
You need to specify that static weaving is used in your persistence.xml properties. See http://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving/Static_Weaving
"Step 2: Configure persitence.xml" for details
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With