1 2 Previous Next 17 Replies Latest reply on Nov 22, 2004 9:43 AM by ollihak

    problems with aop

    ollihak

      Hi,

      I'm a beginner on using jboss AOP from Germany.
      I'm using JBoss4.0.0 and Jdjk1.5.
      I put the jboss-aop-jdk50.deployer-folder into the jboss-deploy-directory.

      I deployed an ejb and now want to set up an aspect on that. When I follow the descriptions in the tutorial the SystemClassLoader does not find the InterceptorPointcut.class. I cannot find this class and it's subclasses as well as the InvocationType.class for example in the jboss-aop.jar-file.

      Can anybody help me??? What do I have to do, to make it work???

      Thanks
      OLLI

        • 1. 3855541
          ollihak

          OK, now I am confused. I've had a look in our cvs repository, and org.jboss.aop.InterceptorPointcut appears to have been deleted about nine months ago. So it looks like you have some incompatible versions of stuff somewhere? Make sure you are using the latest JBoss release and the final AOP release, if you have not done so already, and follow these steps:
          http://docs.jboss.org/aop/aspect-framework/reference/en/html_single/index.html#installing-jboss40

          jboss-common.jar is part of jboss already, and is not needed as part of the aop deployer. You can find it in jboss-4.0/lib

          • 2. Re: One WAY AOP invocation
            ollihak

            OK I sent an email to jeff and tom... I can't believe we don't have an async invoker... once we have it it trivial to do the one way thingy... god I love it.

            • 3. Re: problems with aop
              kabirkhan

              Hi,

              Can you please provide some more details? E.g, structure of your packages, jboss-aop.xml file, stacktrace etc.

              Thanks

              • 4. Re: problems with aop
                ollihak

                Okay, I'll try:

                Here is the aspect code:

                package aspect;

                import org.jboss.aop.advice.Interceptor;
                import org.jboss.aop.joinpoint.Invocation;
                import org.jboss.aop.joinpoint.InvocationResponse;
                public class myAspect implements Interceptor {

                public String getName() {
                return "myAspect";
                }


                public Object invoke(Invocation invocation) throws Throwable {

                System.out.println("Before!");
                InvocationResponse r = (InvocationResponse) invocation.invokeNext();
                System.out.println("After!");
                return r;
                }

                }

                The jboss-aop.xml-file is place in the META-INF-directory and looks like this:

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






                This code could be compiled and I put it into a jar-file called firstaspect.jar

                The HelloOliver-class is the remote-interface of my Bean, HelloOliverBean (which contains a method work(), that says "Helloworld!"). It's jared up with the HelloOliverHome-interface in HelloOliver.jar, that was successfully deployed on JBoss4.0


                • 5. Re: problems with aop
                  ollihak

                  Sorry the jboss-aop-file was not sent properly:
                  Here it is:
                  <?xml version='1.0' encoding='UTF-8' ?>






                  Thanks
                  OLLI

                  • 6. Re: problems with aop
                    ollihak

                    I don't know, why I cannot post the content of that file, maybe I leave out the tags:
                    jboss-aop.xml

                    aop
                    bind pointcut="execution(public void HelloOliver->work())"
                    interceptor class="aspect.myAspect"
                    bind
                    aop

                    Again, very sorry for that
                    OLLI

                    • 7. 3855541
                      kabirkhan

                      I have not heard of any class called InterceptorPointcut, but something could have changed. Please post the stack trace for the error. Here's a few things to try:

                      1) Does the injboss tutorial example supplied work for your setup?

                      If not:
                      Make sure you have put jboss-aop-jdk50.deployer in the correct deploy folder for the container config you are using, and that you have followed all the instructions in the tutorial.

                      If yes:
                      Can you show the structure of the .jar/.aop/.ear or whatever it is you are deploying?

                      2) Currently you cannot have pointcuts on interfaces, maybe that is the problem? Try changing it to;

                      pointcut="execution(public void HelloOliverBean->work())"

                      (Remember that everything needs to be fully qualified, so if your bean is in a package you need to give that as well.)

                      (To post xml/java surround it in code tags)

                      • 8. Re: problems with aop
                        kabirkhan

                        OK, now I am confused. I've had a look in our cvs repository, and org.jboss.aop.InterceptorPointcut appears to have been deleted about nine months ago. So it looks like you have some incompatible versions of stuff somewhere? Make sure you are using the latest JBoss release and the final AOP release, if you have not done so already, and follow these steps:
                        http://docs.jboss.org/aop/aspect-framework/reference/en/html_single/index.html#installing-jboss40

                        jboss-common.jar is part of jboss already, and is not needed as part of the aop deployer. You can find it in jboss-4.0/lib

                        • 9. Re: problems with aop
                          kabirkhan

                          Seeing as there was another thread on this problem, just to make sure I downloaded JBoss 4.0 and JBoss AOP and tried it for myself.

                          Here are the exact steps I took:

                          1) Download JBoss 4.0 from http://prdownloads.sourceforge.net/jboss/jboss-4.0.0.zip?download

                          2) Download JBoss AOP FINAL fromhttp://prdownloads.sourceforge.net/jboss/jboss-aop_1.0.0-FINAL.zip?download

                          3) Unzip both JBoss and JBoss AOP

                          The rest is as mentioned in chapter 8.2 of the documentation;

                          4) Go to the jboss-4.0.0/server/all/deploy folder and remove the jboss-aop.deployer file

                          FOR JDK 1.4

                          5) copy jboss-aop_1.0.0-FINAL/jboss-40-install/jboss-aop.deployer to the jboss-4.0.0/server/all/deploy folder

                          6) Start up JBoss using
                          $ run -c all

                          FOR JDK 1.5

                          5) copy jboss-aop_1.0.0-FINAL/jboss-40-install/jboss-aop-jdk50.deployer to the jboss-4.0.0/server/all/deploy folder

                          6) Start up JBoss using
                          $ run -c all



                          Hope this helps,

                          Kabir

                          • 10. Re: problems with aop
                            ollihak

                            Hi Kabir,

                            well, I reinstalled all those things, and I found some mistakes, that's okay.

                            But unfortunately it does not work completely. I guess it does not make a difference, if I use server/default/deploy or server/all/deploy, both produce the same output, when I tried to deploy my firstaspect.jar, here it is:


                            10:44:26,106 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
                            Packages waiting for a deployer:
                            org.jboss.deployment.DeploymentInfo@93f227cc { url=file:/C:/jboss-4.0.0/server/d
                            efault/deploy/firstaspect.jar }
                            deployer: null
                            status: null
                            state: INIT_WAITING_DEPLOYER
                            watch: file:/C:/jboss-4.0.0/server/default/deploy/firstaspect.jar
                            altDD: null
                            lastDeployed: 1100771066106
                            lastModified: 1100771066106
                            mbeans:

                            Incompletely deployed packages:
                            org.jboss.deployment.DeploymentInfo@93f227cc { url=file:/C:/jboss-4.0.0/server/d
                            efault/deploy/firstaspect.jar }
                            deployer: null
                            status: null
                            state: INIT_WAITING_DEPLOYER
                            watch: file:/C:/jboss-4.0.0/server/default/deploy/firstaspect.jar
                            altDD: null
                            lastDeployed: 1100771066106
                            lastModified: 1100771066106
                            mbeans:

                            I was not sure, maybe my code was wrong.
                            So I tried the wiki-POJO-example as a standalone project. As before the problem is, that jboss-aop-jdk50.jar does not contain a class-file called InvocationType, which is also used in an article by Bill Burke. But anyway, fixing, compiling and running the code lead to this error-message:

                            C:\Test3>java -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoa
                            der POJO
                            java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/ConcurrentReade
                            rHashMap
                            at org.jboss.aop.AspectManager.(AspectManager.java:88)
                            at org.jboss.aop.AspectManager.instance(AspectManager.java:116)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.aop.standalone.SystemClassLoader.initialize(SystemClassLoad
                            er.java:452)
                            at org.jboss.aop.standalone.SystemClassLoader.loadClass(SystemClassLoade
                            r.java:162)
                            at java.lang.ClassLoader.loadClass(Unknown Source)
                            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
                            Exception in thread "main" java.lang.Error: Error installing aspect manager
                            at org.jboss.aop.standalone.SystemClassLoader.initialize(SystemClassLoad
                            er.java:463)
                            at org.jboss.aop.standalone.SystemClassLoader.loadClass(SystemClassLoade
                            r.java:162)
                            at java.lang.ClassLoader.loadClass(Unknown Source)
                            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
                            Caused by: java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/Conc
                            urrentReaderHashMap
                            at org.jboss.aop.AspectManager.(AspectManager.java:88)
                            at org.jboss.aop.AspectManager.instance(AspectManager.java:116)
                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                            at java.lang.reflect.Method.invoke(Unknown Source)
                            at org.jboss.aop.standalone.SystemClassLoader.initialize(SystemClassLoad
                            er.java:452)
                            ... 3 more


                            Of course, I will try to do the tutorial again, but this is strange, isn't it?

                            OLLI

                            • 11. Re: problems with aop
                              ollihak

                              Hi Kabir,

                              well, I reinstalled all those things, and I found some mistakes, that's okay.

                              But unfortunately it does not work completely. I guess it does not make a difference, if I use server/default/deploy or server/all/deploy, both produce the same output, when I tried to deploy my firstaspect.jar, here it is:

                              10:44:26,106 ERROR [URLDeploymentScanner] Incomplete Deployment listing:
                              Packages waiting for a deployer:
                              org.jboss.deployment.DeploymentInfo@93f227cc { url=file:/C:/jboss-4.0.0/server/d
                              efault/deploy/firstaspect.jar }
                              deployer: null
                              status: null
                              state: INIT_WAITING_DEPLOYER
                              watch: file:/C:/jboss-4.0.0/server/default/deploy/firstaspect.jar
                              altDD: null
                              lastDeployed: 1100771066106
                              lastModified: 1100771066106
                              mbeans:

                              Incompletely deployed packages:
                              org.jboss.deployment.DeploymentInfo@93f227cc { url=file:/C:/jboss-4.0.0/server/d
                              efault/deploy/firstaspect.jar }
                              deployer: null
                              status: null
                              state: INIT_WAITING_DEPLOYER
                              watch: file:/C:/jboss-4.0.0/server/default/deploy/firstaspect.jar
                              altDD: null
                              lastDeployed: 1100771066106
                              lastModified: 1100771066106
                              mbeans:

                              I was not sure, maybe my code was wrong.
                              So I tried the wiki-POJO-example as a standalone project. As before the problem is, that jboss-aop-jdk50.jar does not contain a class-file called InvocationType, which is also used in an article by Bill Burke. But anyway, fixing, compiling and running the code lead to this error-message:

                              C:\Test3>java -Djava.system.class.loader=org.jboss.aop.standalone.SystemClassLoa
                              der POJO
                              java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/ConcurrentReade
                              rHashMap
                              at org.jboss.aop.AspectManager.(AspectManager.java:88)
                              at org.jboss.aop.AspectManager.instance(AspectManager.java:116)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                              at java.lang.reflect.Method.invoke(Unknown Source)
                              at org.jboss.aop.standalone.SystemClassLoader.initialize(SystemClassLoad
                              er.java:452)
                              at org.jboss.aop.standalone.SystemClassLoader.loadClass(SystemClassLoade
                              r.java:162)
                              at java.lang.ClassLoader.loadClass(Unknown Source)
                              at java.lang.ClassLoader.loadClassInternal(Unknown Source)
                              Exception in thread "main" java.lang.Error: Error installing aspect manager
                              at org.jboss.aop.standalone.SystemClassLoader.initialize(SystemClassLoad
                              er.java:463)
                              at org.jboss.aop.standalone.SystemClassLoader.loadClass(SystemClassLoade
                              r.java:162)
                              at java.lang.ClassLoader.loadClass(Unknown Source)
                              at java.lang.ClassLoader.loadClassInternal(Unknown Source)
                              Caused by: java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/Conc
                              urrentReaderHashMap
                              at org.jboss.aop.AspectManager.(AspectManager.java:88)
                              at org.jboss.aop.AspectManager.instance(AspectManager.java:116)
                              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                              at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                              at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                              at java.lang.reflect.Method.invoke(Unknown Source)
                              at org.jboss.aop.standalone.SystemClassLoader.initialize(SystemClassLoad
                              er.java:452)
                              ... 3 more


                              Of course, I will try to do the tutorial again, but this is strange, isn't it?

                              OLLI

                              • 12. Re: problems with aop
                                kabirkhan

                                The error messages are different now. Previously the problem seemed to be theAspectManagerService in JBoss was not starting. Can you send me your code and I'll take a quick look? kabir.khan@jboss.org

                                For the standalone stuff, you need to specify the classpaths and path to your jboss-aop.xml file as shown in the documentation.

                                http://docs.jboss.org/aop/aspect-framework/reference/en/html/running.html#d0e2536

                                Since concurrent jar is NOT on your class path it cannot be found... Also, when running with JDK 1.5, you should use the -javaagent switch rather than -Djava.system.class.loader. There are some batch files in the bin directory of the distribution to help with this. If you have not gone through the tutorial already, so so.

                                Cheers,

                                Kabir

                                • 13. Re: problems with aop
                                  kabirkhan

                                  BTW, the batch file if you want to run standalone with loadtime instrumentation for JDK 1.5 is:

                                  bin/run-load15.bat

                                  for running a compiletime intrumented standalone app

                                  bin/run-precompiled.bat

                                  • 14. Re: problems with aop
                                    kabirkhan

                                    Can you post the link for the WIKI POJO example you mentioned?

                                    1 2 Previous Next