2 Replies Latest reply on Feb 14, 2012 7:16 AM by Björn Palmqvist

    Spring and ejb problem

    Björn Palmqvist Newbie

      Hi,

       

      We are using spring to lookup remote ejb:s by defining the remote-slsb tag in the spring context. Now when these beans get injected server crashes with a message that no EJB receivers are present. The lookup goes well, but spring closes the context before making the invocation, and hence no ejb context is present, only the default empty one that JBoss seems to provide as default.


       

      I have tried to activate the expose-access-context="true" flag in the slsb definition, but then it seems that the JBoss gets stuck in some type of deadlock or something like that.

       

       

      I have set up the environment the following way in the spring context.

       

      {code:xml}

           <jee:remote-slsb id="securityController" jndi-name="test/remote/MyBean!remote.MyBeanHome"

                business-interface="remote.MyBeanBI"

                home-interface="remote.MyBeanHome"

                cache-home="true" lookup-home-on-startup="false" refresh-home-on-connect-failure="true" environment-ref="jndiProperties">

           </jee:remote-slsb>

      {code}

       

      Where jndiProperties is defined as:

       

      {code:xml}

           <!-- Hack to get the true value as right type -->

           <bean id="trueProvider" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">

                <property name="targetClass" value="java.lang.Boolean" />

                <property name="targetMethod" value="valueOf" />

                <property name="argument" value="true" />

            </bean>

       

           <bean id="jndiProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">

                <property name="properties">

                     <map>

                          <entry key="java.naming.factory.initial" value="org.jboss.naming.remote.client.InitialContextFactory" />

                          <entry key="java.naming.provider.url" value="remote://localhost:4447" />

                          <entry key="jboss.naming.client.endpoint.name" value="JNDI-Endpoint" />

                          <entry key="jboss.naming.client.ejb.context" value-ref="trueProvider" />

                     </map>

                </property>

           </bean>

      {code}

       

      We are running on nightys of the Final version of JBoss, and using spring 3.1.

       

      It feels like I am missing something here. Have anyone had a similar problem and has a solution for this?

       

      BR

      Björn

        • 1. Re: Spring and ejb problem
          jaikiran pai Master

          Björn Palmqvist wrote:

           

          Now when these beans get injected server crashes with a message that no EJB receivers are present.

           

           

          Please post the entire exception stacktrace that you are seeing.

           

           

          Björn Palmqvist wrote:

           

          but then it seems that the JBoss gets stuck in some type of deadlock or something like that.

           

           

          Try and get some thread dumps http://community.jboss.org/wiki/ThreadDump when that happens

          • 2. Re: Spring and ejb problem
            Björn Palmqvist Newbie

            jaikiran pai wrote:

             

            Please post the entire exception stacktrace that you are seeing.

             

            {code}

            12:55:36,817 INFO  [org.jboss.as.naming] (Remoting "ecs" task-1) JBAS011806: Channel end notification received, closing channel Channel ID 1062c452 (inbound) of Remoting connection 3e9a1f5b to /127.0.0.1:61276

            12:55:36,814 ERROR [org.jboss.naming.remote.protocol.v1.RemoteNamingStoreV1] (Remoting "JNDI-Endpoint" task-2) Channel end notification received, closing channel Channel ID 9062c452 (outbound) of Remoting connection 72c1d428 to localhost/127.0.0.1:14447

            12:55:36,818 ERROR [org.codehaus.xfire.handler.DefaultFaultHandler] (http-localhost-127.0.0.1-19080-12) Fault occurred!: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityController': Post-processing of the FactoryBean's object failed; nested exception is java.lang.IllegalStateException: No EJB receiver available for handling [appName:NYA,modulename:NyAFrameworkEJB-SNAPSHOT,distinctname:] combination

                      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:165) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:102) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1414) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at se.vhs.nya.framework.server.common.accessbean.BaseAccessBean.getBean(BaseAccessBean.java:28) [NyAFrameworkEJB-SNAPSHOT.jar:]

                      at se.vhs.nya.framework.server.common.accessbean.SecurityControllerAccessBean.getSecurityController(SecurityControllerAccessBean.java:408) [NyAFrameworkEJB-SNAPSHOT.jar:]

                      at se.vhs.nya.framework.server.common.accessbean.SecurityControllerAccessBean.loginRMI(SecurityControllerAccessBean.java:170) [NyAFrameworkEJB-SNAPSHOT.jar:]

                      at se.vhs.nya.framework.server.common.accessbean.SecurityControllerAccessBean.login(SecurityControllerAccessBean.java:121) [NyAFrameworkEJB-SNAPSHOT.jar:]

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_29]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_29]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_29]

                      at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_29]

                      at org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:59) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.service.invoker.ObjectInvoker.invoke(ObjectInvoker.java:45) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(ServiceInvocationHandler.java:320) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceInvocationHandler.java:86) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(ServiceInvocationHandler.java:134) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceInvocationHandler.java:109) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:131) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:64) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServletController.java:304) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.transport.http.XFireServletController.doService(XFireServletController.java:129) [xfire-all-1.2.6.jar:]

                      at org.codehaus.xfire.transport.http.XFireServlet.doPost(XFireServlet.java:116) [xfire-all-1.2.6.jar:]

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:754) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [jboss-servlet-api_3.0_spec-1.0.0.Final.jar:1.0.0.Final]

                      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161) [jbossweb-7.0.10.Final.jar:]

                      at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154) [jboss-as-web-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:626) [jbossweb-7.0.10.Final.jar:]

                      at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2033) [jbossweb-7.0.10.Final.jar:]

                      at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_29]

            Caused by: java.lang.IllegalStateException: No EJB receiver available for handling [appName:NYA,modulename:NyAFrameworkEJB-SNAPSHOT,distinctname:] combination

                      at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:530) [jboss-client-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:84) [jboss-client-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:175) [jboss-client-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:122) [jboss-client-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:107) [jboss-client-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:90) [jboss-client-7.1.0.Final-SNAPSHOT.jar:7.1.0.Final-SNAPSHOT]

                      at $Proxy32.create(Unknown Source)          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.6.0_29]

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [rt.jar:1.6.0_29]

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [rt.jar:1.6.0_29]

                      at java.lang.reflect.Method.invoke(Method.java:597) [rt.jar:1.6.0_29]

                      at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.create(AbstractSlsbInvokerInterceptor.java:224) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.newSessionBeanInstance(AbstractRemoteSlsbInvokerInterceptor.java:225) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.getSessionBeanInstance(SimpleRemoteSlsbInvokerInterceptor.java:142) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.ejb.access.SimpleRemoteSlsbInvokerInterceptor.doInvoke(SimpleRemoteSlsbInvokerInterceptor.java:98) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.ejb.access.AbstractRemoteSlsbInvokerInterceptor.invokeInContext(AbstractRemoteSlsbInvokerInterceptor.java:141) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.ejb.access.AbstractSlsbInvokerInterceptor.invoke(AbstractSlsbInvokerInterceptor.java:189) [spring-context-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172) [spring-aop-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202) [spring-aop-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at $Proxy30.toString(Unknown Source)          at java.lang.String.valueOf(String.java:2826) [rt.jar:1.6.0_29]

                      at java.lang.StringBuilder.append(StringBuilder.java:115) [rt.jar:1.6.0_29]

                      at se.vhs.nya.framework.server.common.util.spring.NyASpringBeanAnnotationBeanPostProcessor.postProcessAfterInitialization(NyASpringBeanAnnotationBeanPostProcessor.java:94) [NyAFrameworkEJB-SNAPSHOT.jar:]

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.postProcessObjectFromFactoryBean(AbstractAutowireCapableBeanFactory.java:1561) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:162) [spring-beans-3.0.4.RELEASE.jar:3.0.4.RELEASE]

                      ... 40 more

            {code}

             

             

            jaikiran pai wrote:

             

            Try and get some thread dumps http://community.jboss.org/wiki/ThreadDump when that happens

             

            I include that in a file attached to this message. Done by suspending the process in the debugger and expanding all threads in eclipse.

             

            Seams like its waining for the response in {code}EJBClientInvocationContext.awaitResponse(){code}.

             

            One thing that that I come to think of is that this case dose the remote invocation to it self (the provided url property point to the host it's running on).

             

            The whole invocation chain can be describe like this: A request coming in through the web-port, the host then does remote ejb invocations to itself and later to another host.

             

            The problem occur when we try to access the beans on the host itself though remoting.

             

            Hopes it helps.

             

            /Björn