11 Replies Latest reply on Apr 11, 2014 2:22 AM by Wolf-Dieter Fink

    JBoss Cluster EJB Remoting Issue

    Shawn Yarnell Newbie

      I currently have a JBoss instance running with standalone-ha.xml as the config file. JBoss 7.1.1 Final. I have deployed a basic HelloBean inside a .jar called ClusterTestEJB inside an .ear called ClusterTest.

       

      HelloBean:

      package com.sample;

      import javax.ejb.Remote;
      import javax.ejb.Stateless;

      import org.jboss.ejb3.annotation.Clustered;

      @Stateless
      @Clustered
      @Remote(HelloBeanItf.class)

      public class HelloBean implements HelloBeanItf {
       
      int counter = 0;
       
      public String doSomething() {
        
      return "HelloBean Called";
       
      }
      }

       

      The HelloBeanItf is as follows:


      package com.sample;

      public interface HelloBeanItf {

        
      public String doSomething();

      }

       

      I got the code from a tutorial I was following.

      So I have everything seemingly working. I am now trying to write a java client to invoke that EJB. Here is that code:

      import java.util.Properties;

      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingException;

      import com.sample.HelloBeanItf;

      public class Client {
       
      public static void main(String[] args){

        
      Properties p = new Properties();
        p
      .put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
        p
      .put("jboss.naming.client.ejb.context", true);
        p
      .put(Context.SECURITY_PRINCIPAL, "user");
        p
      .put(Context.SECURITY_CREDENTIALS, "password");
        p
      .put(Context.PROVIDER_URL, "remote://mynode:4447");

        
      InitialContext ctx;
        
      try {
        ctx
      = new InitialContext(p);
        
      } catch (NamingException e) {
        
      // TODO Auto-generated catch block
        e
      .printStackTrace();
        
      return;
        
      }

        
      HelloBeanItf ejb = null;
        
      try {
        ejb
      = (HelloBeanItf) ctx.lookup("java:ClusterTest/ClusterTestEJB//HelloBean!com.sample.HelloBeanItf");
        
      } catch (NamingException e) {
        
      // TODO Auto-generated catch block
        e
      .printStackTrace();
        
      return;
        
      }

        
      for (int ii=0;ii<10;ii++) {
        ejb
      .doSomething();
        
      }
        
      System.out.println("Terminated");
        
      }

      }

       

      Here is client side log output:


      Bad level value for property: java.util.logging.ConsoleHandler.level
      Apr 03, 2014 10:49:30 PM org.jboss.logging.LoggerProviders find
      DEBUG
      : Logging Provider: org.jboss.logging.JDKLoggerProvider
      Apr 03, 2014 10:49:30 PM org.jboss.naming.remote.client.InitialContextFactory findClientProperties
      DEBUG
      : Looking for jboss-naming-client.properties using classloader sun.misc.Launcher$AppClassLoader@6921dcac
      Apr 03, 2014 10:49:30 PM org.jboss.naming.remote.client.InitialContextFactory getOptionMapFromProperties
      DEBUG
      : jboss.naming.client.endpoint.create.options. has the following options {}
      Apr 03, 2014 10:49:30 PM org.jboss.naming.remote.client.InitialContextFactory getOptionMapFromProperties
      DEBUG
      : jboss.naming.client.remote.connectionprovider.create.options. has the following options {}
      Apr 03, 2014 10:49:30 PM org.xnio.Xnio <clinit>
      INFO
      : XNIO Version 3.0.3.GA
      Apr 03, 2014 10:49:30 PM org.xnio.nio.NioXnio <clinit>
      INFO
      : XNIO NIO Implementation Version 3.0.3.GA
      Apr 03, 2014 10:49:30 PM org.jboss.remoting3.EndpointImpl <clinit>
      INFO
      : JBoss Remoting version 3.2.3.GA
      Apr 03, 2014 10:49:30 PM org.xnio.nio.WorkerThread run
      DEBUG
      : Started channel thread 'Remoting "config-based-naming-client-endpoint" read-1', selector sun.nio.ch.WindowsSelectorImpl@3a151cc3
      Apr 03, 2014 10:49:30 PM org.xnio.nio.WorkerThread run
      DEBUG
      : Started channel thread 'Remoting "config-based-naming-client-endpoint" write-1', selector sun.nio.ch.WindowsSelectorImpl@42d2821b
      Apr 03, 2014 10:49:30 PM org.jboss.naming.remote.client.InitialContextFactory getOptionMapFromProperties
      DEBUG
      : jboss.naming.client.connect.options. has the following options {}
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.EJBClientPropertiesLoader loadEJBClientProperties
      DEBUG
      : Looking for jboss-ejb-client.properties using classloader sun.misc.Launcher$AppClassLoader@6921dcac
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector <init>
      DEBUG
      : EJB client context org.jboss.ejb.client.EJBClientContext@51bc1897 will have no EJB receivers associated with it since there was no EJB client configuration available to create the receivers
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver$1 handleDone
      DEBUG
      : Channel Channel ID 828f699b (outbound) of Remoting connection 0d818ff0 to mynode/139.181.88.6:4447 opened for context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@7c572f78, receiver=Remoting connection EJB receiver [connection=Remoting connection <6981170d>,channel=jboss.ejb,nodename=node1]} Waiting for version handshake message from server
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.VersionReceiver handleMessage
      INFO
      : Received server version 1 and marshalling strategies [river]
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate
      INFO
      : Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@7c572f78, receiver=Remoting connection EJB receiver [connection=Remoting connection <6981170d>,channel=jboss.ejb,nodename=node1]} on channel Channel ID 828f699b (outbound) of Remoting connection 0d818ff0 to mynode/139.181.88.6:4447
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver modulesAvailable
      DEBUG
      : Received module availability report for 3 modules
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver modulesAvailable
      DEBUG
      : Registering module EJBModuleIdentifier{appName='', moduleName='ClusterWebApp', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@7c572f78, receiver=Remoting connection EJB receiver [connection=Remoting connection <6981170d>,channel=jboss.ejb,nodename=node1]}
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver modulesAvailable
      DEBUG
      : Registering module EJBModuleIdentifier{appName='ClusterTest', moduleName='ClusterTest', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@7c572f78, receiver=Remoting connection EJB receiver [connection=Remoting connection <6981170d>,channel=jboss.ejb,nodename=node1]}
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver modulesAvailable
      DEBUG
      : Registering module EJBModuleIdentifier{appName='ClusterTest', moduleName='ClusterTestEJB', distinctName=''} availability for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@7c572f78, receiver=Remoting connection EJB receiver [connection=Remoting connection <6981170d>,channel=jboss.ejb,nodename=node1]}
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.ClusterNode resolveDestination
      DEBUG
      : Checking for a match of client address /fe80:0:0:0:0:5efe:ac1e:5010%14 with client mapping ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='139.181.88.6', destinationPort=4447}
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.ClusterNode resolveDestination
      DEBUG
      : Client mapping ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='139.181.88.6', destinationPort=4447} matches client address /fe80:0:0:0:0:5efe:ac1e:5010%14
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.remoting.ClusterTopologyMessageHandler processMessage
      DEBUG
      : Received a cluster node(s) addition message, for cluster named ejb with 1 nodes [ClusterNode{clusterName='ejb', nodeName='node1', clientMappings=[ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='139.181.88.6', destinationPort=4447}], resolvedDestination=[Destination address=139.181.88.6, destination port=4447]}]
      Apr 03, 2014 10:49:32 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:33 PM org.jboss.remoting3.remote.ClientConnectionOpenListener$Authentication$1 run
      DEBUG
      : Client authentication failed for mechanism DIGEST-MD5: javax.security.sasl.SaslException: DIGEST-MD5: Cannot perform callback to acquire realm, authentication ID or password [Caused by javax.security.auth.callback.UnsupportedCallbackException]
      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:33 PM org.jboss.remoting3.remote.RemoteConnection handleException
      ERROR
      : JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager getEJBReceiver
      INFO
      : Could not create a connection for cluster node ClusterNode{clusterName='ejb', nodeName='node1', clientMappings=[ClientMapping{sourceNetworkAddress=/0:0:0:0:0:0:0:0, sourceNetworkMaskBits=0, destinationAddress='139.181.88.6', destinationPort=4447}], resolvedDestination=[Destination address=139.181.88.6, destination port=4447]} in cluster ejb
      java
      .lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
        at org
      .jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:91)
        at org
      .jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:117)
        at org
      .jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.run(ClusterContext.java:333)
        at java
      .util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java
      .util.concurrent.FutureTask.run(Unknown Source)
        at java
      .util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java
      .util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java
      .lang.Thread.run(Unknown Source)
      Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
        at org
      .jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:365)
        at org
      .jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:214)
        at org
      .xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org
      .xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org
      .xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org
      .xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org
      .xnio.nio.NioHandle.run(NioHandle.java:90)
        at org
      .xnio.nio.WorkerThread.run(WorkerThread.java:184)
        at
      ...asynchronous invocation...(Unknown Source)
        at org
      .jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)
        at org
      .jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)
        at org
      .jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)
        at org
      .jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)
        at org
      .jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:115)
        
      ... 6 more

      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:33 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:34 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:34 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Apr 03, 2014 10:49:34 PM org.jboss.ejb.client.EJBClientContext getEJBReceiver
      DEBUG
      : org.jboss.ejb.client.RandomDeploymentNodeSelector@5254e73f deployment node selector selected node1 node for appname=ClusterTest,modulename=ClusterTestEJB,distinctname=
      Terminated

       

      I have tried the following:

      Removing the remoting security realm, removing the username and password. I am not sure what else to try at this point.

      I also posted this on Stack Overflow. Please let me know the etiquette of duplicating questions. Is it ok to just post a link on here to maximize eyes? Or is a full paste like I did above necessary?

      Thanks for the help!

        • 1. Re: JBoss Cluster EJB Remoting Issue
          Radoslav Husar Master

          Removing the remoting security realm, removing the username and password. I am not sure what else to try at this point.

          The AS is secure by default. Have you read through EJB invocations from a remote client using JNDI - JBoss AS 7.1 - Project Documentation Editor or EJB invocations from a remote server instance - JBoss AS 7.1 - Project Documentation Editor ? Also there is a small article if you wish to disable security completely JBoss AS 7.1 - Disable Remote EJB Security Realm (not recommended).

           

          I also posted this on Stack Overflow. Please let me know the etiquette of duplicating questions. Is it ok to just post a link on here to maximize eyes? Or is a full paste like I did above necessary?

          I am not sure, but always link those questions together so people are not spending time in both places unnecessarily.

          • 2. Re: Re: JBoss Cluster EJB Remoting Issue
            Shawn Yarnell Newbie

            I just wen tthrough this:

            The AS is secure by default. Have you followed the process on EJB invocations from a remote server instance - JBoss AS 7.1 - Project Documentation Editor (section Security)?

             

            And the main difference is that the guide mentioned is communicating from server to server. I am using a standalone Java remote client.

             

            I did notice a difference in the code being that they put a class in the @Remote annotation of the bean. I made this change, but the server's response was no different. I also reflected this in the OP.

             

            I would also like to point out a few things. Firstly, notice in my code that I am using "java:" instead of "ejb" for the lookup. This is because every combination of "ejb:" that I try, I get only Naming Exceptions. I believe the correct JNDI lookup is this:

             

            ejb:ClusterTest/ClusterTestEJB//HelloBean!com.sample.HelloBeanItf

             

            But I simply get a Naming Exception. With the JNDI name mentioned in the OP, I get the message shown in the OP, which I assume means it might be actually finding the bean?

             

            I have the user/password combination correct. It is literally "user" "password", exactly what is shown in the OP.

             

            When JBoss is starting up, these are all of the JNDI names registered:

             

            06:37:23,243 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-2) JNDI bindings for session bean name

            d HelloBean in deployment unit subdeployment "ClusterTestEJB.jar" of deployment "ClusterTest.ear" are as follows:

             

             

                    java:global/ClusterTest/ClusterTestEJB/HelloBean!com.sample.HelloBeanItf

                    java:app/ClusterTestEJB/HelloBean!com.sample.HelloBeanItf

                    java:module/HelloBean!com.sample.HelloBeanItf

                    java:jboss/exported/ClusterTest/ClusterTestEJB/HelloBean!com.sample.HelloBeanItf

                    java:global/ClusterTest/ClusterTestEJB/HelloBean

                    java:app/ClusterTestEJB/HelloBean

                    java:module/HelloBean

             

             

            None of which match what I expected to use. Here is the JNDI view from the command line in case it might help:

             

            [standalone@localhost:9999 /] /subsystem=naming:jndi-view()

            {

                "outcome" => "success",

                "result" => {

                    "java: contexts" => {

                        "java:" => {"TransactionManager" => {

                            "class-name" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate",

                            "value" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@a549fd"

                        }},

                        "java:jboss" => {

                            "TransactionManager" => {

                                "class-name" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate",

                                "value" => "com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate@a549fd"

                            },

                            "TransactionSynchronizationRegistry" => {

                                "class-name" => "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple",

                                "value" => "com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionSynchronizationRegistryImple@577c62"

                            },

                            "UserTransaction" => {

                                "class-name" => "org.jboss.tm.usertx.client.ServerVMClientUserTransaction",

                                "value" => "org.jboss.tm.usertx.client.ServerVMClientUserTransaction@399e19"

                            },

                            "jaas" => {

                                "class-name" => "com.sun.proxy.$Proxy38",

                                "children" => {

                                    "jboss-ejb-policy" => {

                                        "class-name" => "org.jboss.as.security.plugins.SecurityDomainContext",

                                        "value" => "org.jboss.security.authentication.JBossCachedAuthenticationManager@4190c1"

                                    },

                                    "other" => {

                                        "class-name" => "org.jboss.as.security.plugins.SecurityDomainContext",

                                        "value" => "org.jboss.security.authentication.JBossCachedAuthenticationManager@8689b4"

                                    },

                                    "jboss-web-policy" => {

                                        "class-name" => "org.jboss.as.security.plugins.SecurityDomainContext",

                                        "value" => "org.jboss.security.authentication.JBossCachedAuthenticationManager@baa777"

                                    }

                                }

                            },

                            "mail" => {

                                "class-name" => "javax.naming.Context",

                                "children" => {"Default" => {

                                    "class-name" => "javax.mail.Session",

                                    "value" => "javax.mail.Session@6abeb4"

                                }}

                            },

                            "datasources" => {

                                "class-name" => "javax.naming.Context",

                                "children" => {"ExampleDS" => {

                                    "class-name" => "org.jboss.jca.adapters.jdbc.WrapperDataSource",

                                    "value" => "org.jboss.jca.adapters.jdbc.WrapperDataSource@e3b6f"

                                }}

                            },

                            "infinispan" => {

                                "class-name" => "javax.naming.Context",

                                "children" => {

                                    "cache" => {

                                        "class-name" => "javax.naming.Context",

                                        "children" => {

                                            "ejb" => {

                                                "class-name" => "javax.naming.Context",

                                                "children" => {

                                                    "remote-connector-client-mappings" => {

                                                        "class-name" => "org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager$DelegatingCache",

                                                        "value" => "Cache 'remote-connector-client-mappings'@node1/ejb"

                                                    },

                                                    "repl" => {

                                                        "class-name" => "org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager$DelegatingCache",

                                                        "value" => "Cache 'repl'@node1/ejb"

                                                    }

                                                }

                                            },

                                            "web" => {

                                                "class-name" => "javax.naming.Context",

                                                "children" => {"repl" => {

                                                    "class-name" => "org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager$DelegatingCache",

                                                    "value" => "Cache 'repl'@node1/web"

                                                }}

                                            }

                                        }

                                    },

                                    "container" => {

                                        "class-name" => "javax.naming.Context",

                                        "children" => {

                                            "ejb" => {

                                                "class-name" => "org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager",

                                                "value" => "ejb"

                                            },

                                            "web" => {

                                                "class-name" => "org.jboss.as.clustering.infinispan.DefaultEmbeddedCacheManager",

                                                "value" => "web"

                                            }

                                        }

                                    }

                                }

                            },

                            "exported" => {

                                "class-name" => "javax.naming.Context",

                                "value" => "org.jboss.as.naming.WritableServiceBasedNamingStore@3542ef"

                            }

                        },

                        "java:global" => {"ClusterTest" => {

                            "class-name" => "javax.naming.Context",

                            "children" => {"ClusterTestEJB" => {

                                "class-name" => "javax.naming.Context",

                                "children" => undefined

                            }}

                        }}

                    },

                    "applications" => {

                        "ClusterWebApp.war" => {

                            "java:app" => {

                                "AppName" => {

                                    "class-name" => "java.lang.String",

                                    "value" => "ClusterWebApp"

                                },

                                "env" => {

                                    "class-name" => "org.jboss.as.naming.NamingContext",

                                    "children" => undefined

                                }

                            },

                            "modules" => undefined

                        },

                        "ClusterTest.ear" => {

                            "java:app" => {

                                "AppName" => {

                                    "class-name" => "java.lang.String",

                                    "value" => "ClusterTest"

                                },

                                "env" => {

                                    "class-name" => "org.jboss.as.naming.NamingContext",

                                    "children" => undefined

                                },

                                "ClusterTestEJB" => {

                                    "class-name" => "javax.naming.Context",

                                    "children" => undefined

                                }

                            },

                            "modules" => undefined

                        }

                    }

                }

            }

            • 3. Re: JBoss Cluster EJB Remoting Issue
              Shawn Yarnell Newbie

              So I believe part of the issue stemmed from using JBoss 7.1.1. I am now using a 7.1.3 build, and the exact same setup with the same .ear executes the EJB. I have changed the client code to the following as well:

               

              import java.util.Properties;
              
              
              import javax.naming.Context;
              import javax.naming.InitialContext;
              import javax.naming.NamingException;
              
              
              import org.jboss.naming.remote.client.InitialContextFactory;
              
              
              import com.sample.HelloBeanItf;
              
              
              public class Client {
                public static void main(String[] args) {
              
              
                Properties p = new Properties();
                p.put(Context.INITIAL_CONTEXT_FACTORY,
                InitialContextFactory.class.getName());
                p.put("jboss.naming.client.ejb.context", true);
                p.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
                p.put(Context.SECURITY_PRINCIPAL, "user");
                p.put(Context.SECURITY_CREDENTIALS, "password");
                p.put(Context.PROVIDER_URL, "remote://node1:4447");
                InitialContext ctx;
                try {
                ctx = new InitialContext(p);
                } catch (NamingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return;
                }
              
              
                HelloBeanItf ejb = null;
                try {
                ejb = (HelloBeanItf) ctx
                .lookup("ejb:ClusterTest/ClusterTestEJB//HelloBean!com.sample.HelloBeanItf");
                } catch (NamingException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                return;
                }
              
              
                sleep(3000);
              
              
                for (int ii = 0; ii < 10; ii++) {
                sleep(10);
                System.out.println(ejb.doSomething() + " i = " + ii);
                }
                System.out.println("Terminated");
                }
              
              
                private static void sleep(int x) {
                try {
                Thread.sleep(x);
                } catch (InterruptedException e) {
                e.printStackTrace();
                }
              
              
              

               

              This code executes the bean, but still gives the following exception:

               

              java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed

                at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:91)

                at org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:117)

                at org.jboss.ejb.client.ClusterContext$EJBReceiverAssociationTask.run(ClusterContext.java:333)

                at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)

                at java.util.concurrent.FutureTask.run(Unknown Source)

                at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

                at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

                at java.lang.Thread.run(Unknown Source)

              Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed

                at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:365)

                at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:214)

                at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)

                at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)

                at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)

                at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)

                at org.xnio.nio.NioHandle.run(NioHandle.java:90)

                at org.xnio.nio.WorkerThread.run(WorkerThread.java:184)

                at ...asynchronous invocation...(Unknown Source)

                at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)

                at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)

                at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)

                at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)

                at org.jboss.ejb.client.remoting.RemotingConnectionClusterNodeManager.getEJBReceiver(RemotingConnectionClusterNodeManager.java:115)

                ... 6 more

               

              However, EJB execution is successful. I have seen this mentioned in another discussion I believe, but there was no clear answer. What could be causing this?

              • 4. Re: JBoss Cluster EJB Remoting Issue
                Wolf-Dieter Fink Master

                You should not mix different approaches to invoke EJB's

                 

                If you use "remote://*" this is remote naming and you can not use the "ejb:" prefix for lookup, see Remote EJB invocations via JNDI

                If you use the ejb: prefix you need to use ejb-client.

                 

                As you try to use a Cluster you must use the ejb-client approach as remote-naming will not fully support it.

                See EJB invocations from a remote client using JNDI

                1 of 1 people found this helpful
                • 5. Re: JBoss Cluster EJB Remoting Issue
                  Shawn Yarnell Newbie

                  Ok, so that cleared up one bit of confusion. Thanks for the response.

                   

                  Your response leads me to another question:

                   

                  Is it possible to use ejb-client while setting the node(s) programmatically? In Remote EJB invocations via JNDI the writer mentions that starting again in JBoss 7.2 you can provide a comma separated list to the PROVIDER_URL. I am trying to solve the issue of HA where the clusters dynamically changing IP addresses if added/removed/restarted. If I provide customers with just one IP address and that machine is down, the application will not be able to connect to the cluster. Setting the nodes programmatically could potentially help to solve my problem.

                   

                  Also, when you say:

                  As you try to use a Cluster you must use the ejb-client approach as remote-naming will not fully support it.

                  What do you mean "not fully"? Will it do round-robin for the different nodes? The link provided does not mention clustering.

                   

                  Lastly, even when shifting everything to jboss-ejb-client.properties file, I still get the SASL error. Any idea why that would be coming?

                   

                  remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false

                  remote.connections=node1

                  remote.connection.node1.host=node1

                  remote.connection.node1.port = 4447

                  remote.connection.node1.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false

                  remote.connection.node1.username=user

                  remote.connection.node1.password=password

                   

                   

                  And the only thing I am setting in the client code now is

                   

                  p.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
                  
                  
                  

                   

                  Thanks.

                  • 6. Re: JBoss Cluster EJB Remoting Issue
                    Wolf-Dieter Fink Master

                    remote-naming does not allow full control of the ejb-client configuration, you might add a , separated list of servers but there is no loadbalancing.

                    Also if you reach a cluster you can not set the according information for the cluster and that might show errors/warnings in your logfile that such connection can not be established.

                     

                    To see how the client works in general you might have a look to ejb-remote quickstart, a programatic approach is shown in ejb-multi-server. Also it is possible to use a scoped-context, see documentation.

                     

                    But I would use simple approach by using the jboss-ejb-client.properties you migth add more connections by set remote-connections=node1,node2.node3 and add the properties for each. Also you need to add the remote.clusters=ejb configuration and properites, you'll find examples if you search for it.

                     

                    For the SASL problem I suppose that you have not add the appropriate user to the server, here the quickstart might help also.

                    • 7. Re: JBoss Cluster EJB Remoting Issue
                      Shawn Yarnell Newbie

                      I am not sure of which "quickstart" you are referencing, but I have definitely read multiple documents that discuss how you have to add the user using the script in /bin to the ApplicationRealm for the remote client to log on. Also, since execution of the EJB is successful, I believe logon is also successful.

                       

                      Another thing is that with the SASL exception, control is not returned to my code. It is just written to the log. If it was not written to the log, it would appear from client side that the login was successful, as the EJB executes as expected.

                       

                      Is this expected behavior? I feel like the SASL exception may just be something that was not meant to be logged at the error level.

                      • 9. Re: JBoss Cluster EJB Remoting Issue
                        Wolf-Dieter Fink Master

                        Ok, than I think I've missunderstood

                        If the application client works as expected you might run into an issue with the clustering (if you remove @Clustered the Exception is gone)

                        In that case you need to add the cluster configuration:

                         

                        remote.clusters=ejb

                        remote.cluster.ejb.username=

                        remote.cluster.ejb.password=

                        remote.cluster.ejb.connect.*  >>>> the same options as you use for the initial connection

                        • 10. Re: JBoss Cluster EJB Remoting Issue
                          Shawn Yarnell Newbie

                          The clustering properties in the properties file is exactly what I needed.

                           

                          Thanks for your help!

                           

                          In my attempt to find more information on all properties available for the ejb-client properties file, I came across a JIRA filed to make this less complicated. I definitely agree that there is more here than needs to be.

                           

                          Is there documentation on all the properties available to use the ejb-client?

                           

                          Thanks again for your help!

                          • 11. Re: JBoss Cluster EJB Remoting Issue
                            Wolf-Dieter Fink Master

                            Do you vote for EJBCLIENT-47, you should to bring that to more importance

                             

                            You'll find some properties here, but there is no complete overview as you can pass xnio and remoting options through the ejb-client (*.connect.options.*) and these options depend on the underlying libraries.