Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349636

Summary: AspectJ reports "abort trouble" while instrumenting a class on startup
Product: [Tools] AspectJ Reporter: Eric Jain <eric.jain>
Component: LTWeavingAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aclement
Version: 1.6.11   
Target Milestone: 1.6.12   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Eric Jain CLA 2011-06-16 20:13:48 EDT
Build Identifier: 20110218-0911

java.lang.NullPointerException
	at org.aspectj.weaver.bcel.Utility.appendConversion(Utility.java:272)
	at org.aspectj.weaver.bcel.BcelVar.appendConvertableArrayLoad(BcelVar.java:81)
	at org.aspectj.weaver.bcel.BcelVar.createConvertableArrayLoad(BcelVar.java:101)
	at org.aspectj.weaver.bcel.BcelShadow.makeClosureClassAndReturnConstructor(BcelShadow.java:3066)
	at org.aspectj.weaver.bcel.BcelShadow.weaveAroundClosure(BcelShadow.java:2830)
	at org.aspectj.weaver.bcel.BcelAdvice.implementOn(BcelAdvice.java:342)
	at org.aspectj.weaver.Shadow.implementMungers(Shadow.java:630)
	at org.aspectj.weaver.Shadow.implement(Shadow.java:544)
	at org.aspectj.weaver.bcel.BcelClassWeaver.implement(BcelClassWeaver.java:3147)
	at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:490)
	at org.aspectj.weaver.bcel.BcelClassWeaver.weave(BcelClassWeaver.java:100)
	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1687)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveWithoutDump(BcelWeaver.java:1631)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveAndNotify(BcelWeaver.java:1394)
	at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1180)
	at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:467)
	at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:318)
	at org.eclipse.equinox.weaving.aspectj.loadtime.OSGiWeavingAdaptor.weaveClass(Unknown Source)
	at org.eclipse.equinox.weaving.aspectj.AspectJWeavingService.preProcess(Unknown Source)
	at org.eclipse.equinox.weaving.adaptors.WeavingAdaptor.weaveClass(Unknown Source)
	at org.eclipse.equinox.weaving.hooks.WeavingHook.processClass(Unknown Source)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.defineClass(ClasspathManager.java:575)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findClassImpl(ClasspathManager.java:550)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClassImpl(ClasspathManager.java:481)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass_LockClassLoader(ClasspathManager.java:469)
	at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:449)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:393)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:469)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
	at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:338)
	at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:232)
	at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1197)
	at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
	at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:157)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
	at org.springframework.util.ClassUtils.forName(ClassUtils.java:257)
	at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:408)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1271)
	at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1242)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:576)
	at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1319)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:315)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:391)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.invokeBeanFactoryPostProcessors(AbstractDelegatedExecutionApplicationContext.java:364)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:256)
	at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:87)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:222)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:225)
	at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:178)
	at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:159)
	at org.springframework.osgi.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:223)
	at java.lang.Thread.run(Thread.java:662)



Reproducible: Sometimes
Comment 1 Andrew Clement CLA 2011-06-17 18:20:13 EDT
Looks to be a type that has somehow been resolved without having its 'world' set.

Given the context of spring and osgi in the mix on the stack, it could be the reset logic for primitives is being called at an unhelpful time (i.e. the reset logic is called to clear the worlds from the primitive types, to prevent them anchoring that world in memory, then something else runs that tries to use them and expects their world to be set).

As a first step I've put in a bit of debug that will fire if this happens again which will tell us the type that was having the problem - if it is a primitive, that would suggest it is a problem due to reset.
Comment 2 Andrew Clement CLA 2011-10-03 18:47:45 EDT
AspectJ no longer nulls the world for a primitive type representation - it doesn't need to since it no longer shares primitives amongst worlds, they are resolved independently in each world.  This will prevent a NPE like this.  Although I haven't been able to recreate this to confirm the fix, I'm reasonably sure it is addressed.  Lets close for now and re-open if it comes up post 1.6.12.