5 Replies Latest reply on May 17, 2004 4:31 PM by rkadayam

    Invoking session beans from Interceptors

    rkadayam

      I got this to work before but not sure what I'm doing wrong now.

      I'm basically trying to invoke a session bean from my interceptor implementations. I get a ClassCastException when I try to cast the looked up object. I guess this is because of the class returned via InitialContext is not loaded by the same classloader as the one being casted. However I was under the impression the application server gets around this conflict for you, especially when you are all inside the app server.

      I'm testing my interceptors in weblogic 8.1 and they are loaded using a custom class-loader (parent is context classloader). I'm going to experiment the same with a modified jboss 3.2.3 (with AOP almost working I think).

      Any help or directions would be of great help.

      Thanks
      Rajiv

        • 1. Re: Invoking session beans from Interceptors
          bill.burke

          This is probably not a JBOss AOP problem, but rather how you've packaged your classes in WLS.

          • 2. Re: Invoking session beans from Interceptors
            rkadayam

            Seems like some bug in weblogic PortableRemoteObject implementation or their JNDI.

            I could get it to work in JBoss 3.2.3

            -rajiv

            • 3. Re: Invoking session beans from Interceptors
              bensench

              Rajiv,

              You could get it to work on JBoss 3.2.3? Where do you place your interceptor? For example, if I want to intercept the method invocation of com.xyz.zmedrec.PhysicianSessionEJB with the interceptor interceptor.TestMethodInterceptor as indicated in the folloiwng jboss-aop.xml:

              <?xml version="1.0" encoding="UTF-8"?>








              I AOPized a session EJB in a sample WebLogic 8.1 application. And I put the interceptor directory under the same parent directory as that of com sub-directory of the sample application. When I tested the AOPized application, the TestMethodInterceptor wasn't invoked. From the console log, I can see the invoked sessionEJB was indeed AOPized.

              Can anyone please tell me where I should place my interceptor?

              Here is the operatiing environment:
              OS: Window XP.
              JDK: 1.4.2_03
              AOP: 1.0_Beta

              Thanks in advance.

              Ben C.


              • 4. Re: Invoking session beans from Interceptors
                bill.burke

                Ben,

                You'll have to tell me your exact setup and steps you made to do things.

                1. Did you precompile your clases with aopc?
                2. Did you set the System Property jboss.aop.path?

                Thanks,

                Bill

                • 5. Re: Invoking session beans from Interceptors
                  rkadayam

                  You'll have to follow the JBoss AOP for standalone instructions when working with Weblogic.

                  Set the system property jboss.aop.path=<xml file> in your startweblogicserver script and in addition you may have to add the jboss-aop.jar and javassist.jar to the classpath. The interceptor jars will have to be added to the classpath as well. Otherwise if you want something more sophisticated you could create some URL classloading utility that would dynamically load the interceptor jars.