1 2 Previous Next 17 Replies Latest reply on Nov 22, 2004 9:43 AM by ollihak Go to original post
      • 15. Re: problems with aop
        ollihak

        Okay, I've sent the code to your e-mail-address.

        I'll try things out as soon as possible.
        Thanks
        OLLI

        • 16. Re: problems with aop
          kabirkhan

          When deploying your stuff, I get the same error as you. Your packaging is not quite there. The jar containing the jboss-aop.xml file must have the suffix .aop. Also, if this is not the same as your "main" jar file, it is a good idea to combine them in an .ear file since loadtime instrumentation takes place at deploy time, so that you get both deployed at the same time. Once loaded a class cannot be further instrumented. As a starting point for how to package your stuff go through the tutorial in jboss-aop_1.0.0-FINAL/docs/aspect-framework/examples/injboss folder. Play with it and modify it. Section 10.2 of the reference documentation contains some information on what is allowed.

          The WIKI you mention (from your email: http://www.madplanet.com/jboss-docu-wiki/Wiki.jsp?page=40.AOP.Simple.Example) is not our WIKI, and it is grossly out of date. We are at:

          http://www.jboss.org/wiki/Wiki.jsp?page=JBossAOP

          • 17. 3855452
            ollihak

            Hi,

            I finally solved my problems now...Thank you, Kabir, for your help. It was somewhat tricky, although everything was available in tutorials, but some of them were contradictory etc.

            So for those of you, who are beginners of implementing aop, here is what I did for implementing my first aspect:

            1. Install JBoss-4.0.0 (download the zip-file from jboss.org) and JDK1.5

            2. delete the jboss-aop.deployer-file from server/all/deploy

            Note: I had to use the jboss-all-configuration, aop did not work with the default-configuration on my system.


            3. Download jboss-aop_1.0.0-FINAL.zip from jboss.org and unzip it. Copy the whole jboss-aop-jdk50.deployer directory into your server/all/deploy directory. (If you are using jdk1.4 you have to copy the jboss-aop.deployer-directory)

            4. Now, modify the jboss-service.xml-file in the jboss-aop-jdk50.deployer/META-INF directory. The only thing you have to do is to set the "EnableTransformer"-Attribute to TRUE. This will cause jboss to take a longer time when starting up.

            Note: On my system it was not enough to simply set the same attribute to TRUE on the jmx-console.

            5. Start the all-configuration by the command
            run -c all
            on your console.

            6. The packaging looks like this:

            HelloWorld.ear contains:

            -HelloWorld.jar // here are simple EnterpriseBeans that say "HelloWorld"
            -Aspect.aop // this is a jar-file ending with the suffix .aop, which contains the aspect code
            -Maybe you also add .war-files if you are implementing a servlet
            -finally a META-INF/application.xml-file

            My application.xml-file looks like this:

            <?xml version='1.0' encoding='UTF-8'?>
            <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN'
             'http://java.sun.com/j2ee/dtds/application_1_2.dtd'>
            
            <application>
             <display-name>AOP in JBoss example</display-name>
             <module>
             <ejb>HelloWorld.jar</ejb>
             </module>
             <module>
             <java>Aspect.aop</java>
             </module>
            </application>
            


            Just for completeness, the HelloWorld.jar contains:
            - HelloWorld.class //Remote Interface
            - HelloWorldBean.class // Your enterprise bean
            - HelloWorldHome.class // Home-Interface
            - META-INF/ejb-jar.xml // deployment-descriptor for the beans

            and my Aspect.aop-file contains:
            - aspect.class // Aspect code as described in the tutorials
            - META-INF/jboss-aop.xml // AOP-Deployment-descriptor

            Note:
            Make sure that, when trying to set an aspect on a bean-class or just one method of a bean-class for example, the -tag - or other tags in your jboss-aop.xml-file - must describe the whole package-structure of your code, to find the correct class.


            7. Copy this .ear-file to the server/all/deploy-directory to deploy it on the server

            8. Run your client

            Of course, there are different methods to make it work, but this on fit for me.
            I hope it might help you...

            OLLI



            1 2 Previous Next