4 Replies Latest reply on Feb 27, 2006 2:52 PM by Kabir Khan

    JCA and RAR prototype tests

    Adrian Brock Master

      I've cutover the JCA and RAR prototype projects to use the ProxyFactory.
      To get these projects

      cd jboss-head
      cvs co xxx
      


      These are showing a couple of failures.
      1) Due it trying to use the default constructor of the wrapped object which
      throws NPE.
      Is there a mode we can use to just extend Object and add interfaces?
      Even though we wrap someother object. Currently it fails saying the interface
      and target don't match.

      2) It is getting confused about interface hierarchy.
      I have an object that implements
      javax.jms.Connection, javax.jms.QueueConnection, etc.
      But javax.jms.QueueConnection extends javax.jms.Connection
      This leads to an error about duplicate mixin methods.

      See the org.jboss.proxy stuff in the server module.
      I added some code to weed out these duplicate methods returned by reflection.

      Finally, if you change the base RARTest to have security enabled
      (I commented it out) you can see it throwing Access errors from the proxy code
      (even though I have given the proxy code AllPermissions).
      This is leakage of other context's permissions into these operations.

        • 1. Re: JCA and RAR prototype tests
          Adrian Brock Master

           

          "adrian@jboss.org" wrote:

          Is there a mode we can use to just extend Object and add interfaces?


          i.e. I don't want to subclass the wrapped object's class.
          I want to do what DP does. Subclass Object and add the wrapped object's interfaces.

          • 2. Re: JCA and RAR prototype tests
            Adrian Brock Master

            I changed the code to read

             if (proxiedClass.isAssignableFrom(target.getClass()) == false)
             {
             throw new RuntimeException("Specified class type " + proxiedClass.getName() + " and target " + target.getClass().getName() + " are not compatible");
             }
            


            This seems to do what I want, but you might want to check it.

            • 3. Re: JCA and RAR prototype tests
              Adrian Brock Master

              I tried solving the second problem by ignoring the error about the duplicate,

               if (mixinMethods.contains(hash)) continue;
               if (addedMethods.contains(hash)) continue; // throw new Exception("More than one mixin has same method");
              


              but just seems to cause a cpu loop in the compiler here:
              "main" prio=1 tid=0x0805ed20 nid=0x153b runnable [0xbfffa000..0xbfffc1e8]
               at java.io.UnixFileSystem.getBooleanAttributes0(Native Method)
               at java.io.UnixFileSystem.getBooleanAttributes(UnixFileSystem.java:228)
               at java.io.File.exists(File.java:702)
               at sun.misc.URLClassPath$FileLoader.getResource(URLClassPath.java:890)
               at sun.misc.URLClassPath$FileLoader.findResource(URLClassPath.java:868)
               at sun.misc.URLClassPath.findResource(URLClassPath.java:139)
               at java.net.URLClassLoader$2.run(URLClassLoader.java:362)
               at java.security.AccessController.doPrivileged(Native Method)
               at java.net.URLClassLoader.findResource(URLClassLoader.java:359)
               at java.lang.ClassLoader.getResource(ClassLoader.java:977)
               at javassist.LoaderClassPath.find(LoaderClassPath.java:86)
               at javassist.ClassPoolTail.find(ClassPoolTail.java:317)
               at javassist.ClassPool.find(ClassPool.java:452)
               at javassist.ClassPool.createCtClass(ClassPool.java:436)
               at javassist.ClassPool.get0(ClassPool.java:402)
               - locked <0x65e7d828> (a javassist.ClassPool)
               at javassist.ClassPool.get0(ClassPool.java:411)
               - locked <0x65e8db48> (a org.jboss.aop.AOPClassPool)
               at javassist.ClassPool.get(ClassPool.java:371)
               at javassist.compiler.MemberResolver.lookupClass0(MemberResolver.java:408)
               at javassist.compiler.MemberResolver.lookupClass(MemberResolver.java:372)
               at javassist.compiler.MemberResolver.lookupClassByName(MemberResolver.java:299)
               at javassist.compiler.TypeChecker.atNewExpr(TypeChecker.java:95)
               at javassist.compiler.ast.NewExpr.accept(NewExpr.java:72)
               at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:235)
               at javassist.compiler.CodeGen.compileExpr(CodeGen.java:222)
               at javassist.compiler.CodeGen.atThrowStmnt(CodeGen.java:618)
               at javassist.compiler.CodeGen.atStmnt(CodeGen.java:358)
               at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
               at javassist.compiler.CodeGen.atIfStmnt(CodeGen.java:384)
               at javassist.compiler.CodeGen.atStmnt(CodeGen.java:348)
               at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
               at javassist.compiler.CodeGen.atStmnt(CodeGen.java:344)
               at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
               at javassist.compiler.CodeGen.atMethodBody(CodeGen.java:285)
               at javassist.compiler.Javac.compileBody(Javac.java:212)
               at javassist.CtBehavior.setBody(CtBehavior.java:221)
               at javassist.CtBehavior.setBody(CtBehavior.java:196)
               at javassist.CtNewMethod.make(CtNewMethod.java:135)
               at javassist.CtNewMethod.make(CtNewMethod.java:104)
               at org.jboss.aop.proxy.container.ContainerProxyFactory.addMixins(ContainerProxyFactory.java:391)
               at org.jboss.aop.proxy.container.ContainerProxyFactory.createProxyCtClass(ContainerProxyFactory.java:142)
               at org.jboss.aop.proxy.container.ContainerProxyFactory.generateProxy(ContainerProxyFactory.java:441)
               at org.jboss.aop.proxy.container.ContainerProxyFactory.getProxyClass(ContainerProxyFactory.java:102)
               - locked <0x65e8db90> (a java.lang.Object)
               at org.jboss.aop.microcontainer.prototype2.proxyfactory.GeneratedAOPProxyFactory.generateProxy(GeneratedAOPProxyFactory.java:182)
               at org.jboss.aop.microcontainer.prototype2.proxyfactory.GeneratedAOPProxyFactory.getProxy(GeneratedAOPProxyFactory.java:117)
               - locked <0x65e81560> (a java.lang.Object)
               at org.jboss.aop.microcontainer.prototype2.proxyfactory.GeneratedAOPProxyFactory.createAdvisedProxy(GeneratedAOPProxyFactory.java:90)
               at org.jboss.rars.generic.mcf.GenericManagedConnectionFactory.createProxy(GenericManagedConnectionFactory.java:575)
              


              • 4. Re: JCA and RAR prototype tests
                Kabir Khan Master

                I have made the ContainerProxyFactory silently ignore attempts to add a method from an interface introduction if that method already exists.

                Also, I have added the ability to specify in the AOPProxyFactory if we do not want to extend the class of the target instance, i.e. use Object and made GenericManagedConnectionFactory use that.

                All the jca/rars tests pass now, but the JMSUnitTestCase tests using the GenericConnectionFactory ("ConnectionFactory") are really slow. It seems to be generating a new proxy on every invocation. I will investigate this further.