1 Reply Latest reply on Jul 22, 2013 2:45 PM by Wolf-Dieter Fink

    No such EJB

    kushal aswani Newbie

      I'm writing an application with EJB and JPA.

      I have different API's user, order, payment, service, etc. when I do JUnit testing other API's are working fine but Payment  API is showing an error No Such EJB.

      public class Platformusecasev2 extends TestCase {

                private ConsumerRemote consumerRemote = null;

                private AuthorizeRemote authRemote = null;

                private OrderRemote orderRemote = null;

                private ProvisionRemote provisionRemote = null;

                private ProductRemote productRemote = null;

                private PaymentRemote paymentRemote = null;

       

       

                public void test() throws Exception {

                          // Grab handle to Data Access Bean

                          Properties env = new Properties();

       

       

                          env.setProperty(Context.PROVIDER_URL, "localhost:24447");

                          env.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

                          env.setProperty(Context.SECURITY_PRINCIPAL, "guest1");

                          env.setProperty(Context.SECURITY_CREDENTIALS, "password");

                          InitialContext jndiContext = new InitialContext(env);

       

       

                          consumerRemote = (ConsumerRemote) jndiContext.lookup("ejb:PlatformEAR/PlatformBase//ConsumerBase!com.readywireless.platform.base.consumer.v2.ConsumerRemote");

                          authRemote = (AuthorizeRemote) jndiContext.lookup("ejb:PlatformEAR/PlatformBase//Authorize!com.readywireless.platform.base.authentication.v2.AuthorizeRemote");

                          orderRemote = (OrderRemote) jndiContext.lookup("ejb:PlatformEAR/PlatformBase//OrderBase!com.readywireless.platform.base.order.v2.OrderRemote");

                          provisionRemote = (ProvisionRemote) jndiContext.lookup("ejb:PlatformEAR/PlatformBase//ProvisionBase!com.readywireless.platform.base.provision.v2.ProvisionRemote");

                          productRemote = (ProductRemote) jndiContext.lookup("ejb:PlatformEAR/PlatformBase//ProductBase!com.readywireless.platform.base.product.v2.ProductRemote");

                          paymentRemote = (PaymentRemote)  jndiContext.lookup("ejb:PlatformEAR/PlatformBase//PaymmentBaseV3!com.readywireless.platform.base.payment.v3.PaymentRemote");

       

                          // needed for remote access - remember to run add-user.bat

                          env.put(Context.SECURITY_PRINCIPAL, "client");

                          env.put(Context.SECURITY_CREDENTIALS, "password");

       

       

                          // Init Request Header

                          HeaderRequestEx headReq = new HeaderRequestEx();

                          headReq.setGUID("d8f8b7b6-ca70-3ada-a0b8-394b82bf68");

                          headReq.setMessageID("1234");

                          headReq.setAccountID("18");

                          headReq.setClientID("2");

       

       

                          RWSession session = authRemote.authenticate(headReq);

                          int tst = 1;

                          switch (tst) {

                          case 1:

                                    // scenario Customer with existing customerId

        GetConsumerAccountsLookup(session);

                                    AuthenticateConsumerAccount(session);

                                    BuildNewOrder(session);

                                    GetProducts(session);

                                    AddOrderDevice(session);

                                    AddPaymentProfiles(session);

                                   GetOrderQuote(session);

                                   AuthorizePaymentProfile(session);

                                    PlaceOrder(session);

                          break;

                          default:

                          }

                }

       

       

      Jul 22, 2013 9:48:01 AM org.jboss.ejb.client.EJBClient <clinit>

      INFO: JBoss EJB Client version 1.0.21.Final-redhat-1

      Jul 22, 2013 9:48:01 AM org.xnio.Xnio <clinit>

      INFO: XNIO Version 3.0.7.GA-redhat-1

      Jul 22, 2013 9:48:01 AM org.xnio.nio.NioXnio <clinit>

      INFO: XNIO NIO Implementation Version 3.0.7.GA-redhat-1

      Jul 22, 2013 9:48:01 AM org.jboss.remoting3.EndpointImpl <clinit>

      INFO: JBoss Remoting version 3.2.16.GA-redhat-1

      Jul 22, 2013 9:48:02 AM org.jboss.ejb.client.remoting.VersionReceiver handleMessage

      INFO: EJBCLIENT000017: Received server version 1 and marshalling strategies [river]

      Jul 22, 2013 9:48:02 AM org.jboss.ejb.client.remoting.RemotingConnectionEJBReceiver associate

      INFO: EJBCLIENT000013: Successful version handshake completed for receiver context EJBReceiverContext{clientContext=org.jboss.ejb.client.EJBClientContext@2339e351, receiver=Remoting connection EJB receiver [connection=org.jboss.ejb.client.remoting.ConnectionPool$PooledConnection@18987a33,channel=jboss.ejb,nodename=tempdevelop2-pc]} on channel Channel ID e015b55e (outbound) of Remoting connection 309ff0a8 to localhost/127.0.0.1:24447

      Jul 22, 2013 9:48:02 AM org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler processMessage

      INFO: Retrying invocation which failed on node tempdevelop2-pc with exception:

      javax.ejb.NoSuchEJBException: No such EJB[appname=PlatformEAR,modulename=PlatformBase,distinctname=,beanname=PaymmentBaseV3]

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

                at org.jboss.ejb.client.remoting.ChannelAssociation.processResponse(ChannelAssociation.java:366)

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

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

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

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

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

       

       

       

      java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:PlatformEAR, moduleName:PlatformBase, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@38c52200

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

                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.EJBClientInvocationContext.retryRequest(EJBClientInvocationContext.java:208)

                at org.jboss.ejb.client.EJBReceiverInvocationContext.retryInvocation(EJBReceiverInvocationContext.java:95)

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

                at org.jboss.ejb.client.remoting.ChannelAssociation.processResponse(ChannelAssociation.java:366)

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

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

                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)

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

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

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

                at org.jboss.ejb.client.remoting.NoSuchEJBExceptionResponseHandler$ResultProducer.getResult(NoSuchEJBExceptionResponseHandler.java:101)

                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:272)

                at org.jboss.ejb.client.EJBObjectInterceptor.handleInvocationResult(EJBObjectInterceptor.java:64)

                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:274)

                at org.jboss.ejb.client.EJBHomeInterceptor.handleInvocationResult(EJBHomeInterceptor.java:88)

                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:274)

                at org.jboss.ejb.client.TransactionInterceptor.handleInvocationResult(TransactionInterceptor.java:46)

                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:274)

                at org.jboss.ejb.client.ReceiverInterceptor.handleInvocationResult(ReceiverInterceptor.java:129)

                at org.jboss.ejb.client.EJBClientInvocationContext.getResult(EJBClientInvocationContext.java:262)

                at org.jboss.ejb.client.EJBClientInvocationContext.awaitResponse(EJBClientInvocationContext.java:437)

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

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

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

                at com.sun.proxy.$Proxy5.addPaymentProfile(Unknown Source)

                at com.readywireless.testing.Platformusecasev2.AddPaymentProfiles(Platformusecasev2.java:240)

                at com.readywireless.testing.Platformusecasev2.test(Platformusecasev2.java:101)

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at junit.framework.TestCase.runTest(TestCase.java:168)

                at junit.framework.TestCase.runBare(TestCase.java:134)

                at junit.framework.TestResult$1.protect(TestResult.java:110)

                at junit.framework.TestResult.runProtected(TestResult.java:128)

                at junit.framework.TestResult.run(TestResult.java:113)

                at junit.framework.TestCase.run(TestCase.java:124)

                at junit.framework.TestSuite.runTest(TestSuite.java:243)

                at junit.framework.TestSuite.run(TestSuite.java:238)

                at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)

                at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

                at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

        • 1. Re: No such EJB
          Wolf-Dieter Fink Master

          Looks like a wild mix of remote-naming and ejb-client.

          If you want to use remote-naming the PROVIDER_URL should look "remote://host:port", but it is not recommended to use.

          Also you can not change the credentials after the IC is created, this might not take effect.

           

          Read the ejb-client documentation how to connect to the server. If you prefere a property less approach you might use scoped-context, but you need to use EAP6.1/AS7.2 or WildFly then.