<!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;">
    calling aspect from netty thread inside jboss 5.1
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="http://community.jboss.org/people/elgabo">Gabriel Bermudez</a> in <i>JBoss AOP</i> - <a href="http://community.jboss.org/message/550087#550087">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hi,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>We are using netty to send and receive network messages.&#160; But for some reason advices are not being called when messages are received.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>All classes and xml files involved on the project are _not_ inside the same jar, basically I have 2&#160; jar, basic.jar with common code like the aspect, the jboss-beans.xml&#160; file where the netty SocketChannelFactory is defined (a exact copy of&#160; the file found inside netty.jar/META-INF/jboss-beans.xml) and other&#160; common beans defined inside jboss-beans.xml file</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>basic.jar</p><p>+com.test.* (common classes)</p><p>+com.test.TestAspect</p><p>+META-INF</p><p>&#160;&#160;&#160;&#160; +jboss-beans.xml</p><p>&#160;&#160;&#160;&#160; +netty-jboss-beans.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>And network.jar with&#160; network specific code like MyNetworkListener, netty ChannleHandlers, and&#160; of course the jboss-beans.xml file that defines beans and aspects</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>network.jar</p><p>+com.test.MyNetworkListener</p><p>+META-INF</p><p>&#160;&#160;&#160;&#160; +jboss-beans.xml</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>For example I have the following aspect:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>public class TestAspect {</p><p>&#160;&#160; createSomething(MethodInvocation inv) {...}</p><p>&#160;&#160; updateSomething(MethodInvocation inv) {...}</p><p>}</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>updateSomething must be called after a message is received from network so inside jboss-beans.xml I put</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;aop:aspect xmlns:aop="urn:jboss:aop-beans:1.0"<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; xsi:schemaLocation="urn:jboss:aop-beans:1.0 aop-beans_1_0.xsd"<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; class="com.test.TestAspect" name="TestAspect"/&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>&lt;aop:bind xmlns:aop="urn:jboss:aop-beans:1.0"<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; xsi:schemaLocation="urn:jboss:aop-beans:1.0 aop-beans_1_0.xsd"<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; pointcut="execution(public void com.test.MyNetworkListener-&gt;responseReceived(..))"&gt;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160; &lt;aop:after aspect="TestAspect" name="updateSomething"/&gt;<br/>&lt;/aop:bind&gt;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>the MyNetworkListener.responseReceived method is called by a netty ChannelHandler (obviosly running inside a IO thread) so I'm guessing that MyNetworkListener is not being weived properly because is being called from a thread not managed by the jboss server/aop libs? or maybe is a classloading issue?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Thanks for your help on this issue</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Regards,</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/550087#550087">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss AOP at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2027">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


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

</div>

</body>
</html>