Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Ability to exclude class loader from creating weavers for

I've tried multiple different types of configurations, but cannot seem to get the class loader ignored (even if it it specified in the log output).  Is there anyway to use wildcards or regex'es when specifying the classloader exceptions?  If not, would there be a way to add it in?

Tx,

Eric



On Wed, Jul 31, 2013 at 3:14 PM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
On re-reading the text I do see:

I've tried the following in my CATALINA_OPTS for tomcat:
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/tmp/aspectjweaver.jar -Daj.weaving.loadersToSkip=org.apache.felix.framework.ModuleImpl$ModuleClassLoader,org.springframework.osgi.util.BundleDelegatingClassLoader"

But still get errors:
ModuleClassLoader@6e662159] info AspectJ Weaver Version DEVELOPMENT built on Tuesday Jul 30, 2013 at 14:56:29 GMT
[ModuleClassLoader@6e662159] info register classloader org.apache.felix.framework.ModuleImpl$ModuleClassLoader@6e662159
[ModuleClassLoader@6e662159] info using configuration file:/Library/Tomcat/apache-tomcat-6.0.35-jira/webapps/jira/WEB-INF/lib/ia-aspects-0.0.1-SNAPSHOT.jar!/META-INF/aop.xml
[ModuleClassLoader@6e662159] info no longer creating weavers for these classloaders: [org.apache.felix.framework.ModuleImpl, org.springframework.osgi.util.BundleDelegatingClassLoader]

that the info message about what it is excluding clearly has lost the ModuleClassLoader piece, presumably evaluating $ModuleClassLoader on the way in to be blank.  When you tried with escaping the dollar did you get the info message in aspectj to name the right classloader?

There is no way to specify inclusion only for classloaders. This new skipping loaders feature would be what you need to avoid a classloader you want to ignore.  I guess I need to add a testcase for classloaders that are nested classes.

Andy


On 31 July 2013 10:39, Eric Benzacar <eric@xxxxxxxxxxx> wrote:
On Wed, Jul 31, 2013 at 11:50 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Did you try with a '.' rather than a dollar in your specification of the classloader name? Or maybe escape the dollar with a backslash in case it is being evaluated before reaching AspectJ. I don't have any tests in Aj for excluding classloaders defined as an inner class. I imagined that loader was actually the one loading the app so excluding it wouldn't really help your situation.


I've tried both, but it doesn't seem to make any difference what-so-ever.  Is there an option to specify which classloader to enable, as opposed which ones to disable?  Or baring that, any way I can stop the exception from polluting in my logs?

Thanks,

Eric


On 30 July 2013 18:53, Eric Benzacar <eric@xxxxxxxxxxx> wrote:
I tried the latest dev build to see if this resolves my Felix classloader errors, but I am either doing something wrong, or there is a problem with the build.  Appologies for all the verboseness, but thought the full stack trace might have some use.  I believe I have probably specified the incorrect ClassLoader, but not sure what else it might be based on the original error stack trace.


Given the existing stack trace showing an error:
[ModuleClassLoader@4e730222] info AspectJ Weaver Version 1.7.3 built on Thursday Jun 13, 2013 at 19:41:31 GMT
[ModuleClassLoader@4e730222] info register classloader org.apache.felix.framework.ModuleImpl$ModuleClassLoader@4e730222
[ModuleClassLoader@4e730222] info using configuration file:/Library/Tomcat/apache-tomcat-6.0.35-jira/webapps/jira/WEB-INF/lib/ia-aspects-0.0.1-SNAPSHOT.jar!/META-INF/aop.xml
[ModuleClassLoader@4e730222] info register aspect com.ia.UseProfiler
Jul 29, 2013 1:48:25 PM org.aspectj.weaver.tools.Jdk14Trace error
SEVERE: register definition failed
java.lang.RuntimeException: Cannot register non aspect: com$ia$UseProfiler , com.ia.UseProfiler
at org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:221)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerAspects(ClassLoaderWeavingAdaptor.java:478)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerDefinitions(ClassLoaderWeavingAdaptor.java:303)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:170)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:313)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:318)
at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:292)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:103)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1829)
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:716)
at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:634)
at org.apache.felix.framework.Felix.createBundleActivator(Felix.java:3653)
at org.apache.felix.framework.Felix.activateBundle(Felix.java:1812)
at org.apache.felix.framework.Felix.startBundle(Felix.java:1734)
at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:1143)
at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:264)
at java.lang.Thread.run(Thread.java:680)



