{"record":{"id":"93f44a406d4167b4","repo":"spring-projects/spring-framework","slug":"the-version-of-aspectjtools-jar-aspectjweaver-ja","errorCode":null,"errorMessage":"The version of aspectjtools.jar / aspectjweaver.jar on the classpath is incompatible with this version of Spring: {0}","messagePattern":"The version of aspectjtools\\.jar / aspectjweaver\\.jar on the classpath is incompatible with this version of Spring: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java","lineNumber":76,"sourceCode":" * @since 2.0\n */\nclass RuntimeTestWalker {\n\n\tprivate static final Field residualTestField;\n\n\tprivate static final Field varTypeField;\n\n\tprivate static final Field myClassField;\n\n\n\tstatic {\n\t\ttry {\n\t\t\tresidualTestField = ShadowMatchImpl.class.getDeclaredField(\"residualTest\");\n\t\t\tvarTypeField = ReflectionVar.class.getDeclaredField(\"varType\");\n\t\t\tmyClassField = ReflectionBasedReferenceTypeDelegate.class.getDeclaredField(\"myClass\");\n\t\t}\n\t\tcatch (NoSuchFieldException ex) {\n\t\t\tthrow new IllegalStateException(\"The version of aspectjtools.jar / aspectjweaver.jar \" +\n\t\t\t\t\t\"on the classpath is incompatible with this version of Spring: \" + ex);\n\t\t}\n\t}\n\n\n\tprivate final @Nullable Test runtimeTest;\n\n\n\tpublic RuntimeTestWalker(ShadowMatch shadowMatch) {\n\t\ttry {\n\t\t\tReflectionUtils.makeAccessible(residualTestField);\n\t\t\tthis.runtimeTest = (Test) residualTestField.get(shadowMatch);\n\t\t}\n\t\tcatch (IllegalAccessException ex) {\n\t\t\tthrow new IllegalStateException(ex);\n\t\t}\n\t}\n","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/spring-projects/spring-framework/blob/69bf83ad716d0cfc4b0520a19b4d8b24c79d1538/spring-aop/src/main/java/org/springframework/aop/aspectj/RuntimeTestWalker.java#L58-L94","documentation":"Thrown by the static initializer of RuntimeTestWalker when it cannot find expected internal fields (residualTest in ShadowMatchImpl, varType in ReflectionVar, or myClass in ReflectionBasedReferenceTypeDelegate) in the AspectJ weaver classes on the classpath. RuntimeTestWalker reflects into AspectJ internals to query runtime test types; if the field layout changed between versions, this indicates an incompatible aspectjtools.jar / aspectjweaver.jar version.","triggerScenarios":"A classpath with an aspectjweaver/aspectjtools version older or newer than the one Spring AOP was compiled and tested against. Since this is a static initializer, the error surfaces at class-loading time of RuntimeTestWalker (triggered during the first pointcut match), not at construction.","commonSituations":"Upgrading Spring without upgrading AspectJ (or vice versa), pulling in a transitive incompatible AspectJ version from another dependency, or running on a newer Java version that requires a newer AspectJ.","solutions":["Align the AspectJ version with your Spring version — check the Spring framework reference docs for the expected aspectjweaver version","Use Spring's spring-framework-bom (or spring-boot-dependencies BOM) to manage compatible transitive versions","Run mvn dependency:tree or gradle dependencies to find conflicting aspectjweaver versions and exclude transitive mismatches"],"exampleFix":"<!-- before: mismatched versions -->\n<dependency>\n  <groupId>org.aspectj</groupId>\n  <artifactId>aspectjweaver</artifactId>\n  <version>1.8.10</version>\n</dependency>\n\n<!-- after: aligned with Spring's expected version -->\n<dependency>\n  <groupId>org.aspectj</groupId>\n  <artifactId>aspectjweaver</artifactId>\n  <version>1.9.22</version>\n</dependency>","handlingStrategy":"validation","validationCode":"// At build/setup time, verify the aspectjweaver version matches the Spring version's expectation\n// Check the loaded version at runtime:\nString ajVersion = org.aspectj.lang.Aspects.class.getPackage().getImplementationVersion();\n// Compare against Spring's documented compatible version (e.g., 1.9.x for Spring 6.x)\nif (ajVersion == null || !ajVersion.startsWith(\"1.9.\")) {\n    logger.warn(\"aspectjweaver version \" + ajVersion + \" may be incompatible with this Spring version\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use spring-framework-bom or spring-boot-dependencies to auto-manage compatible AspectJ versions","After any Spring upgrade, verify aspectjweaver/aspectjtools versions are still compatible","Run mvn dependency:tree | grep aspectj to catch transitive version conflicts"],"tags":["spring-aop","aspectj","version-incompatibility","classpath"],"backgroundTag":null,"analyzedSha":"69bf83ad716d0cfc4b0520a19b4d8b24c79d1538","analyzedAt":"2026-08-09T15:32:58.770Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}