<!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="https://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;">
    EJBCLIENT000024: No EJB receiver available for handling
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/Michael_Gronau">Michael Gronau</a> in <i>JBoss AS 7 Development</i> - <a href="https://community.jboss.org/message/753527#753527">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>During some stress-testing our application, i get this exception, when we create multiple EJBClientContext Objects in different threads simultaniously (only in some of those threads):</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>java.lang.IllegalStateException : EJBCLIENT000024: No EJB receiver available for handling [appName:jas-application, moduleName:core-ejb, distinctName:] combination</p><p>&#160;&#160;&#160; at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:522)</p><p>&#160;&#160;&#160; at org.jboss.ejb.client.EJBClient.createSession(EJBClient.java:161)</p><p>&#160;&#160;&#160; at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:135)</p><p>&#160;&#160;&#160; at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:113)</p><p>&#160;&#160;&#160; ... 9 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>In our case this exception occurs in at least 1 Thread when connecting and looking up a stateful bean with more than 10 Threads at the same time.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Some debugging around this has shown that this exception is thrown because of a hard-coded timeout value in the class org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver.associate(). The code line has a TODO:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><table><tbody><tr><td style=";">&#160;&#160;&#160; </td><td style=";">boolean successfulHandshake = false;</td></tr><tr><td style=";">&#160;&#160;&#160; </td><td style=";">try {</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">// wait for the handshake to complete</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";"><span style="color: #ff0000;"><strong>// TODO: Think about externalizing this timeout</strong></span></td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";"><span style="color: #ff0000;"><strong>successfulHandshake = versionHandshakeLatch.await(5, TimeUnit.SECONDS);</strong></span></td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">if (successfulHandshake) {</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">final Channel compatibleChannel = versionReceiver.getCompatibleChannel();</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">final ChannelAssociation channelAssociation = new ChannelAssociation(this, context, compatibleChannel, this.clientProtocolVersion, this.marshallerFactory, this.reconnectHandler);</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">synchronized (this.channelAssociations) {</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">this.channelAssociations.put(context, channelAssociation);</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">}</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">Logs.REMOTING.successfulVersionHandshake(context, compatibleChannel);</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">} else {</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">// no version handshake done. close the context</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">Logs.REMOTING.versionHandshakeNotCompleted(context);</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">context.close();</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">}</td></tr><tr><td style=";">&#160;&#160;&#160; </td><td style=";">} catch (InterruptedException e) {</td></tr><tr><td style=";">&#160;&#160;&#160;&#160;&#160;&#160;&#160; </td><td style=";">context.close();</td></tr><tr><td style=";">&#160;&#160;&#160; </td><td style=";">}</td></tr></tbody></table><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>When stressing the remote ejb client enough the client EJBClientContext is closed silently (because version handshake was not done within 5 seconds) and so no ejb receivers are available.</p><p>I think, to make the timeout configurable would be a perfect solution for us.</p><p>Should I create an Issue in JIRA?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>With best regards,</p><p>Michael</p></div>

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


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

</div>

</body>
</html>