Hi All, 

I'm very new to aspectJ and I started with load time weaving in aspectJ. I
created a very simple aspectJ point cut, and loaded my jar when server get
started up. It was working perfectly fine in the apache tomcat examples war. 

However when trying to deploy an application from the github repo over here:
https://github.com/benas/todolist-mvc

with my load time weaving its giving me wired error messages. The aspectJ
point cut looks like this:

        protected pointcut traceMethods() :(execution(* *(..)) &&
!cflow(within(LoggingAspect)) && !cflow(within(DbInternalServer)) &&
!cflow(within(fi.iki.elonen.*)) && !cflow(within(RunTimeElements))&&
!cflow(within(Container))&& !cflow(within(com.mongodb.*)));

and when I start my tomcat server, it does throw the error message like
this:

Caused by: java.lang.LinkageError: loader constraint violation: loader
(instance of org/apache/catalina/loader/WebappClassLoader) previously
initiated loading for a different type with name
"org/aspectj/runtime/internal/CFlowCounter"
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at
org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2496)
        at
org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:860)
        at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1302)
        at
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)
        at
org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:153)
        at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5170)
        at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        ... 10 more

Looks like both times the CFlowCounter is being loaded and that's what this
error message says so. 

Now my question is how do I solve these sort of issues? How to force the
aspectjweaver to load the classes only once? 

Thanks for all your reply's. 



--
View this message in context: 
http://aspectj.2085585.n4.nabble.com/How-to-load-the-aspectj-files-only-once-tp4651956.html
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
aspectj-users@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to