6 Replies Latest reply on Feb 21, 2007 5:30 AM by Martin Capote

    Spring AOP Problem

    Martin Capote Newbie

      Hi, I am testingthis the Spring AOP integration with JBoss. This logging sample doesn't work in JBoss 4.0.5:

      http://www.javaworld.com/javaworld/jw-01-2007/jw-0105-aop.html

      The error is

      09:13:28,703 ERROR [MainDeployer] Could not create deployment: file:/L:/developdir/java/jboss-4.0.5.GA/server/default/deploy/busqueda-spring.xml
      org.jboss.deployment.DeploymentException: Error creating bean with name 'busquedaPadronDao' defined in URL [file:/L:/developdir/java/jboss-4.0.5.GA/server/default/tmp/deploy/tmp33094busqueda-spring.xml]: Initialization of bean failed; nested exception is
      
      org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine implemented interfaces of missing type $Proxy71
      
       [Xlint:cantFindType]; - nested throwable: (org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'busquedaPadronDao' defined in URL [file:/L:/developdir/java/jboss-4.0.5.GA/server/default/tmp/deploy/tmp33094busqueda-spring.xml]: Initialization of bean failed; nested exception is org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine implemented interfaces of missing type $Proxy71
       [Xlint:cantFindType])
       at org.jboss.spring.deployment.SpringDeployer.create(SpringDeployer.java:138)
       at org.jboss.deployment.MainDeployer.create(MainDeployer.java:969)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:818)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
       at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
       at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
       at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
       at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
       at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
       at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
       at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
       at $Proxy8.deploy(Unknown Source)
       at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
       at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
       at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
      Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'busquedaPadronDao' defined in URL [file:/L:/developdir/java/jboss-4.0.5.GA/server/default/tmp/deploy/tmp33094busqueda-spring.xml]: Initialization of bean failed; nested exception is org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine implemented interfaces of missing type $Proxy71
       [Xlint:cantFindType]
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:443)
       at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:245)
       at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:140)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:242)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
       at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:273)
       at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:346)
       at org.jboss.spring.factory.NamedXmlApplicationContext.<init>(NamedXmlApplicationContext.java:61)
       at org.jboss.spring.factory.NamedXmlApplicationContext.<init>(NamedXmlApplicationContext.java:50)
       at org.jboss.spring.factory.ApplicationContextLoaderImpl.createBeanFactory(ApplicationContextLoaderImpl.java:38)
       at org.jboss.spring.factory.AbstractBeanFactoryLoader.create(AbstractBeanFactoryLoader.java:94)
       at org.jboss.spring.deployment.SpringDeployer.create(SpringDeployer.java:132)
       ... 21 more
      Caused by: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException: warning can't determine implemented interfaces of missing type $Proxy71
       [Xlint:cantFindType]
       at org.aspectj.weaver.reflect.ReflectionWorld$ExceptionBasedMessageHandler.handleMessage(ReflectionWorld.java:163)
       at org.aspectj.weaver.Lint$Kind.signal(Lint.java:276)
       at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.raiseCantFindType(MissingResolvedTypeWithKnownSignature.java:198)
       at org.aspectj.weaver.MissingResolvedTypeWithKnownSignature.getDeclaredInterfaces(MissingResolvedTypeWithKnownSignature.java:76)
       at org.aspectj.weaver.ResolvedType.getDirectSupertypes(ResolvedType.java:64)
       at org.aspectj.weaver.JoinPointSignatureIterator.findSignaturesFromSupertypes(JoinPointSignatureIterator.java:164)
       at org.aspectj.weaver.JoinPointSignatureIterator.hasNext(JoinPointSignatureIterator.java:69)
       at org.aspectj.weaver.patterns.SignaturePattern.matches(SignaturePattern.java:287)
       at org.aspectj.weaver.patterns.KindedPointcut.matchInternal(KindedPointcut.java:106)
       at org.aspectj.weaver.patterns.Pointcut.match(Pointcut.java:146)
       at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.getShadowMatch(PointcutExpressionImpl.java:235)
       at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.matchesExecution(PointcutExpressionImpl.java:101)
       at org.aspectj.weaver.internal.tools.PointcutExpressionImpl.matchesMethodExecution(PointcutExpressionImpl.java:92)
       at org.springframework.aop.aspectj.AspectJExpressionPointcut.getShadowMatch(AspectJExpressionPointcut.java:305)
       at org.springframework.aop.aspectj.AspectJExpressionPointcut.matches(AspectJExpressionPointcut.java:200)
       at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:182)
       at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:225)
       at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:255)
       at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:73)
       at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:57)
       at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:255)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:312)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1114)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectFromFactoryBean(AbstractBeanFactory.java:1192)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1141)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
       at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:156)
       at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:248)
       at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:128)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:950)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:740)
       at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:417)
       ... 32 more
      
      


      Spring AOP is compatible with JBoss, or I must use the JBoss AOP? Thanks.


        • 1. Re: Spring AOP Problem
          Ales Justin Master

           

          "martin.capote" wrote:
          Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'b
          usquedaPadronDao' defined in URL [file:/L:/developdir/java/jboss-4.0.5.GA/server/default/tmp/deploy/
          tmp33094busqueda-spring.xml]: Initialization of bean failed; nested exception is org.aspectj.weaver.
          reflect.ReflectionWorld$ReflectionWorldException: warning can't determine implemented interfaces of
          missing type $Proxy71
          [Xlint:cantFindType]


          This is a bean definition error.
          Try deploying this Spring beans xml file standalone - simple ClassPathApplicationContext.

          • 2. Re: Spring AOP Problem
            Martin Capote Newbie

            Hi, I found a similar problem, with a ugly workaround:
            https://bugs.eclipse.org/bugs/show_bug.cgi?id=116305#c1

            In my case, this work fine:

             <bean id="LoggingAspect" class = "aop.LoggingAspect" />
             <aop:config>
             <aop:aspect id = "MyAspect" ref="LoggingAspect">
             <aop:pointcut id="myCutLogging"
             expression="execution(* server.persistence.MyDAO.find*(..))"/>
             <aop:before pointcut-ref="myCutLogging" method="log"/>
             </aop:aspect>
             </aop:config>
            

            But this doesn't work (throws the ReflectionWorldException):
             <bean id="LoggingAspect" class = "aop.LoggingAspect" />
             <aop:config>
             <aop:aspect id = "MyAspect" ref="LoggingAspect">
             <aop:pointcut id="myCutLogging"
             expression="execution(* server.persistence.MyDAO.*(..))"/>
             <aop:before pointcut-ref="myCutLogging" method="log"/>
             </aop:aspect>
             </aop:config>
            

            without the 'find' in the definition of the pointcut.

            Somebody knows where is the problem? Thanks

            I haven't try the standalone suggestion yet.



            • 3. Re: Spring AOP Problem
              Michael Wiles Newbie

              Quite a nasty problem...

              I did some digging with the debugger and found that that object which it's saying it can't find interfaces for is a dynamic proxied object. Quite irritating that it doesn't just ignore and carry on.

              Not quite sure why it works when running outside of the container though.

              Btw, the object which I had the same problem is the SessionFactory object which is proxied by spring/jboss. Not quite sure which.

              An efficient to block this object from being scanned by spring's AOP would be great, blocking each individual method is the only way I see it working. I think the spring AOP first resolves the method and then moves on so if the method resolution fails, then it goes onto the next method. Again, why such a problem would cause a complete failure, I don't know.

              It would also be interesting to see how spring's AOP/aspectJ behaves with a proxied object.

              • 4. Re: Spring AOP Problem
                Michael Wiles Newbie

                I fixed my problem of this nature. I deleted the hibernate libraries present as jboss libs and it worked!

                In my case I found that the object being proxied with the hibernate session factory.

                • 5. Re: Spring AOP Problem
                  Jose Blas Camacho Taboada Newbie

                  What libraries have you deleted?
                  I have the same problem and gettin desesperated.

                  regards, josé blas.

                  • 6. Re: Spring AOP Problem
                    Martin Capote Newbie

                    Hi jblas, please post your spring config file (the <aop:config> stuff)