<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    Binding annotated methods and session bean methods
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/fambad">Marco Strauch</a> in <i>JBoss AOP Development</i> - <a href="http://community.jboss.org/message/572401#572401">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have 2 little problems using JBoss AOP within JBoss 5.1.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><ol><li>I have annotated methods and I want to create bindings using AOP (e.g. <strong>&lt;bind pointcut="execution(* *-&gt;@mstrauch.test.aop.common.MyAnnotation(..))"&gt;</strong> .... ). But the aspects are never called. When I bind the method directly without using the annotation it works (e.g.<strong> &lt;bind pointcut="execution(* mstrauch.test.aop.common.CommonTest-&gt;*(..))"&gt; </strong>...).</li><li>The second problem is, that I can't bind methods in session beans (e.g.<strong> &lt;bind pointcut="execution(* mstrauch.test.aop.TestSessionBean-&gt;*(..))"&gt;</strong>...).</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I have follow project structure:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>aoptest.ear</p><p>&#160;&#160;&#160;&#160; | -- lib</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | -- common.jar</p><p>&#160;&#160;&#160;&#160; | -- META-INF</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | -- application.xml</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; | -- jboss-app.xml</p><p>&#160;&#160;&#160;&#160; | -- aspects.aop</p><p>&#160;&#160;&#160;&#160; | -- ejb.jar</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>For testing I tried XML Bindings (MyAspect.class) and Annotation Bindings (MyAnnotationAspect.class). I also put my annoation (MyAnnotation.class, MyAnnotation2.class, MyAnnotation3.class) once in the common.jar, aspects.aop and ejb.jar. But nothing works.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I don't know what is wrong. Maybe somebody can help me.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>I attached a complete example with all kinds of bindings. The sample works fine in JBoss 4.3 but not in JBoss 5.1. Below I copied the log output of both JBoss servers. It should be the same but it isn't.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>To run the sample, just deploy the exploded archive "aoptest.ear" in JBoss and run the test Method via the JMX-Console (<strong><a class="jive-link-external-small" href="http://localhost:8080/jmx-console/HtmlAdaptor?action=displayMBeans&amp;filter=mst.test.aop" target="ObjectNodeView">mst.test.aop</a>:service=TestMBean</strong>)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Log-Output JBoss 5.1 (JBoss AOP 2.1.8.GA - Version JBoss Aspect Library: 1.3)</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>08:53:10,383 INFO&#160; [TestClass] [testAnnot01] --&gt; Called Test 01<br/>08:53:10,383 INFO&#160; [TestClass] [testAnnot02] --&gt; Called Test 02<br/>08:53:10,383 INFO&#160; [TestClass] [testAnnot03] --&gt; Called Test 03<br/>08:53:10,440 INFO&#160; [MyAspect] &lt;init&gt;<br/>08:53:10,451 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:53:10,454 INFO&#160; [MyAspect] [injectTest11 --&gt; test11]<br/>08:53:10,454 INFO&#160; [MyAnnoatedAspect] [injectTest11 --&gt; test11]<br/>08:53:10,462 INFO&#160; [TestClass] [test11] --&gt; Called Test 11<br/>08:53:10,518 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:53:10,518 INFO&#160; [MyAspect] [injectCommonTest11 --&gt; testCommon]<br/>08:53:10,519 INFO&#160; [MyAnnoatedAspect] [injectCommonTest11 --&gt; testCommon]<br/>08:53:10,527 INFO&#160; [CommonTest] [testCommon]<br/>08:53:10,569 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:53:10,570 INFO&#160; [MyAspect] [injectTestSessionBean --&gt; ejbPostContruct]<br/>08:53:10,570 INFO&#160; [MyAnnoatedAspect] [injectTestSessionBean --&gt; ejbPostContruct]<br/>08:53:10,578 INFO&#160; [TestSessionBean] [ejbPostContruct]<br/>08:53:10,588 INFO&#160; [TestSessionBean] [test01]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p><strong>Log-Output JBoss 4.3 (JBoss AOP 1.5.6.GA - Version JBoss Aspect Library: 1.5)</strong></p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>08:38:29,432 INFO&#160; [MyAspect] &lt;init&gt;<br/>08:38:29,482 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:38:29,483 INFO&#160; [MyAspect] [injectTestAnnot01 --&gt; testAnnot01]<br/>08:38:29,483 INFO&#160; [TestClass] [testAnnot01] --&gt; Called Test 01<br/>08:38:29,483 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:38:29,484 INFO&#160; [MyAspect] [injectTestAnnot02 --&gt; testAnnot02]<br/>08:38:29,484 INFO&#160; [TestClass] [testAnnot02] --&gt; Called Test 02<br/>08:38:29,484 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:38:29,484 INFO&#160; [MyAspect] [injectTestAnnot03 --&gt; testAnnot03]<br/>08:38:29,484 INFO&#160; [TestClass] [testAnnot03] --&gt; Called Test 03<br/>08:38:29,484 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:38:29,485 INFO&#160; [MyAnnoatedAspect] [injectTest11 --&gt; test11]<br/>08:38:29,486 INFO&#160; [MyAspect] [injectTest11 --&gt; test11]<br/>08:38:29,486 INFO&#160; [TestClass] [test11] --&gt; Called Test 11<br/>08:38:29,521 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:38:29,522 INFO&#160; [MyAnnoatedAspect] [injectCommonTest11 --&gt; testCommon]<br/>08:38:29,523 INFO&#160; [MyAspect] [injectCommonTest11 --&gt; testCommon]<br/>08:38:29,524 INFO&#160; [CommonTest] [testCommon]<br/>08:38:29,587 INFO&#160; [MyAnnoatedAspect] &lt;init&gt;<br/>08:38:29,588 INFO&#160; [MyAnnoatedAspect] [injectTestSessionBean --&gt; ejbPostContruct]<br/>08:38:29,589 INFO&#160; [MyAspect] [injectTestSessionBean --&gt; ejbPostContruct]<br/>08:38:29,591 INFO&#160; [TestSessionBean] [ejbPostContruct]<br/>08:38:29,592 INFO&#160; [MyAnnoatedAspect] [injectTestSessionBean --&gt; test01]<br/>08:38:29,592 INFO&#160; [MyAspect] [injectTestSessionBean --&gt; test01]<br/>08:38:29,593 INFO&#160; [TestSessionBean] [test01]</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/572401#572401">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AOP Development at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2028">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>