I've tried the following in my CATALINA_OPTS for tomcat:
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/tmp/aspectjweaver.jar -Daj.weaving.loadersToSkip=org.apache.felix.framework.ModuleImpl$ModuleClassLoader,org.springframework.osgi.util.BundleDelegatingClassLoader"



But still get errors:
ModuleClassLoader@6e662159] info AspectJ Weaver Version DEVELOPMENT built on Tuesday Jul 30, 2013 at 14:56:29 GMT
[ModuleClassLoader@6e662159] info register classloader org.apache.felix.framework.ModuleImpl$ModuleClassLoader@6e662159
[ModuleClassLoader@6e662159] info using configuration file:/Library/Tomcat/apache-tomcat-6.0.35-jira/webapps/jira/WEB-INF/lib/ia-aspects-0.0.1-SNAPSHOT.jar!/META-INF/aop.xml
[ModuleClassLoader@6e662159] info no longer creating weavers for these classloaders: [org.apache.felix.framework.ModuleImpl, org.springframework.osgi.util.BundleDelegatingClassLoader]
[ModuleClassLoader@6e662159] info register aspect com.ia.UseProfiler
Jul 30, 2013 9:38:49 PM org.aspectj.weaver.tools.Jdk14Trace error
SEVERE: register definition failed
java.lang.RuntimeException: Cannot register non aspect: com$ia$UseProfiler , com.ia.UseProfiler
at org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:221)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerAspects(ClassLoaderWeavingAdaptor.java:485)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerDefinitions(ClassLoaderWeavingAdaptor.java:304)
at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:171)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:341)
at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:346)
at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:320)
at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:113)
at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
at sun.instrument.TransformerManager.transform(TransformerManager.java:169)
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:365)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1829)
at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:716)
at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)
at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.apache.felix.framework.ModuleImpl.getClassByDelegation(ModuleImpl.java:634)
at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1594)
at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:887)
at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:385)
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1138)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:524)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1177)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:222)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:424)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:395)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:281)
at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:247)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:214)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:169)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:716)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)



Any thoughts/advice?

Thanks,

Eric



On Tue, Jul 30, 2013 at 11:04 AM, Andy Clement <andrew.clement@xxxxxxxxx> wrote:
Dev build is on the download page: http://eclipse.org/aspectj/downloads.php

The instructions are on the bugzilla - append a comment to the bug if you have any issues.

1.7.4 is probably a few months away.

cheers,
Andy


On 30 July 2013 06:43, Sergei Babovich <sbabovich@xxxxxxxxxxxxxx> wrote:
Hi Andy,

Thanks a lot! Dev build will be great! What is the current date for 1.7.4?

Thanks,
Sergei

>Hey Sergei,
>
>I just resurrected the changes and committed them into master, they will be in 1.7.4. Updated usage instructions in the bug report, although bugzilla appears to be on a go slow so I might not be able to >get my update text through until the morning. If you are planning on using it imminently I can create a dev build for you, let me know.
>
>cheers,
>Andy
This e-mail message and all attachments transmitted with it may contain privileged and/or confidential information intended solely for the use of the addressee(s). If the reader of this message is not the intended recipient, you are hereby notified that any reading, dissemination, distribution, copying, forwarding or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately and delete this message, all attachments and all copies and backups thereof.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top