Community
Participate
Working Groups
Hi, I got the following exception when using AspectJ. ---- AspectJ Properties --- AspectJ Compiler 1.6.2 built on Saturday Oct 4, 2008 at 05:47:07 GMT ---- Dump Properties --- Dump file: ajcore.20090113.103433.281.txt Dump reason: java.lang.ClassCastException Dump on exception: true Dump at exit condition: abort ---- Exception Information --- java.lang.ClassCastException: org.aspectj.weaver.MissingResolvedTypeWithKnownSignature cannot be cast to org.aspectj.weaver.ReferenceType at org.aspectj.weaver.AbstractReferenceTypeDelegate.getFormalTypeParametersFromOuterClass(AbstractReferenceTypeDelegate.java:104) at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignatureUnpacked(BcelObjectType.java:736) at org.aspectj.weaver.bcel.BcelObjectType.getSuperclass(BcelObjectType.java:207) at org.aspectj.weaver.ReferenceType.getSuperclass(ReferenceType.java:689) at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1385) at org.aspectj.weaver.bcel.BcelWeaver.weave(BcelWeaver.java:1210) at org.aspectj.weaver.tools.WeavingAdaptor.getWovenBytes(WeavingAdaptor.java:394) at org.aspectj.weaver.tools.WeavingAdaptor.weaveClass(WeavingAdaptor.java:281) at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:95) at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:52) 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.defineClass(ClassLoader.java:621) at java.lang.ClassLoader.defineClass(ClassLoader.java:466) at org.gridgain.grid.kernal.managers.deployment.GridDeploymentPeerClassLoader.findClass(GridDeploymentPeerClassLoader.java:180) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at org.gridgain.grid.kernal.managers.deployment.GridDeploymentPeerClassLoader.loadClass(GridDeploymentPeerClassLoader.java:127) at org.gridgain.grid.kernal.managers.deployment.GridDeploymentManager.findGlobalTask(GridDeploymentManager.java:469) at org.gridgain.grid.kernal.processors.job.GridJobWorker.initialize(GridJobWorker.java:332) at org.gridgain.grid.kernal.processors.job.GridJobProcessor$JobExecutionListener.onMessage(GridJobProcessor.java:953) at org.gridgain.grid.kernal.managers.communication.GridCommunicationManager$4.body(GridCommunicationManager.java:566) at org.gridgain.grid.util.runnable.GridRunnable$1.run(GridRunnable.java:142) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at org.gridgain.grid.util.runnable.GridRunnable.run(GridRunnable.java:194) at org.gridgain.grid.util.runnable.GridRunnablePool$1.run(GridRunnablePool.java:79) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) I don't have a small snippet to reproduce or anything, this is in a quite complex app, but maybe you guys already know enough with this stacktrace? regards, Wim
I cannot tell what has happened from the stack trace unfortunately, but I have just committed some diagnostics at that point - these will be in todays dev build. It may have been addressed already since you are reportedly on 1.6.2 and the latest AJ is 1.6.3, but I don't remember fixing anything in this particular area of the code. The dev build will be updated here in a couple of hours: http://www.eclipse.org/aspectj/downloads.php Please let me know what the diagnostics say - they will at least indicate the types involved when the failure occurred. I have my suspicions what it will be, but need those diagnostics to be sure.
managed to collect any diagnostics yet?
Not yet, I am sorry. I hope to test next week or something.
Created attachment 124544 [details] ajcore dump with test version
I see from the core, the exception is now: java.lang.RuntimeException: Can't find type com.traficon.tmsng.server.api.service.impl.filter.FilterServiceImpl at org.aspectj.weaver.World.handleRequiredMissingTypeDuringResolution(World.java) Should that type be found? Is it on your classpath when running the system?
I don't believe it is. I get this exception during using GridGain (see http://www.gridgain.org/). They have a system called peer class loading, where they load classes over the network. Come to think of it, I have this exception as soon as I start a node (JVM) that has this class, but on a JVM that does not have this class on the 'normal' classpath. Is there extra debugging I can enable to see where this class is loaded? Because the JVM that gives the exception normally does not need that class at all. regards, Wim
The more complete stack for the exception: java.lang.RuntimeException: Can't find type com.traficon.tmsng.server.api.service.impl.filter.FilterServiceImpl at org.aspectj.weaver.World.handleRequiredMissingTypeDuringResolution(World.java:320) at org.aspectj.weaver.World.resolve(World.java:279) at org.aspectj.weaver.World.resolve(World.java:191) at org.aspectj.weaver.UnresolvedType.resolve(UnresolvedType.java:615) at org.aspectj.weaver.bcel.BcelObjectType.getOuterClass(BcelObjectType.java:825) at org.aspectj.weaver.AbstractReferenceTypeDelegate.getFormalTypeParametersFromOuterClass(AbstractReferenceTypeDelegate.java:103) at org.aspectj.weaver.bcel.BcelObjectType.ensureGenericSignatureUnpacked(BcelObjectType.java:743) at org.aspectj.weaver.bcel.BcelObjectType.getSuperclass(BcelObjectType.java:208) at org.aspectj.weaver.ReferenceType.getSuperclass(ReferenceType.java:721) at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1385) I'd suspect it is an inner type of com.traficon.tmsng.server.api.service.impl.filter.FilterServiceImpl that is giving problems - although how the inner can be found but not the outer, who knows. > Because the JVM that gives the exception normally does not need that class > at all. As I would normally say here, AspectJ LTW may need more information than you might need to just run an application normally - weaving can effectively need the same set of types around as were used at compilation time in order to determine everything it needs to know. A regular run of this application would probably never unpack the generic signature attribute, and yet AspectJ might in order to work out if a pointcut really does match. We may be able to craft a within clause to exclude the problematic parts of the application configuration. But there is no trickery in AspectJ, we just use the regular delegating class loader model to get hold of types - so to load this type we would ask the classloader the weaver is associated with. If that cannot answer with the type then it could lead to this problem. I don't know anything about the peer delegation model being used here, but this is what we'd do: Class c = Class.forName(forReferenceType.getName(), false, usingClassLoader); where usingClassLoader is the one related to the weaver. forReferenceType would be com.traficon.tmsng.server.api.service.impl.filter.FilterServiceImpl We have talked about making the LTW world have a pluggable loader model to support unusual configurations but nothing has been done to support it yet. However... I've just rechecked the debug information I included in the latest builds. For some reason my latest diagnostics aren't actually triggering (which would tell us about the types involved) because your latest dump gives the failing reason as a RuntimeException - and that is occurring earlier than your previous CCE (from the first comment on this bug). hmmm. Maybe more has changed since 1.6.2 than I thought. I can put in more diagnostics that will tell you which type is eventually leading to this being woven - but the end result may be that you just need to ensure this type is around and accessible, that would be the simplest option.
Hi, I tested again with the 1.6.4 development version and I got no more exceptions. The other one I talked about was because there was a 1.6.2 in the classpath of one of the JVMs. So I will be moving to 1.6.4 as soon as it gets released (any clue on the timing?) regards, Wim
Hi Wim, AspectJ releases are currently at every 3 months. The next is due at the end of March, although it might come in early depending on whether I want to get it out ahead of Eclipse Con. I will also hopefully have an automated way to get it into maven by then too.
Given that this is working in 1.6.4 dev builds I propose we close it now - we can easily reopen if something like this crops up in the future.