2 Replies Latest reply on Oct 22, 2005 8:46 AM by Neil Avery

    Classloader Integration?

    Neil Avery Newbie

      After upgrading to more recent versions of jboss we have started to develop problems relating to classes being woven where the class definition is held in an application classloader.

      Is it possible to get classloading in jboss to call onto the thread context classloader? i.e.
      Class<?> type = Thread.currentThread().getContextClassLoader().loadClass(typeName);

      as this would allow for classloader heirarchy integration. Alternatively can anyone suggest a way of integrating the javassist classpool/classloading/jboss-aop with application classloaders ?
      Thanks for any help,
      -Neil.

      Below is a stacktrace:
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
      Caused by: java.lang.RuntimeException: java.lang.RuntimeException: javassist.NotFoundException: org.neo.swarm.dumchat.components.User
      at org.jboss.aop.pointcut.Util.matchesClassExpr(Util.java:95)
      at org.jboss.aop.pointcut.MethodMatcher.matchesClass(MethodMatcher.java:167)
      at org.jboss.aop.pointcut.MethodMatcher.matches(MethodMatcher.java:72)
      at org.jboss.aop.pointcut.MethodMatcher.visit(MethodMatcher.java:66)
      at org.jboss.aop.pointcut.ast.ASTMethod.jjtAccept(ASTMethod.java:23)
      at org.jboss.aop.pointcut.ExecutionMethodMatcher.visit(ExecutionMethodMatcher.java:43)
      at org.jboss.aop.pointcut.ast.ASTExecution.jjtAccept(ASTExecution.java:17)
      at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:103)
      at org.jboss.aop.pointcut.ast.ASTSub.jjtAccept(ASTSub.java:17)
      at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:83)
      at org.jboss.aop.pointcut.ast.ASTBoolean.jjtAccept(ASTBoolean.java:17)
      at org.jboss.aop.pointcut.MatcherHelper.visit(MatcherHelper.java:73)
      at org.jboss.aop.pointcut.MatcherHelper.matches(MatcherHelper.java:68)
      at org.jboss.aop.pointcut.PointcutExpression.matchesExecution(PointcutExpression.java:104)
      at org.jboss.aop.Advisor.resolveMethodPointcut(Advisor.java:588)
      at org.jboss.aop.ClassAdvisor.createInterceptorChains(ClassAdvisor.java:581)
      at org.jboss.aop.ClassAdvisor.access$300(ClassAdvisor.java:70)
      at org.jboss.aop.ClassAdvisor$1.run(ClassAdvisor.java:287)
      at java.security.AccessController.doPrivileged(Native Method)
      at org.jboss.aop.ClassAdvisor.attachClass(ClassAdvisor.java:259)
      at org.jboss.aop.AspectManager.initialiseClassAdvisor(AspectManager.java:484)
      at org.jboss.aop.AspectManager.getAdvisor(AspectManager.java:472)
      at org.neo.swarm.dumchat.components.DumUser.(DumUser.java)
      ... 61 more
      Caused by: java.lang.RuntimeException: javassist.NotFoundException: org.neo.swarm.dumchat.components.User
      at org.jboss.aop.annotation.PortableAnnotationElement.getInvisibleAnnotation(PortableAnnotationElement.java:325)
      at org.jboss.aop.annotation.PortableAnnotationElement.getAnyAnnotation(PortableAnnotationElement.java:369)
      at org.jboss.aop.pointcut.Util.subtypeOf(Util.java:139)
      at org.jboss.aop.pointcut.Util.subtypeOf(Util.java:158)
      at org.jboss.aop.pointcut.Util.matchesClassExpr(Util.java:82)
      ... 83 more
      Caused by: javassist.NotFoundException: org.neo.swarm.dumchat.components.User
      at javassist.ClassPool.get(ClassPool.java:374)
      at org.jboss.aop.annotation.PortableAnnotationElement.getClassFile(PortableAnnotationElement.java:238)
      at org.jboss.aop.annotation.PortableAnnotationElement.getInvisibleAnnotation(PortableAnnotationElement.java:316)
      ... 87 more

        • 1. Re: Classloader Integration?
          Neil Avery Newbie

          Ive looked at this some more at it looks like a javassist bug to me. I integrated our system classloaders and traced through JA classloading into the classpool. Ive set our system classloader on the classpool using ClassClasspath.getDefault().appendClassPath(new classloaderClassPath(this)) which inserts our system classloader as a parent within the classpool. Somehow our app jarclassloader gets placed into the classpath which is also exactly what we want. I can trace through the classloading and see it grabbing classes from our jar CL, however on the class it fails to load, I inspect the classpool parent to find out systemclassloader is not there, and on the classpool.classpathtail our jar classloader is not longer in the list. In which case it makes sense to fail, but doesnt make sense why the classpool has dropped references to our classloaders.
          -neil.

          • 2. Re: Classloader Integration?
            Neil Avery Newbie

            Ive managed to fix this problem. When integrating our classloaders into Javassist you cannot aspectize any part of the classloader or getResource() lookups cause it hang to in some kind of recursive classloading deadlock.