Creating multiple instance of one EJB-Class causes "No EJB receiver available"-Exception
goot Sep 3, 2013 6:22 AMI have a Tomcat running on the frontend side while my EJBs are running on a JBoss AS 7.1
My (stateful) EJB Class is not annotated as a singleton.
Anyway, when I try to lookup two EJBs at the same time, I receive an exception message about a missing EJB receiver.
I need to provide this EJB for dozens of users at the same time.
When I restart the Tomcat user, I can call the EJBs again, maybe this happens because the ejb-user is already logged in to the JBoss?
Is there anything I can do to avoid this error?
WARN : org.jboss.ejb.client.remoting.ChannelAssociation - Unsupported message received with header 0xffffffff Looking EJB via JNDI hi there, I'm a bean! Looking EJB via JNDI WARN : org.jboss.ejb.client.remoting.ChannelAssociation - Unsupported message received with header 0xffffffff javax.naming.NamingException: Failed to create proxy [Root exception is java.lang.IllegalStateException: No EJB receiver available for handling [appName:foo_business_ear-ear,modulename:foo_business_ear-ejb,distinctname:] combination] at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:115) at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:96) at javax.naming.InitialContext.lookup(Unknown Source) at foo.frontend.controller.UserController.logIn(UserController.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:789) at javax.servlet.http.HttpServlet.service(HttpServlet.java:641) at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) 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: java.lang.IllegalStateException: No EJB receiver available for handling [appName:foo_business_ear-ear,modulename:foo_business_ear-ejb,distinctname:] combination at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:517) at org.jboss.ejb.client.EJBClient.createSession(EJBClient.java:161) at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:135) at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:113) ... 35 more
EDIT:
I just shutdown my tomcat and Jboss returned the following info in the log
15:07:07,436 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 33e234dd (inbound) of Remoting connection 18dc0e9b to /127.0.0.1:57933 15:15:13,892 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 39f241ee (inbound) of Remoting connection 31360c30 to /127.0.0.1:57939 20:50:00,877 ERROR [org.jboss.remoting.remote.connection] (Remoting "goot_acer" read-1) JBREM000200: Remote connection failed: java.io.IOException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen (Existing connection with remote host was closed) 20:50:00,878 ERROR [org.jboss.remoting.remote.connection] (Remoting "goot_acer" read-1) JBREM000200: Remote connection failed: java.io.IOException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen (Existing connection with remote host was closed) 20:50:00,879 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-4) JBAS011806: Channel end notification received, closing channel Channel ID 2c7127a9 (inbound) of Remoting connection 4f086115 to null 20:50:00,880 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-1) JBAS011806: Channel end notification received, closing channel Channel ID 77f38359 (inbound) of Remoting connection 77f8a1af to null 21:42:49,392 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-3) JBAS011806: Channel end notification received, closing channel Channel ID 7e3f2867 (inbound) of Remoting connection 35de82e9 to null 21:52:19,986 ERROR [org.jboss.remoting.remote.connection] (Remoting "goot_acer" read-1) JBREM000200: Remote connection failed: java.io.IOException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen (Existing connection with remote host was closed) 21:52:19,991 ERROR [org.jboss.remoting.remote.connection] (Remoting "goot_acer" read-1) JBREM000200: Remote connection failed: java.io.IOException: Eine vorhandene Verbindung wurde vom Remotehost geschlossen (Existing connection with remote host was closed) 21:52:19,993 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-1) JBAS011806: Channel end notification received, closing channel Channel ID 15f38b65 (inbound) of Remoting connection 37b05625 to null 21:52:19,996 INFO [org.jboss.as.naming] (Remoting "goot_acer" task-4) JBAS011806: Channel end notification received, closing channel Channel ID 3f1c7ecc (inbound) of Remoting connection 5e5be8a3 to null
EDIT: This is my lookup Code
final Properties initialContextProperties = new Properties(); initialContextProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); initialContextProperties.put(Context.PROVIDER_URL, "remote://localhost:4447"); initialContextProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); initialContextProperties.put("jboss.naming.client.ejb.context","true"); initialContextProperties .put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); initialContextProperties.put(Context.SECURITY_PRINCIPAL, "username"); initialContextProperties.put(Context.SECURITY_CREDENTIALS, "password"); EJBClientConfiguration cc = new PropertiesBasedEJBClientConfiguration( initialContextProperties); ContextSelector<EJBClientContext> selector = new ConfigBasedEJBClientContextSelector( cc); EJBClientContext.setSelector(selector); context = new InitialContext(initialContextProperties); System.out.println("Looking EJB via JNDI "); String typeOfEJB = "stateful"; remote = (LoginBeanRemote) context .lookup("ejb:foo_business_ear-ear/foo_business_ear-ejb//LoginBean!foo.business.login.LoginBeanRemote" + "?" + typeOfEJB); System.out.println(remote.helloBean());