Static weave : NoClassDefFoundError
Bonjour à tous,
J'ai un projet Java Web utilisant une DB Oracle.
J'ai voulu setter quelques jointures en LAZY afin d'optimiser les performances.
J'ai donc été confronté à une erreur par jointure de type LAZY :
metadata: 2017-10-09 15:03:06.278--ServerSession()--Reverting the lazy setting on the OneToOne or ManyToOne attribute [idFamily] for the entity class [class com......entities.InterventionTypesFamilies] since weaving was not enabled or did not occur.
Après quelques recherches google, je comprend qu'il faut enrichir son build.xml pour configurer le weaving en static (car je suis sous Apache Tomcat).
Bref, voici ce que j'ai fais dans le buid.xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| <target name="-post-jar" description="New task definition for EclipseLink static weaving">
<taskdef name="weave" classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask"/>
</target>
<target name="weavingggg" description="perform weaving" depends="-post-jar">
<weave source="c:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\dist\TeamLine.jar"
target="c:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\dist\TeamLine_Weaved.jar"
persistenceinfo="c:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\src\conf\persistence.xml">
<classpath>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\Calendar.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\CCAMFramework_LDAP.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\commons-beanutils-1.9.2.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\commons-fileupload-1.3.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\commons-io-2.4.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\commons-lang3-3.4.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\commons-logging-1.1.2.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\eclipselink.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\gson-2.5.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\javax.faces.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\javax.persistence_2.1.0.v201304241213.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\jstl-1.2.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\ojdbc6.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\org.eclipse.persistence.jpa.modelgen_2.5.2.v20140319-9ad6abd.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\poi-3.10-FINAL-20140208.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\primefaces-6.0.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\primefaces-extensions-4.0.0.jar"/>
<pathelement path="C:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\lib\standard.jar"/>
</classpath>
</weave>
</target> |
Et dans le Persistence.xml :
Code:
1 2 3 4 5 6 7 8 9 10
| <?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="ConsignesPU" transaction-type="RESOURCE_LOCAL">
<non-jta-data-source>java:/comp/env/jdbc/DocsDB</non-jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<property name="eclipselink.weaving" value="static" />
<property name="eclipselink.weaving.lazy" value="true"/>
<property name="eclipselink.query-results-cache" value="false"/>
</persistence-unit>
</persistence> |
Mais lorsque je build mon projet en utilisant le weaving, j’obtiens ce message d’erreur :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
| Local Exception Stack:
Exception [EclipseLink-40007] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving: c:\Users\Alexis Camlay\Documents\NB_PROJECTS\Consignes\dist\TeamLine.jar
Internal Exception: Exception [EclipseLink-40002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: No source was specified for weaving
at org.eclipse.persistence.exceptions.StaticWeaveException.exceptionPerformWeaving(StaticWeaveException.java:138)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask.start(StaticWeaveAntTask.java:218)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask.execute(StaticWeaveAntTask.java:177)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.GeneratedMethodAccessor835.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:286)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:555)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:153)
Caused by: Exception [EclipseLink-40002] (Eclipse Persistence Services - 2.5.2.v20140319-9ad6abd): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: No source was specified for weaving
at org.eclipse.persistence.exceptions.StaticWeaveException.missingSource(StaticWeaveException.java:89)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.preProcess(StaticWeaveProcessor.java:191)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveProcessor.performWeaving(StaticWeaveProcessor.java:173)
at org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask.start(StaticWeaveAntTask.java:215)
... 16 more
BUILD FAILED (total time: 0 seconds) |
:arf: :arf: :arf: :ouin: :ouin: :ouin:
J'aimerai bien un peu d'aide SVP :help: