Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Exception while using static weaving(Exception while using static weaving)
Exception while using static weaving [message #503196] Fri, 11 December 2009 05:53 Go to next message
Ashish  is currently offline Ashish Friend
Messages: 13
Registered: September 2009
Junior Member
Hello,

I tried to use static weaving for my project.
My project structure is as below:
EclipseLink -- src -- com\ca\caf\db\eclipselink\entity
-- Meta-INF -- menifest.mf
-- jar -- eclipselink.jar and persistence.jar
-- temp

and my ant script look like:
<target name="define.task" description="New task definition for toplink static weaving">
<taskdef name="weave" classname=" org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask ">
<classpath>
<pathelement path="./jar/eclipselink.jar"/>
<pathelement path="./jar/javax.persistence.jar"/>
<fileset dir="./src/com/ca/caf/db/eclipselink/entity">
<include name="*.java"/>
</fileset>
</classpath>
</taskdef>
</target>

<target name="weaving" description="perform weaving" depends="define.task">
<weave source="./src" target="temp" persistenceinfo="."/>
</target>

when I run it, I am getting exception:
C:\ca\caf\trunk\modules\DBEclipseLink\weaving_build.xml:24: Exception [EclipseLink-40007] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.StaticWeaveException
Exception Description: An exception was thrown while weaving: ./src
Internal Exception: Exception [EclipseLink-30007] (Eclipse Persistence Services - 1.1.2.v20090612-r4475): org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
Exception Description: An exception was thrown while loading class: com.ca.caf.db.eclipselink.entity.AuditLogEntity to check whether it implements @Entity, @Embeddable, or @MappedSuperclass.
Internal Exception: java.lang.ClassNotFoundException: com.ca.caf.db.eclipselink.entity.AuditLogEntity

All the entity files are in class path but still ant task is not able to find the entity classes. I tried different permutation of putting files into class path but no success.

Please help me to resolve this issue.
Re: Exception while using static weaving [message #503355 is a reply to message #503196] Sat, 12 December 2009 06:59 Go to previous messageGo to next message
Ari Meyer is currently offline Ari MeyerFriend
Messages: 136
Registered: July 2009
Senior Member
Hi Ashish,

I think the problem may be your relative paths. I found it wouldn't
work for me without ${basedir}. Here's mine:

<target name="weaving" description="perform Eclipselink weaving">
<taskdef
name="weave"
classname=" org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask "/>
<weave
loglevel="FINEST"
source="${basedir}/target/classes"
target="${basedir}/target/classes"
persistenceinfo="${basedir}/src/main/resources">
<classpath refid="maven.test.classpath"/>
</weave>
</target>


I actually just invoke it via Maven -- here's my Maven config (including
an alternate, commented-out version):

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>JPA Enhancement</id>
<phase>process-classes</phase>
<configuration>
<tasks>
<taskdef
name="weave"

classname=" org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask "
classpathref="maven.test.classpath"/>
<weave
loglevel="FINEST"
source="${basedir}/target/classes"
target="${basedir}/target/classes"
persistenceinfo="${basedir}/src/main/resources">
<classpath refid="maven.test.classpath"/>
</weave>

<!--
<java classname="org.eclipse.persistence.tools.weaving.jpa.StaticWeave "
classpathref="maven.test.classpath"
fork="true">
<arg
line="-loglevel FINEST -persistenceinfo src/main/resources
target/classes target/classes"/>
</java>
-->
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>


and here's where I got it from:
http://www.tzavellas.com/techblog/2008/10/17/statically-weav ing-jpa-entities-for-eclipselink-using-maven/

Hope this helps!
Ari


Ashish wrote:
> Hello,
>
> I tried to use static weaving for my project.
> My project structure is as below:
> EclipseLink -- src -- com\ca\caf\db\eclipselink\entity
> -- Meta-INF -- menifest.mf
> -- jar -- eclipselink.jar and persistence.jar
> -- temp
>
> and my ant script look like:
> <target name="define.task" description="New task definition for toplink
> static weaving">
> <taskdef name="weave" classname="
> org.eclipse.persistence.tools.weaving.jpa.StaticWeaveAntTask ">
> <classpath>
> <pathelement path="./jar/eclipselink.jar"/>
> <pathelement path="./jar/javax.persistence.jar"/>
> <fileset dir="./src/com/ca/caf/db/eclipselink/entity">
> <include name="*.java"/>
> </fileset>
> </classpath>
> </taskdef>
> </target>
>
> <target name="weaving" description="perform weaving"
> depends="define.task">
> <weave source="./src" target="temp" persistenceinfo="."/>
> </target>
>
> when I run it, I am getting exception:
> C:\ca\caf\trunk\modules\DBEclipseLink\weaving_build.xml:24: Exception
> [EclipseLink-40007] (Eclipse Persistence Services -
> 1.1.2.v20090612-r4475):
> org.eclipse.persistence.exceptions.StaticWeaveException
> Exception Description: An exception was thrown while weaving: ./src
> Internal Exception: Exception [EclipseLink-30007] (Eclipse Persistence
> Services - 1.1.2.v20090612-r4475):
> org.eclipse.persistence.exceptions.PersistenceUnitLoadingExc eption
> Exception Description: An exception was thrown while loading class:
> com.ca.caf.db.eclipselink.entity.AuditLogEntity to check whether it
> implements @Entity, @Embeddable, or @MappedSuperclass.
> Internal Exception: java.lang.ClassNotFoundException:
> com.ca.caf.db.eclipselink.entity.AuditLogEntity
>
> All the entity files are in class path but still ant task is not able to
> find the entity classes. I tried different permutation of putting files
> into class path but no success.
>
> Please help me to resolve this issue.
Re: Exception while using static weaving [message #503493 is a reply to message #503196] Mon, 14 December 2009 13:53 Go to previous message
Ashish  is currently offline Ashish Friend
Messages: 13
Registered: September 2009
Junior Member
Thank you very much for reply...

Actually I did mistake. I confused with "Specifies the location of the Java source files to weave: either a directory or a JAR file." and is source attribute set value of .java files. Actually i should set value for path of .class files.

I did that and problem solved.
Previous Topic:Selecting data using EmbeddedID
Next Topic:Cache Coordination Architecture (RMI & multicast)
Goto Forum:
  


Current Time: Sat Dec 20 16:31:47 GMT 2014

Powered by FUDForum. Page generated in 0.04330 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software