1 2 Previous Next 17 Replies Latest reply on Dec 7, 2012 2:39 AM by rodakr

    Jboss 7 ejb remote client lookup

    ashvish Newbie

      I have a sample ejb3 deployed in the standalone\deployments folder. This is what I see in the console;

       

      java:global/example/CalculatorBean!com.avn.slsb.CalculatorRemote

      java:app/example/CalculatorBean!com.avn.slsb.CalculatorRemote

      java:module/CalculatorBean!com.avn.slsb.CalculatorRemote

      java:global/example/CalculatorBean

      java:app/example/CalculatorBean

      java:module/CalculatorBean

       

      I have created a simple java client to do a remote lookup by following the steps mentioned at https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI. However I am still not sure what JNDI name to use. If I do the lookup with "ejb:example//CalculatorBean!com.avn.slsb.CalculatorRemote" I get the exception java.lang.IllegalStateException: No EJB receiver available for handling [appName:example,modulename:,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1424bf0. If I use "example//CalculatorBean!com.avn.slsb.CalculatorRemote" I get the javax.naming.NameNotFoundException. Using "ejb:example/CalculatorBean!com.avn.slsb.CalculatorRemote" gives java.lang.ClassCastException: org.jboss.ejb.client.naming.ejb.EjbNamingContext cannot be cast to com.avn.slsb.CalculatorRemote. Could any one give me the correct name to lookup?

        • 1. Re: Jboss 7 ejb remote client lookup
          jaikiran pai Master

          ashvish V wrote:

           

          If I do the lookup with "ejb:example//CalculatorBean!com.avn.slsb.CalculatorRemote" I get the exception java.lang.IllegalStateException: No EJB receiver available for handling [appName:example,modulename:,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@1424bf0.

          You have a typo there. It should be:

           

          ejb:/example//CalculatorBean!com.avn.slsb.CalculatorRemote

          • 2. Re: Jboss 7 ejb remote client lookup
            ashvish Newbie

            I changed as you suggested and get the exception given below

             

            javax.ejb.NoSuchEJBException: No such EJB[appname=,modulename=example,distinctname=,beanname=CalculatorBean,viewclassname=com.avn.slsb.CalculatorRemote]

                      at org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler.processMessage(NoSuchEJBExceptionResponseHandler.java:64)

                      at org.jboss.ejb.client.remoting.ChannelAssociation$ResponseReceiver.handleMessage(ChannelAssociation.java:395)

                      at org.jboss.remoting3.remote.RemoteConnectionChannel$5.run(RemoteConnectionChannel.java:437)

                      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)

                      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)

                      at java.lang.Thread.run(Thread.java:722)

            • 3. Re: Jboss 7 ejb remote client lookup
              jaikiran pai Master

              Is CalculatorRemote really a remote interface? What does the bean and the interface code look like, including the annotations?

              • 4. Re: Jboss 7 ejb remote client lookup
                ashvish Newbie

                @javax.ejb.Remote

                public interface CalculatorRemote {

                 

                    public float add(float x, float y);

                    public float subtract(float x, float y);

                    public float multiply(float x, float y);

                    public float division(float x, float y);

                   

                }

                 

                @Stateless(name="CalculatorBean")

                @Remote(CalculatorRemote.class)

                @RemoteBinding(jndiBinding="CalculatorBeanJNDI")

                public class CalculatorBean implements CalculatorRemote{

                   

                    public float add(float x, float y) {

                        return x + y;

                    }

                 

                 

                    public float subtract(float x, float y) {

                        return x - y;

                    }

                 

                 

                    public float multiply(float x, float y) {

                        return x * y;

                    }

                 

                 

                    public float division(float x, float y) {

                        return x / y;

                    }

                }

                • 5. Re: Jboss 7 ejb remote client lookup
                  Nicklas Karlsson Master

                  Do you really need that much annotations? Tried just a @Remote on the interface and then plain @Stateless on the Calculcator implements CalculatorRemote?

                  • 6. Re: Jboss 7 ejb remote client lookup
                    jaikiran pai Master

                    I don't see a reason why that would fail, unless ofcourse your client classpath is missing the jboss-ejb-client.properties.

                     

                    By the way, @RemoteBinding which was a JBoss specific annotation is no longer supported in AS7.

                    • 7. Re: Jboss 7 ejb remote client lookup
                      ashvish Newbie

                      I have added jboss-ejb-client.properties to the client classpath

                       

                      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 = 4447

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

                      remote.connection.default.username=somename

                      remote.connection.default.password=somepassword

                      • 9. Re: Jboss 7 ejb remote client lookup
                        jaikiran pai Master

                        Please enable TRACE level logs of org.jboss.ejb.client package on the client side and post/attach the output here.

                        • 10. Re: Jboss 7 ejb remote client lookup
                          Christophe Fillot Newbie

                          It looks strange that you don't have any mapping prefixed by "java:jboss/exported/" , if I'm correct, the remote lookup will only work for objects with this prefix.

                          • 11. Re: Jboss 7 ejb remote client lookup
                            ashvish Newbie

                            Hello,

                             

                            I have deployed a sample application (downloaded from the net) and deployed as it is. This is what I see in the jboss console;

                             

                            java:global/example/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

                                java:app/example/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

                                java:module/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

                               java:jboss/exported/example/CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote

                                java:global/example/CalculatorBean

                                java:app/example/CalculatorBean

                                java:module/CalculatorBean

                             

                            As you said there is a mapping prefixed with "java:jboss/exported/". But I am still getting the remote client look up error. I cannot understand why the people at JBoss has made things a lot more complicated rather than simplifying it. I have am doing the look up as ejb:example//CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote. The exception stack trace is

                             

                            java.lang.IllegalStateException: No EJB receiver available for handling [appName:example,modulename:,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@b9e55c

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

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

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

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

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

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

                                      at $Proxy0.multiply(Unknown Source)

                                      at com.avn.utils.EjbLookup.main(EjbLookup.java:26)

                             

                            Could someone tell me what this is all about?


                            • 12. Re: Jboss 7 ejb remote client lookup
                              ashvish Newbie

                              Just giving example//CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote withouth the prefix "ejb:" worked which is even more confusing.

                              • 13. Re: Jboss 7 ejb remote client lookup
                                jaikiran pai Master

                                Like I said earlier:

                                 

                                Please enable TRACE level logs of org.jboss.ejb.client package on the client side and post/attach the output here.

                                • 14. Re: Jboss 7 ejb remote client lookup
                                  jaikiran pai Master

                                  ashvish V wrote:

                                   

                                  Just giving example//CalculatorBean!com.javajazzup.examples.ejb3.stateless.CalculatorRemote withouth the prefix "ejb:" worked which is even more confusing.

                                  See this https://docs.jboss.org/author/display/AS71/Remote+EJB+invocations+via+JNDI+-+EJB+client+API+or+remote-naming+project

                                  1 2 Previous Next