I have a library with aspect which scan all statement executions and doing some logic with sql sentence.
@Pointcut("target(java.sql.Statement)") public void statement() {} @AfterReturning("!within(AnalyzerAspect) && statement() && args(sql)") public void after(JoinPoint jp, String sql) throws Throwable { // some logic } When I use it for jdbc operations it works fine. I also used it with spring-jdbc like that
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>${aspect.compiler.plugin.version}</version> <configuration> <weaveDependencies> <weaveDependency> <groupId>org.springframework</groupId> <artifactId>spring-jdbc</artifactId> </weaveDependency> </weaveDependencies> <aspectLibraries> <aspectLibrary> <groupId>edu.ifmo.diploma</groupId> <!-- My library --> <artifactId>db-analyzer</artifactId> </aspectLibrary> </aspectLibraries> <complianceLevel>11</complianceLevel> <showWeaveInfo>true</showWeaveInfo> <Xlint>ignore</Xlint> <encoding>UTF-8</encoding> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> But when I try to weave hibernate core dependency the same way
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>${aspect.compiler.plugin.version}</version> <configuration> <weaveDependencies> <weaveDependency> <groupId>org.hibernate.orm</groupId> <artifactId>hibernate-core</artifactId> </weaveDependency> </weaveDependencies> <aspectLibraries> <aspectLibrary> <groupId>edu.ifmo.diploma</groupId> <!-- My library --> <artifactId>db-analyzer</artifactId> </aspectLibrary> </aspectLibraries> <complianceLevel>11</complianceLevel> <showWeaveInfo>true</showWeaveInfo> <Xlint>ignore</Xlint> <encoding>UTF-8</encoding> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> I have an error on aspectj compile task.
In logs I found a lot of NPE's(264) like that
end public class org.hibernate.metamodel.mapping.ordering.ast.ParseTreeVisitor -- (NullPointerException) Cannot invoke "org.aspectj.weaver.ResolvedMember.getGenericParameterTypes()" because the return value of "org.aspectj.weaver.Shadow.getResolvedSignature()" is null Cannot invoke "org.aspectj.weaver.ResolvedMember.getGenericParameterTypes()" because the return value of "org.aspectj.weaver.Shadow.getResolvedSignature()" is null java.lang.NullPointerException: Cannot invoke "org.aspectj.weaver.ResolvedMember.getGenericParameterTypes()" because the return value of "org.aspectj.weaver.Shadow.getResolvedSignature()" is null How to resolve that? Maybe aspectj plugin has an option to skip some weaves if they causes an error or maybe I have to put some properties to resolve that generic parameter types?
I don't find any links with same problem in weaving, but there is one with closest exception: link