7 Replies Latest reply on May 30, 2014 5:45 AM by wdfink

    wildfly invok ejb error: EJBCLIENT000025

    wuqian2huangchangsong

      Hi,

           I got the code in wildfly web.and deploy it to the server.

      09:57:28,871 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named CalculatorBean in deployment unit deployment "wildflyejb3.jar" are as follows:
      
          java:global/wildflyejb3/CalculatorBean!com.imagin.stateless.RemoteCalculator
          java:app/wildflyejb3/CalculatorBean!com.imagin.stateless.RemoteCalculator
          java:module/CalculatorBean!com.imagin.stateless.RemoteCalculator
          java:jboss/exported/wildflyejb3/CalculatorBean!com.imagin.stateless.RemoteCalculator
          java:global/wildflyejb3/CalculatorBean
          java:app/wildflyejb3/CalculatorBean
          java:module/CalculatorBean
      
      09:57:28,872 INFO  [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-7) JNDI bindings for session bean named CounterBean in deployment unit deployment "wildflyejb3.jar" are as follows:
      
          java:global/wildflyejb3/CounterBean!com.imagin.stateful.RemoteCounter
          java:app/wildflyejb3/CounterBean!com.imagin.stateful.RemoteCounter
          java:module/CounterBean!com.imagin.stateful.RemoteCounter
          java:jboss/exported/wildflyejb3/CounterBean!com.imagin.stateful.RemoteCounter
          java:global/wildflyejb3/CounterBean
          java:app/wildflyejb3/CounterBean
          java:module/CounterBean
      

       

           Then I got  the  client code,and jboss-ejb-client.properties

      endpoint.name=client-endpoint
      remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
      
      remote.connections=default
      
      remote.connection.default.host=localhost
      remote.connection.default.port = 8080
      remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
      
      remote.connection.default.username=wuqian@hcs
      remote.connection.default.password=wuqian@891210
      

           the dir is:

           client

                |--Client.java

                |--jboss-ejb-client.properties

       

      but when I run the client it is error:

      五月 28, 2014 10:03:07 上午 org.jboss.ejb.client.EJBClient <clinit>
      INFO: JBoss EJB Client version 2.0.0.Final
      Obtained a remote stateless calculator for invocation
      Adding 204 and 340 via the remote stateless calculator deployed on the server
      Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:wildflyejb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@32535e27
          at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:749)
          at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)
          at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)
          at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253)
          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)
          at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)
          at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)
          at com.sun.proxy.$Proxy0.add(Unknown Source)
          at remoteClient.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:38)
          at remoteClient.RemoteEJBClient.main(RemoteEJBClient.java:19)
      

       

      what can I do? thanks!

        • 1. Re: wildfly invok ejb error: EJBCLIENT000025
          jaikiran

          You are using a wrong JNDI name in your client code which does the lookup. The JNDI bindings show that the module name is wildflyejb3 whereas you are using wildflyejb as the module name during the lookup (that's what the stacktrace suggests).

          • 2. Re: wildfly invok ejb error: EJBCLIENT000025
            wuqian2huangchangsong

            Thanks.It is an error.and I user the "wildflyejb3",the error can not be fixed. Sorry for my English.

            五月 29, 2014 6:03:01 下午 org.jboss.ejb.client.EJBClient <clinit>

            INFO: JBoss EJB Client version 2.0.0.Final

            Obtained a remote stateless calculator for invocation

            Adding 204 and 340 via the remote stateless calculator deployed on the server

            Exception in thread "main" java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:, moduleName:wildflyejb3, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@3c44899b

                at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:749)

                at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116)

                at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183)

                at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253)

                at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198)

                at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181)

                at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144)

                at com.sun.proxy.$Proxy0.add(Unknown Source)

                at remoteClient.RemoteEJBClient.invokeStatelessBean(RemoteEJBClient.java:46)

                at remoteClient.RemoteEJBClient.main(RemoteEJBClient.java:27)

             

            I dot know why?but thanks!

            • 3. Re: wildfly invok ejb error: EJBCLIENT000025
              wdfink

              I don't see the client code in your post.

              Also how do you start the server?

              • 4. Re: wildfly invok ejb error: EJBCLIENT000025
                wuqian2huangchangsong

                thanks! I have fixed it.

                but I not know why?

                my client code is the jboss web code:

                public class RemoteEJBClient {

                    public static void main(String[] args) throws Exception {

                        invokeStatelessBean();

                        invokeStatefulBean();

                    }

                 

                    private static void invokeStatelessBean() throws NamingException {

                        final RemoteCalculator statelessRemoteCalculator = lookupRemoteStatelessCalculator();

                        System.out.println("Obtained a remote stateless calculator for invocation");

                        int a = 204;

                        int b = 340;

                        System.out.println("Adding " + a + " and " + b + " via the remote stateless calculator deployed on the server");

                        int sum = statelessRemoteCalculator.add(a, b);

                        System.out.println("Remote calculator returned sum = " + sum);

                        if (sum != a + b) {

                            throw new RuntimeException("Remote stateless calculator returned an incorrect sum " + sum + " ,expected sum was " + (a + b));

                        }

                        int num1 = 3434;

                        int num2 = 2332;

                        System.out.println("Subtracting " + num2 + " from " + num1 + " via the remote stateless calculator deployed on the server");

                        int difference = statelessRemoteCalculator.subtract(num1, num2);

                        System.out.println("Remote calculator returned difference = " + difference);

                        if (difference != num1 - num2) {

                            throw new RuntimeException("Remote stateless calculator returned an incorrect difference " + difference + " ,expected difference was " + (num1 - num2));

                        }

                    }

                 

                    private static void invokeStatefulBean() throws NamingException {

                        final RemoteCounter statefulRemoteCounter = lookupRemoteStatefulCounter();

                        System.out.println("Obtained a remote stateful counter for invocation");

                        final int NUM_TIMES = 20;

                        System.out.println("Counter will now be incremented " + NUM_TIMES + " times");

                        for (int i = 0; i < NUM_TIMES; i++) {

                            System.out.println("Incrementing counter");

                            statefulRemoteCounter.increment();

                            System.out.println("Count after increment is " + statefulRemoteCounter.getCount());

                        }

                        System.out.println("Counter will now be decremented " + NUM_TIMES + " times");

                        for (int i = NUM_TIMES; i > 0; i--) {

                            System.out.println("Decrementing counter");

                            statefulRemoteCounter.decrement();

                            System.out.println("Count after decrement is " + statefulRemoteCounter.getCount());

                        }

                    }

                 

                    private static RemoteCalculator lookupRemoteStatelessCalculator() throws NamingException {

                       final Hashtable jndiProperties = new Hashtable();

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

                        final Context context = new InitialContext(jndiProperties);

                        final String appName = "";

                        final String moduleName = "jboss-as-ejb-remote-app";

                        final String distinctName = "";

                        final String beanName = CalculatorBean.class.getSimpleName();

                        final String viewClassName = RemoteCalculator.class.getName();

                        return (RemoteCalculator) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName);

                    }

                 

                    private static RemoteCounter lookupRemoteStatefulCounter() throws NamingException {

                        final Hashtable jndiProperties = new Hashtable();

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

                        final Context context = new InitialContext(jndiProperties);

                        final String appName = "";

                        final String moduleName = "jboss-as-ejb-remote-app";

                        final String distinctName = "";

                        final String beanName = CounterBean.class.getSimpleName();

                        final String viewClassName = RemoteCounter.class.getName();

                        return (RemoteCounter) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName + "?stateful");

                    }

                }

                 

                and I delete the jboss-ejb-client.properties

                change the Underline code:  --------------------it work!

                Properties clientProperties = new Properties();

                        clientProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");

                        clientProperties.put("remote.connections", "default");

                        clientProperties.put("remote.connection.default.port", "8080");

                        clientProperties.put("remote.connection.default.host", "localhost");

                        //clientProperties.put("remote.connection.default.username", "ejb");

                        //clientProperties.put("remote.connection.default.password", "wuqian@891210");

                        clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false");

                        EJBClientContext.setSelector(new ConfigBasedEJBClientContextSelector(new PropertiesBasedEJBClientConfiguration(clientProperties)));

                        Properties properties = new Properties();

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

                        final Context context = new InitialContext(properties);

                user and password are not must!!!

                • 5. Re: wildfly invok ejb error: EJBCLIENT000025
                  wdfink

                  Yes that is a different approach.

                  If oyu use the quickstart as is it should work.

                   

                  As long as you run on the same host and have access to the servers directory the LOCAL option is used for authentication by default.

                  See documentation

                  • 6. Re: wildfly invok ejb error: EJBCLIENT000025
                    wuqian2huangchangsong

                    Thanks very much!

                    But why does not it  work for the "jboss-ejb-client" method?

                    This is my "jboss-ejb-client.properties":  and I take it in the same package with the client class. Sorry for my English -:)

                    1. endpoint.name=client-endpoint 
                    2. remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false 
                    3.  
                    4. remote.connections=default 
                    5.  
                    6. remote.connection.default.host=localhost 
                    7. remote.connection.default.port = 8080 
                    8. remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false 
                    9.  
                    10. remote.connection.default.username=wuqian@hcs 
                    11. remote.connection.default.password=wuqian@891210 
                    • 7. Re: wildfly invok ejb error: EJBCLIENT000025
                      wdfink

                      I think that is your problem.

                      You should not pack the properties in a package, simple use the root directory of the classpath