Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] [aspectj plugin] weaving jars to other projects + 3rd party libaries not found in those projects

Hi Simone,

thx for the fast reply. The plugin part from the project where the aspect is located is the following:

           <plugin>
               <groupId>org.codehaus.mojo</groupId>
               <artifactId>aspectj-maven-plugin</artifactId>
               <executions>
                   <execution>
                       <goals>
                           <goal>compile</goal>
                       </goals>
                   </execution>
               </executions>
               <configuration>
                   <source>1.6</source>
                   <target>1.6</target>
                   <verbose>true</verbose>
                   <outxml>false</outxml>
                   <showWeaveInfo>true</showWeaveInfo>
                   <aspectDirectory>src/main/aspectj</aspectDirectory>
                   <testAspectDirectory>src/test/java</testAspectDirectory>
               </configuration>
           </plugin>

And the next plugin part is in another project where I inject the compiled aspects into:


           <plugin>
           <groupId>org.codehaus.mojo</groupId>
           <artifactId>aspectj-maven-plugin</artifactId>
           <executions>
             <execution>
             <phase>compile</phase>
               <goals>
                 <goal>compile</goal>
               </goals>
             </execution>
           </executions>
           <configuration>
             <source>1.6</source>
             <target>1.6</target>
             <verbose>true</verbose>
             <outxml>false</outxml>
             <showWeaveInfo>true</showWeaveInfo>
               <aspectLibraries>
                   <aspectLibrary>
                       <groupId>wsmx</groupId>
                       <artifactId>wsmx-securitymanager</artifactId>
                   </aspectLibrary>
               </aspectLibraries>
           </configuration>
           </plugin>


The error trace:
...
12:35:56,888 Reviver::ServiceDiscoveryFramework WARN AbstractExecutionSemantic: Failure during execution of state PerformServiceDiscovery. org.aspectj.lang.NoAspectBoundException: Exception while initializing at_sti2_wsmx_securitymanager_aspects_SecurityAspect: java.lang.NoClassDefFoundError: org/wsml/reason
er/api/inconsistency/InconsistencyException
at at.sti2.wsmx.securitymanager.aspects.SecurityAspect.aspectOf(SecurityAspect.aj:1) at ie.deri.wsmx.servicediscovery.ServiceDiscoveryFramework.discoverServiceCompositon(ServiceDiscoveryFramework.java:128) at ie.deri.wsmx.executionsemantic.AchieveGoalChor$PerformServiceDiscovery.handleState(AchieveGoalChor.java:530) at ie.deri.wsmx.executionsemantic.AbstractExecutionSemantic.runState(AbstractExecutionSemantic.java:98) at ie.deri.wsmx.scheduler.GenericReviver.run(GenericReviver.java:138)
       at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: org/wsml/reasoner/api/inconsistency/InconsistencyException at at.sti2.wsmx.securitymanager.aspects.SecurityAspect.<init>(SecurityAspect.aj:35) at at.sti2.wsmx.securitymanager.aspects.SecurityAspect.ajc$postClinit(SecurityAspect.aj:1) at at.sti2.wsmx.securitymanager.aspects.SecurityAspect.<clinit>(SecurityAspect.aj:19) at ie.deri.wsmx.executionsemantic.AchieveGoalChor$PerformServiceDiscovery.handleState(AchieveGoalChor.java)
       ... 3 more
Caused by: java.lang.ClassNotFoundException: org.wsml.reasoner.api.inconsistency.InconsistencyException
       at java.net.URLClassLoader$1.run(Unknown Source)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClass(Unknown Source)
       at java.lang.ClassLoader.loadClassInternal(Unknown Source)
       ... 7 more
12:35:56,888 Reviver::ServiceDiscoveryFramework WARN GenericReviver : Failure during execution of state, killing active execution semantic.

Best regards
Michael

Simone Gianni schrieb:
Hi Michael,
can you post the <plugin> part of the pom.xml where you are configuring the AspectJ mojo?

Also, could you post the stacktrace of the exception?

Simone

Michael Rogger wrote:
Hi,

I'm using the maven plugin for aspectj, but I think most of you use that too, so I write to this mailinglist ;) I have several projects (each project is a component for the whole system) and I apply already compiled aspects to them. Everything works fine until I access a 3rd party library from the aspect, for example I call a factory class or make an instance. If I do that, I get a java.lang.NoClassDefFoundError execption, so the classloader cannot find the library. I tried several things: First I tried to include the library directly into the compiled aspect lib. The second thing I tried was to include that library in the project where I injected the aspect code using the compiled aspect lib. Unfortunately none of both worked for me and the java.lang.NoClassDefFoundError remains. My question is, how do you access within an aspect a 3rd party library? I mean where can I put those libaries into, in order that the classloader can find it, in each proejct where I weave the compiled aspects?

Thank you very much for your help, I hope someone can help me!

Best regards
Rogger





--
Michael Rogger
STI Innsbruck (www.sti-innsbruck.at)
University of Innsbruck
ICT Technologiepark
Technikerstr. 21a
6020 Innsbruck, Austria

T +43 512 507 96876
F +43 512 507 9872
E michael.rogger@xxxxxxx

Skype michael.rogger.work



Back to the top