Announcement Announcement Module
Collapse
No announcement yet.
Spring Insight deployment issue using AspectJ static weaving Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring Insight deployment issue using AspectJ static weaving

    Hi,

    after two days of searching, trying and failing over and over. I am really stuck on this one.

    Here's the scenario:
    • We have a pretty standard Spring Webapp with a jar dependency on a business package (business.jar).
    • The classes with the business.jar have been woven with the Aspects shipped as a part of the SpringFramework (spring-aspect.jar) using maven-aspectj-plugin.
    • When decompiling (yes that desperate) our woven business.jar, I can see that the public static methods from
      the JPA-Entities are correctly enhanced e.g. for the pointcut defined in AnnotationDrivenStaticEntityMockingControl
    • Now when I deploy the application into a TC-Server with Insight it starts up without any errors.
      So I guess the SpringInsight LTW should have taken place correctly. But a soon as any of the public static methods
      are invoked a NoSuchFieldError gets raised:
    Code:
    java.lang.NoSuchFieldError: ajc$cflowCounter$1
    • The webapp itself does use AspectJ for @Transactional support. But as far as I can see a JdkRuntimeProxy gets hit first.
    • The same application deployed on a plain tc-server (no insight) runs the code without any problems.

    SpringFramework Version 3.0.7
    AspectJ 1.6.11
    SpringInsight TC-Server Template 1.5.1.SR3

    Any help would be appreciated.


    Regards,

    Nils

  • #2
    Can you attach the full stack trace?

    Comment


    • #3
      Hi,
      I attached the full stack from the deployed application with the packages renamed. I also cut out the SpringSecurity FilterChain message too long.
      Code:
      java.lang.NoSuchFieldError: ajc$cflowCounter$1
              at com.company.business.domain.offer.offer.OfferStatus.getIdByMatchcode(OfferStatus.java:1)
              at com.company.webapp.infrastructure.persistence.hibernate.LoadOfferListDaoImpl.buildFilterQuery(LoadOfferListDaoImpl.java:156)
              at com.company.webapp.infrastructure.persistence.hibernate.LoadOfferListDaoImpl.access$0(LoadOfferListDaoImpl.java:118)
              at com.company.webapp.infrastructure.persistence.hibernate.LoadOfferListDaoImpl$1.doInHibernate(LoadOfferListDaoImpl.java:87)
              at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406)
              at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:343)
              at com.company.webapp.infrastructure.persistence.hibernate.LoadOfferListDaoImpl.findByFilter(LoadOfferListDaoImpl.java:84)
              at com.company.webapp.application.offer.load.list.LoadOfferListServiceImpl.getResult(LoadOfferListServiceImpl.java:132)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
              at $Proxy453.getResult(Unknown Source)
              at com.company.webapp.server.interfaces.ListActionHandlerServiceImpl.loadLOListItems(ListActionHandlerServiceImpl.java:127)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:309)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:110)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:90)
              at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
              at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
              at $Proxy488.loadLOListItems(Unknown Source)
              at com.company.webapp.server.interfaces.ListActionHandler.findByFilter(ListActionHandler.java:54)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at de.seriea.swt.server.action.ActionHandlerRegistry$ActionHandlerInstance.invoke(ActionHandlerRegistry.java:64)
              at de.seriea.swt.server.action.ActionInvocationSpringServlet.invokeAction(ActionInvocationSpringServlet.java:119)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
              at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
              at de.seriea.swt.server.action.ActionInvocationSpringServlet.processCall(ActionInvocationSpringServlet.java:267)
              at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
              at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:369)
              at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109)
      ... cut  spring security filter chain (message too long)..
              at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:224)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:169)
              at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
              at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
              at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
              at com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.traceNextValve(HttpRequestOperationCollectionValve.java:112)
              at com.springsource.insight.collection.tcserver.request.HttpRequestOperationCollectionValve.invoke(HttpRequestOperationCollectionValve.java:94)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
              at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:987)
              at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:579)
              at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:309)
              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:662)
      The runtime error may reproduced all the time and does not occure if SpringInsight is switched off.
      Classed underneath: "com.company.business" are from the business.jar dependency.

      Comment


      • #4
        I think the described runtime errors occur because no proper "reweaving" could taken place on startup.
        The logs (catalina.out) warn about this:
        Code:
        [TomcatWeavingInsightClassLoader@11a921b1] error aspect 'org.springframework.mock.staticmock.AnnotationDrivenStaticEntityMockingControl' woven into 'com.company.business.domain.offer.offer.OfferStatus' must be defined to the weaver (placed on the aspectpath, or defined in an aop.xml file if using LTW).
        This error makes sense. Since the aop.xml from the SpringFramework spring-aspects.jar does not include AnnotationDrivenStaticEntityMockingControl in its Aspect list. Also its been applied through our static weaving (CTW) at compile time. However this should not resolve the final woven type in such a state that's its causing such weird runtime errors..
        Last edited by nils.liebelt; Sep 19th, 2012, 03:03 PM.

        Comment

        Working...
        X