11 Replies Latest reply on Oct 18, 2012 9:56 AM by jaikiran pai

    IllegalStateException: No EJB receiver available for handling when server name contains hyphen

    John Sipher Newbie

      I have an application that has deployed and worked fine on multiple environments, but will not work on a server that has a hyphen in the name, e.g., xxxxqa-1.mycompany.com. I've deployed the application (successfully) in WebSphere on the same server just to verify that it's a JBoss-specific issue and not something strange we're doing in the application.

       

      The application is deployed as a EAR containing several EJBs and a couple web applications. It fails when one of the servlets tries to access an EJB during the servlet's initialization.

       

      I'll post a stack trace later after I get a new test environment set up (I wasn't quick enough to copy the logs to my laptop before QA decided to rename their servers), but here's what I found while trying to debug it. Line numbers are from jboss-as-7.1.2.Final/jboss-ejb-client-1.0.10.Final.

       

      The "No EJB receiver available" message is triggered by the "return null" at line 539 in org.jboss.ejb.client.EjbClientContext. This snippet starts at line 536

       

          EJBReceiver getEJBReceiver(final EJBClientInvocationContext invocationContext, final String appName, final String moduleName, final String distinctName) {

              final Iterator<EJBReceiver> iterator = getEJBReceivers(appName, moduleName, distinctName).iterator();

              if (!iterator.hasNext()) {

                  return null;

              }

       

      The getEJBReceivers(appName, moduleName, distinctName) ends up in this method starting at line 469

          private Collection<EJBReceiver> getEJBReceivers(final String appName, final String moduleName, final String distinctName,

                                                          final boolean attemptReconnect) {

              final Collection<EJBReceiver> eligibleEJBReceivers = new HashSet<EJBReceiver>();

              synchronized (this.ejbReceiverAssociations) {

                  for (final Map.Entry<EJBReceiver, ReceiverAssociation> entry : this.ejbReceiverAssociations.entrySet()) {

                      if (entry.getValue().associated) {

                          final EJBReceiver ejbReceiver = entry.getKey();

                          if (ejbReceiver.acceptsModule(appName, moduleName, distinctName)) {

                              eligibleEJBReceivers.add(ejbReceiver);

                          }

                      }

                  }

              }


      The interesting thing (to me anyway) is that if I put a breakpoint on the for statement at line 473 in getEJBReceivers(), this.ejbReceiverAssociations will be empty. But, if I move the breakpoint up a couple lines (before the synchronized), this.ejbReceiverAssociations will not be empty and I won't get the "No EJB receiver..." message. That makes me think that there could be some multi-threading issue, but it doesn't make sense that it would show up only in this one environment with the hyphen in the host name.

       

      Any suggestions will be appreciated.