Announcement Announcement Module
Collapse
No announcement yet.
Problem reading .class files with ASM Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem reading .class files with ASM

    I am having a problem where my class files aren't being read by the ASM compiler correctly. This problem only occurs when I run my application from within Tomcat and not from a jUnit test case.

    My setup has the asm jars (2.2.1) in tomcat's common/lib folder, along with cglib jar. I had to move these out from the webapps/lib folder due to some other dependency issues.

    My AOP advice classes actually live within my web application's lib folder (no asm/cglib jars there since they are in common/lib).

    My problem is I keep receiving this stack track on startup.

    Code:
     INFO: Bean 'userActionAspect' is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
     INFO: IOException whilst attempting to read .class file for class com.vodori.bluebird.component.audit.aspects.AdviceUserActionAspect - unable to determine parameter names for meth
    od auditNewRegistration
    java.io.IOException: Class not found
            at org.objectweb.asm.ClassReader.a(Unknown Source)
            at org.objectweb.asm.ClassReader.<init>(Unknown Source)
            at org.objectweb.asm.ClassReader.<init>(Unknown Source)
            at org.springframework.core.LocalVariableTableParameterNameDiscover.visitMethod(LocalVariableTableParameterNameDiscover.java:109)
            at org.springframework.core.LocalVariableTableParameterNameDiscover.getParameterNames(LocalVariableTableParameterNameDiscover.java:53)
            at org.springframework.core.PrioritizedParameterNameDiscoverer.getParameterNames(PrioritizedParameterNameDiscoverer.java:54)
            at org.springframework.aop.aspectj.AbstractAspectJAdvice.bindArgumentsByName(AbstractAspectJAdvice.java:368)
            at org.springframework.aop.aspectj.AbstractAspectJAdvice.calculateArgumentBindings(AbstractAspectJAdvice.java:330)
            at org.springframework.aop.aspectj.AbstractAspectJAdvice.afterPropertiesSet(AbstractAspectJAdvice.java:292)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:861)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:830)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:410)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBeanDefinition(BeanDefinitionValueResolver.java:151)
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:102)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:765)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:576)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:406)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
            at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:152)
            at org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator.findCandidateAdvisors(DefaultAdvisorAutoProxyCreator.java:114)
    .............
    I assume my problem is because my asm and cglib jars are at the common/lib level but my actual auditing java classes live within my web application. If this is the problem, is there any way to fix this or another solution anyone can think of?

    Thanks!

    --Grant

  • #2
    no way unless you bring those libraries down to your application.

    the parent classloaders can not see into children (normally), so that is why you can depend on asm but if there is a runtime depepndecy looking the other way around you are getting errors.

    Comment


    • #3
      Hi,
      This is unrelated to the solution of this thread however as I have just spent a good four or five hours tracking down a problem with a simillar 'look' and google has little on the topic apart from this thread I thought I would post this info here for others.

      Essentially I was getting this error:
      2006-09-03 22:35:35,905 DEBUG [org.springframework.core.LocalVariableTableParamet erNameDiscover] - IOException whilst attempting to read .class file for class [my.package.SystemArchitecture] - unable to determine parameter names for method IdentC
      java.io.IOException: Class not found
      at org.objectweb.asm.ClassReader.a(Unknown Source)
      at org.objectweb.asm.ClassReader.<init>(Unknown Source)
      at org.objectweb.asm.ClassReader.<init>(Unknown Source)
      at org.springframework.core.LocalVariableTableParamet erNameDiscover.visitMethod(LocalVariableTableParam eterNameDiscover.java:96)
      <snip>

      I was defining an inplace point cut expression as such:
      @Before ("execution(* my.package.PersonIdentity.*(..)) && " + "args(cn)")

      The documentation states that an IllegalArgumentException will be thrown if arguments are incorrect it didn't in this case and I am not compiling -g:vars. After much research and careful checking of my loaders the fix was simply:

      @Before (value="execution(* my.package.PersonIdentity.*(..)) && " + "args(cn)", argNames="cn")
      public void IdentC(String cn)

      Alternatively -g:vars to javac. I hope this is of some help to someone in the future so you don't spend a few hours trying to figure out exactly whats gone weird with your loader.

      Comment

      Working...
      X