<!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;"> </p><p>I have 2 little problems using JBoss AOP within JBoss 5.1.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><ol><li>I have annotated methods and I want to create bindings using AOP (e.g. <strong><bind pointcut="execution(* *->@mstrauch.test.aop.common.MyAnnotation(..))"></strong> .... ). But the aspects are never called. When I bind the method directly without using the annotation it works (e.g.<strong> <bind pointcut="execution(* mstrauch.test.aop.common.CommonTest->*(..))"> </strong>...).</li><li>The second problem is, that I can't bind methods in session beans (e.g.<strong> <bind pointcut="execution(* mstrauch.test.aop.TestSessionBean->*(..))"></strong>...).</li></ol><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have follow project structure:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>aoptest.ear</p><p>     | -- lib</p><p>           | -- common.jar</p><p>     | -- META-INF</p><p>           | -- application.xml</p><p>           | -- jboss-app.xml</p><p>     | -- aspects.aop</p><p>     | -- ejb.jar</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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;"> </p><p>I don't know what is wrong. Maybe somebody can help me.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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;"> </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&filter=mst.test.aop" target="ObjectNodeView">mst.test.aop</a>:service=TestMBean</strong>)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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;"> </p><p>08:53:10,383 INFO  [TestClass] [testAnnot01] --> Called Test 01<br/>08:53:10,383 INFO  [TestClass] [testAnnot02] --> Called Test 02<br/>08:53:10,383 INFO  [TestClass] [testAnnot03] --> Called Test 03<br/>08:53:10,440 INFO  [MyAspect] <init><br/>08:53:10,451 INFO  [MyAnnoatedAspect] <init><br/>08:53:10,454 INFO  [MyAspect] [injectTest11 --> test11]<br/>08:53:10,454 INFO  [MyAnnoatedAspect] [injectTest11 --> test11]<br/>08:53:10,462 INFO  [TestClass] [test11] --> Called Test 11<br/>08:53:10,518 INFO  [MyAnnoatedAspect] <init><br/>08:53:10,518 INFO  [MyAspect] [injectCommonTest11 --> testCommon]<br/>08:53:10,519 INFO  [MyAnnoatedAspect] [injectCommonTest11 --> testCommon]<br/>08:53:10,527 INFO  [CommonTest] [testCommon]<br/>08:53:10,569 INFO  [MyAnnoatedAspect] <init><br/>08:53:10,570 INFO  [MyAspect] [injectTestSessionBean --> ejbPostContruct]<br/>08:53:10,570 INFO  [MyAnnoatedAspect] [injectTestSessionBean --> ejbPostContruct]<br/>08:53:10,578 INFO  [TestSessionBean] [ejbPostContruct]<br/>08:53:10,588 INFO  [TestSessionBean] [test01]</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </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;"> </p><p>08:38:29,432 INFO  [MyAspect] <init><br/>08:38:29,482 INFO  [MyAnnoatedAspect] <init><br/>08:38:29,483 INFO  [MyAspect] [injectTestAnnot01 --> testAnnot01]<br/>08:38:29,483 INFO  [TestClass] [testAnnot01] --> Called Test 01<br/>08:38:29,483 INFO  [MyAnnoatedAspect] <init><br/>08:38:29,484 INFO  [MyAspect] [injectTestAnnot02 --> testAnnot02]<br/>08:38:29,484 INFO  [TestClass] [testAnnot02] --> Called Test 02<br/>08:38:29,484 INFO  [MyAnnoatedAspect] <init><br/>08:38:29,484 INFO  [MyAspect] [injectTestAnnot03 --> testAnnot03]<br/>08:38:29,484 INFO  [TestClass] [testAnnot03] --> Called Test 03<br/>08:38:29,484 INFO  [MyAnnoatedAspect] <init><br/>08:38:29,485 INFO  [MyAnnoatedAspect] [injectTest11 --> test11]<br/>08:38:29,486 INFO  [MyAspect] [injectTest11 --> test11]<br/>08:38:29,486 INFO  [TestClass] [test11] --> Called Test 11<br/>08:38:29,521 INFO  [MyAnnoatedAspect] <init><br/>08:38:29,522 INFO  [MyAnnoatedAspect] [injectCommonTest11 --> testCommon]<br/>08:38:29,523 INFO  [MyAspect] [injectCommonTest11 --> testCommon]<br/>08:38:29,524 INFO  [CommonTest] [testCommon]<br/>08:38:29,587 INFO  [MyAnnoatedAspect] <init><br/>08:38:29,588 INFO  [MyAnnoatedAspect] [injectTestSessionBean --> ejbPostContruct]<br/>08:38:29,589 INFO  [MyAspect] [injectTestSessionBean --> ejbPostContruct]<br/>08:38:29,591 INFO  [TestSessionBean] [ejbPostContruct]<br/>08:38:29,592 INFO  [MyAnnoatedAspect] [injectTestSessionBean --> test01]<br/>08:38:29,592 INFO  [MyAspect] [injectTestSessionBean --> test01]<br/>08:38:29,593 INFO  [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>