8 Replies Latest reply on Feb 19, 2003 2:31 PM by marc.fleury

    How can aop objects can be referenced within a war archive?

    benjmestrallet

      Hi,

      I tried to reference aop objects within a ear that contains a war archive.
      I copied the testsuite aop classes (POJO, POJORef,...) that I recompiled and put in my WEB-INF/classes.
      When the archive is deployed, I do in my ServletContextListener the work done by the AspectDeployer :

      // DocumentBuilder parser = null;
      // Document document = null;
      // try {
      // DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
      // factory.setIgnoringComments( true );
      // factory.setCoalescing( true );
      // factory.setNamespaceAware( false );
      // factory.setValidating( false );
      // parser = factory.newDocumentBuilder();
      // } catch ( ParserConfigurationException e ) {
      // e.printStackTrace();
      // } catch ( FactoryConfigurationError factoryConfigurationError ) {
      // factoryConfigurationError.printStackTrace();
      // }
      // URL docURL = null;
      // InputStream stream = null;
      // try {
      // String path = servletContext.getInitParameter( "aop_conf_file" );
      // document = parser.parse( "file:" + servletContext.getRealPath( path ) );
      // AspectXmlLoader.deployXML( document );
      // try {
      // SimpleInterceptor.lastIntercepted = null;
      // SimpleInterceptor.lastTransAttributeAccessed = null;
      // POJO pojo = new POJO();
      // pojo.someMethod();
      // } catch ( Throwable ex ) {
      // ex.printStackTrace();
      // throw new RuntimeException( ex.getMessage() );
      // }
      // } catch ( IOException e ) {
      // e.printStackTrace();
      // } catch ( SAXException e ) {
      // e.printStackTrace();
      // } catch ( Exception e ) {
      // e.printStackTrace();
      // }

      the aop_conf_file is pointing to the jboss-aop.xml file which is almost the same one than the one present in the testsuite

      Then I got a javassist.NotFoundException from AspectManager and the calls are not intercepted. How can the proxy can be loaded and referenced?

      I tried several other stuffs to make that work without an mbean deployed in a sar archive :
      -put an .aop package in the ear
      -tried to reference an .aop package that were correctly deployed into JBoss.

      Can someone explain me if what I am trying to do is possible?

      Thanks,
      Benjamin.

        • 1. Precisions
          benjmestrallet

          I looked deeper in the source code this afternoon, and I still don’t know what’s wrong.

          So, I will tell what I understood and please tell me where I missed the point. Reminds that this is in the case of aop objects that are in a war that is in an ear archive.

          In my ServletContextListener, I parse the jboss-aop.xml file (almost the same one that in the testsuite package):






          <interceptor-pointcut name="SimplePointcut"
          class="exo.portal.aop.bean.POJO.*"
          fieldFilter="ALL"
          methodFilter="ALL"
          constructorFilter="ALL">

          <interceptor-ref name="SimpleInterceptor"/>

          </interceptor-pointcut>



          Then I ask the AspectXmlLoader to deploy the Document.
          -First this class deploys the advisable class, which consist in adding an element to the pointcut Map presents in the AspectManager. It is referenced through the classname (or the regular expression associated with this classname).
          -Then, it deploys the interceptors adding an object to the interceptorsFactory Map presents in the AspectManager instance.
          -After that, it deploys the pointcuts which consist in, as for the deployment of the advisable elements, adding an element to the pointcut Map presents in the AspectManager. This element is an InterceptorPointcut object that extends the Advisable class. It is parameterised with the adequate interceptors and filters.

          That’s for the deployment.

          When I instantiates the POJO object, It goes through the UnifiedClassLoader2 that extends UnifiedClassLoader where we have :

          protected Class findClass(String name) throws ClassNotFoundException
          {
          if (repository.getTranslator() != null)
          {
          try
          {
          byte[] b = repository.getTranslator().translate(name, this);
          if (b != null)
          {
          return defineClass(name, b, 0, b.length);
          }
          }
          catch (Exception ex)
          {
          throw new ClassNotFoundException(name);
          }
          }
          return super.findClass(name);
          }

          Which calls the translate method of the AspectManager :

          public synchronized byte[] translate(String classname, UnifiedClassLoader ucl) throws Exception
          {
          try
          {
          ClassAdvisor advisor = findClassAdvisor(classname);
          if (advisor == null) return null;
          registerUCL(ucl); // FIXME decide what to do in UCLs about this later. Maybe remove it
          CtClass clazz = classpool.get(classname);
          if (clazz.isInterface() ||
          clazz.isFrozen() ||
          clazz.isArray() ||
          clazz.getName().startsWith("org.jboss.aop"))
          {
          return null;
          }
          instrumentor.makeAdvisable(clazz, advisor.getFieldFilter(), advisor.getMethodFilter(), advisor.getConstructorFilter());
          return classpool.write(classname);
          }
          catch (Exception ex)
          {
          log.error(ex);
          throw ex;
          }
          }


          This method returns the modified byte code (with javassist) after (in our case) creating the Advisor class and filling its Advisable collection (with the method findClassAdvisor( classname)).

          The registerUCL(ucl) method adds a ClassPath with a reference to the ucl to the classpool object defined by javassist. So that when the method
          public InputStream openClassfile(String classname) throws NotFoundException
          {
          String cname = classname.replace('.', '/') + ".class";
          return cl.getResourceAsStream(cname);
          }

          of the CLClassPath class is called within the classpool.get(classname) it should not through the NotFoundException as the exo/portal/aop/bean/POJO.class is present in the classpath.

          Please tell me where I am wrong, as the framework is not trivial :)

          Thanks,
          Benjamin

          • 2. Re: Precisions
            bill.burke

            Can you post a stack trace of the NotFoundException? My guess is that the CLClassPath is looking for exo/portal/aop/bean/POJO.class

            where the actual path is ./WEB-INF/classes/exo/portal/aop/bean/POJO.class

            In the meantime you would have to create a SAR with the classes you want AOP'ized in a .aop file.

            • 3. Re: Precisions
              benjmestrallet

              >Can you post a stack trace of the NotFoundException?

              There is no real stack trace, I have only :

              ERROR [org.jboss.aop.AspectManager] javassist.NotFoundException: exo.portal.aop.bean.POJO

              before the instanciation of the object POJO.

              >My guess is that the CLClassPath is looking for >exo/portal/aop/bean/POJO.class

              I am almost sure that this is the case

              >where the actual path is ./WEB->INF/classes/exo/portal/aop/bean/POJO.class

              I will try to change the aop.xml file to point to
              /WEB-INF/classes/exo/portal/aop/bean/POJO.class

              >In the meantime you would have to create a SAR with the >classes you want AOP'ized in a .aop file.

              As I say in my first post I have already tried that but those files cannot be accessed throug a jsp

              Thanks

              Benjamin

              • 4. Re: Precisions
                benjmestrallet

                The stack trace is :


                2003-02-09 10:19:33,201 ERROR [STDERR] javassist.NotFoundException: exo.portal.aop.bean.POJO
                2003-02-09 10:19:33,217 ERROR [STDERR] at javassist.ClassPoolTail.openClassfile(ClassPoolTail.java:269)
                2003-02-09 10:19:33,217 ERROR [STDERR] at javassist.ClassPoolTail.checkClassName(ClassPoolTail.java:174)
                2003-02-09 10:19:33,217 ERROR [STDERR] at javassist.ClassPool.checkClassName(ClassPool.java:645)
                2003-02-09 10:19:33,217 ERROR [STDERR] at javassist.ClassPool.get0(ClassPool.java:533)
                2003-02-09 10:19:33,217 ERROR [STDERR] at javassist.ClassPool.get(ClassPool.java:522)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.aop.AspectManager.translate(AspectManager.java:103)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.loading.UnifiedClassLoader.findClass(UnifiedClassLoader.java:212)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.loading.UnifiedClassLoader.loadClassLocally(UnifiedClassLoader.java:231)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.loading.UnifiedLoaderRepository2.loadClassFromClassLoader(UnifiedLoaderRepository2.java:234)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.loading.UnifiedLoaderRepository2.loadClass(UnifiedLoaderRepository2.java:144)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.loading.UnifiedClassLoader2.loadClass(UnifiedClassLoader2.java:147)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.net.FactoryURLClassLoader.loadClass(URLClassLoader.java:550)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.ClassLoader.loadClass(ClassLoader.java:262)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:215)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.mortbay.http.ContextLoader.loadClass(ContextLoader.java:199)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:322)
                2003-02-09 10:19:33,217 ERROR [STDERR] at exo.portal.launcher.Portal.initAOP(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at exo.portal.launcher.Portal.init(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at exo.portal.launcher.PortalContextListener.contextInitialized(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.mortbay.jetty.servlet.WebApplicationContext.start(WebApplicationContext.java:480)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.mortbay.j2ee.J2EEWebApplicationContext.start(J2EEWebApplicationContext.java:85)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.jetty.Jetty.deploy(Jetty.java:368)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.jetty.JettyService.performDeploy(JettyService.java:249)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:315)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.DeploymentInfo.start(DeploymentInfo.java:259)
                2003-02-09 10:19:33,217 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor39.invoke(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:993)
                2003-02-09 10:19:33,217 ERROR [STDERR] at $Proxy12.start(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:388)
                2003-02-09 10:19:33,217 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:776)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:766)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:574)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:538)
                2003-02-09 10:19:33,217 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor34.invoke(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,217 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                2003-02-09 10:19:33,217 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:405)
                2003-02-09 10:19:33,217 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:529)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:195)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:268)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:231)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,233 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:993)
                2003-02-09 10:19:33,233 ERROR [STDERR] at $Proxy1.start(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:388)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,233 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                2003-02-09 10:19:33,233 ERROR [STDERR] at $Proxy6.start(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:230)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.DeploymentInfo.start(DeploymentInfo.java:259)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,233 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:993)
                2003-02-09 10:19:33,233 ERROR [STDERR] at $Proxy1.start(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:388)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,233 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:776)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:574)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:538)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:522)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                2003-02-09 10:19:33,233 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                2003-02-09 10:19:33,233 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:324)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.ReflectedDispatcher.dispatch(ReflectedDispatcher.java:143)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:111)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:161)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:160)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:559)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
                2003-02-09 10:19:33,233 ERROR [STDERR] at $Proxy7.deploy(Unknown Source)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:328)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:236)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.Main.boot(Main.java:160)
                2003-02-09 10:19:33,233 ERROR [STDERR] at org.jboss.Main$1.run(Main.java:398)
                2003-02-09 10:19:33,233 ERROR [STDERR] at java.lang.Thread.run(Thread.java:536)

                I modified the CLClassLoader with :

                public InputStream openClassfile(String classname) throws NotFoundException
                {
                System.out.println( "ucl2bis : "+cl );
                String cname = classname.replace('.', '/') + ".class";
                InputStream in = cl.getResourceAsStream(cname);
                if(in == null){
                cname = "./WEB-INF/classes/" + cname;
                in = cl.getResourceAsStream(cname);
                }
                return in;
                }

                but it still doesn't find the class!

                I retried with a standalone aop file, the classes are found but there is no interception.

                Benjamin.

                • 5. Re: Precisions
                  bill.burke

                  > I modified the CLClassLoader with :
                  >
                  > public InputStream openClassfile(String classname)
                  > e) throws NotFoundException
                  > {
                  > System.out.println( "ucl2bis : "+cl );
                  > String cname = classname.replace('.', '/') +
                  > /') + ".class";
                  > InputStream in =
                  > in = cl.getResourceAsStream(cname);
                  > if(in == null){
                  > cname = "./WEB-INF/classes/" + cname;
                  > in = cl.getResourceAsStream(cname);
                  > }
                  > return in;
                  > }
                  >
                  > but it still doesn't find the class!
                  >

                  I'm not sure of what the jar format looks like for a war.

                  > I retried with a standalone aop file, the classes are
                  > found but there is no interception.
                  >

                  Can you explain "standalone aop file"? Do you mean a yourjar.aop file where exploded it looks like

                  com/yourclasses/SomeClass.class
                  META-INF/jboss-aop.xml

                  Also, you could try placing the classes in WEB-INF/lib/yourclasses.jar although I'm not sure if a separate UCL is created for each JAR in the lib directory.

                  As you can see, there is still some work to do :)

                  Bill

                  • 6. Re: Precisions
                    benjmestrallet

                    I finally made it work but not with a modified CLClassPath even if I tried several stuffs.

                    The problem (or advantage, I don't really know ) with a war file is that the UCL created for it is only associated with the files.war and not with its content and therfore the calsses are not visible outside the scope of the web archive. So I tried to access the content of this war through ucl.getAllURLs() with a ZipFile in the CLClassPath but I got a ZipException as if the zip file were corrupted.

                    If I bundle my classes like :

                    SAR
                    | _WAR
                    |_EAR_____|
                    | |_EJB-JAR
                    |_AOP

                    I can access the AOP files within the war archive and the interception work.

                    >Can you explain "standalone aop file"? Do you mean a >yourjar.aop file where exploded it looks like
                    >com/yourclasses/SomeClass.class
                    >META-INF/jboss-aop.xml

                    I copied the aoptest.aop file present in the testsuite to the deploy/ directory, it deployed well.
                    Then I tried to access whitin the WAR archive the POJO classes in the aop archive. The class where reached but there were no interception and no errors were thrown!

                    >Also, you could try placing the classes in WEB->INF/lib/yourclasses.jar although I'm not sure if a >separate UCL is created for each JAR in the lib >directory.

                    I tried that too but that the same problem there is only one UCL created for the WAR archive pointing to this .war package.

                    >As you can see, there is still some work to do :)

                    Now that I made it work, I am going to use the aop framework ( I have a portal application and I want to AOPize the portlets objects) and I can give you feedbacks on how it works. By the way are there usefull interceptors alrealy created?

                    Benjamin

                    • 7. Re: Precisions
                      bill.burke

                      >
                      > Now that I made it work, I am going to use the aop
                      > framework ( I have a portal application and I want to
                      > AOPize the portlets objects) and I can give you
                      > feedbacks on how it works. By the way are there
                      > usefull interceptors alrealy created?
                      >

                      Be warned that the framework will be a moving target over the next month or so. As we start writing services on top of the AOP framework I'm betting the underlying interfaces will change as a result. BTW, 1st will be transaction demarcation(a.k.a trans-attribute), security (same as EJB), and transactional locking since these are the easiest to port. Bela Ban is working on transaction caching and distributed caching (now this will be really cool!) Alex Loubyansky, Dain, Jeremy are working on new persistence stuff.

                      Anyways, if you have/need any requirements for the AOP framework email me directly. bill@jboss.org.

                      Bill

                      • 8. Re: Precisions
                        marc.fleury

                        > The problem (or advantage, I don't really know ) with
                        > a war file is that the UCL created for it is only
                        > associated with the files.war and not with its
                        > content and therfore the calsses are not visible
                        > outside the scope of the web archive. So I tried to

                        the classes should be globaly visible outside of the war. The idea is that any referencing class can see in that package. If that is not the behavior that is a bug and please submit bug and patch if you can.

                        >
                        > If I bundle my classes like :
                        >
                        > SAR
                        > | _WAR
                        > |_EAR_____|
                        > | |_EJB-JAR
                        > |_AOP
                        >
                        > I can access the AOP files within the war archive and
                        > the interception work.

                        all packages should have same visibility (flat name). I don't know what the current status of the CL is (haven't in a while) and it seems some of the original intent of the CL (FLAT VISIBILITY) is being lost. I will double check this soon with Scott who knows the CL by heart these days.

                        > I tried that too but that the same problem there is
                        > only one UCL created for the WAR archive pointing to
                        > this .war package.

                        Ok yes you want a CL created for the classes subcontent of the WAR archive. Man you are complicating your packaging... take all your classes out of the WAR into a standalone jar :)

                        > Now that I made it work, I am going to use the aop
                        > framework ( I have a portal application and I want to
                        > AOPize the portlets objects) and I can give you
                        > feedbacks on how it works. By the way are there
                        > usefull interceptors alrealy created?

                        We are working on cache/persistence/locking/transaction etc help in adapting is welcome.

                        marcf