8 Replies Latest reply on Apr 14, 2014 12:23 PM by Giancarlo Rosso

    migrating ejb clients from eap 5 to wildfly.

    Giancarlo Rosso Newbie

      Some time ago I asked more or less the same question wrt EAP6 (JBoss 7). The environment of the company I work for has stateless EJB deployed on EAP5, and we're starting to move to new technologies, starting from frontend environments. The migration should go through a first step, where spring/velocity environments would be migrate to newer versions of software and application servers (Spring 3.0->3.2, EAP5 -> Wildfly/EAP7).

      My question is simple: is it possible to call stateless ejb, using spring abstraction, from wildfly to EAP5?

      I went through all manual, on how to migrate spring applications and jndi ejb3 calls. I took a bit to gather all spring dependencies and create module, but in the end the spring/velocity webapp gets deployed. The problem is that I could not make an ejb invocation:

      11:32:28,310 ERROR [util.ServiceListHelper] (default task-2) LISTA SERVIZI VUOTA, IMPOSSIBILE PROSEGUIRE: org.springframework.remoting.RemoteProxyFailureException: No matching RMI stub method found for: public abstract commons.model.LayerValueObject ejb.service.ServiceGenericEJB.getDataFromJndiService(commons.model.ParamValueObject); nested exception is java.lang.NoSuchMethodException: org.jboss.ejb.client.naming.ejb.EjbNamingContext.getDataFromJndiService(commons.model.ParamValueObject)


      getDataFromJndiService(commons.model.ParamValueObject) is a method of ejb.service.ServiceGenericEJB, which gets diclared in an xml:


        <bean id="serviceGenericEjb" lazy-init="true" class="commons.util.EjbFactoryBean" >
          <property name="jndiName" value="ejb:jndirvinterface/jndirvinterface-ejb!serviceGenericEjb"/>
          <property name="businessInterface" value="ejb.service.ServiceGenericEJB"/>
          <property name="jndiTemplate"><ref bean="remoteJndi"/></property>
          <property name="refreshHomeOnConnectFailure" value="true" />

      and its jndi template is:

        <bean id="remoteJndi" class="org.springframework.jndi.JndiTemplate">
          <property name="environment">
          <prop key="java.naming.factory.initial">org.jboss.naming.remote.client.InitialContextFactory</prop>
          <prop key="java.naming.factory.url.pkgs">org.jboss.ejb.client.naming</prop>
          <prop key="java.naming.provider.url">${jndi.ha}</prop>
              <prop key="lookupHomeOnStartup">false</prop>


      Am I missing something?

      Thank you very much.

        • 1. Re: migrating ejb clients from eap 5 to wildfly.
          Eduardo Martins Apprentice

          Perhaps your code is not using the ejb client bundled with WildFly, which version is 2.0.0.Final?

          If that's not the case please share the full server log.

          • 2. Re: migrating ejb clients from eap 5 to wildfly.
            Giancarlo Rosso Newbie

            The app is importing module javax.api.ejb, which (as far as I see) is the ejb client bundled with wildfly, isn't it?


                <module name="javax.ejb.api"/>

                <module name="org.springframework" slot="3.2.8.RELEASE"/>
                <module name="org.slf4j"/>
                <module name="javax.ejb.api"/>
                <module name="org.apache.log4j"/>
                <module name="javax.servlet.api" export="true"/>
                <module name="net.spy.memcached" slot="2.10.2"/>

            Here is the server.log: https://www.wuala.com/magullo/Temp/Public/server.log/?key=w2lqs0NA152y

            It's a simple, standalone server, with a few changes in logging and system properties.

            Thanks again.

            • 3. Re: migrating ejb clients from eap 5 to wildfly.
              Eduardo Martins Apprentice

              I mean the version used to compile your code, the stack trace exception points to a missing method.

              • 4. Re: migrating ejb clients from eap 5 to wildfly.
                Giancarlo Rosso Newbie

                The code is compiled on a RHEL5, using a jdk 1.7 (update 25).

                The pom.xml is this: https://www.wuala.com/magullo/Temp/Public/pom.xml/?key=w2lqs0NA152y

                I mainly include the dependencies specified in jdf ejb-remote example, but still I get that exception. I have to say that I do not see any network traffic going from the ejb client to the server, while on EAP 5 if the client cannot connect to server, webapp do not get deployed.

                Am I missing other things? Could it be something related to Spring/EE7/Wildfly using (too) different technologies?


                • 5. Re: migrating ejb clients from eap 5 to wildfly.
                  Eduardo Martins Apprentice

                  I don't see the dependency for the ejb client, perhaps it's defined elsewhere? Anyway add to dependency management:










                  and then into dependencies:







                  Also note that WildFly compliant quickstarts may be found at wildfly/quickstart · GitHub, the ones in JDF target JBoss EAP.


                  PS: when sharing please use something that does not requires downloading the file, such as PasteBin.

                  • 6. Re: migrating ejb clients from eap 5 to wildfly.
                    Giancarlo Rosso Newbie

                    Sorry, I hope this url lets you open the file without download. I cannot use pastebin from work.


                    I updated my pom.xml thanks to your suggestions, and noticed that ejb-remote project for wildfly requires other dependencies. Still I get the same error, it looks like the process of marshalling/unmarshalling doesn't work as expected (probably because of my configuration).

                    The object org.mycompany.ejb.service.ServiceGenericEJB.getDataFromJndiService(org.mycompany.commons.model.ParamValueObject) becomes org.jboss.ejb.client.naming.ejb.EjbNamingContext.getDataFromJndiService(org.mycompany.commons.model.ParamValueObject) in spring bean, but cannot be unmarshalled to its original class.


                    • 7. Re: migrating ejb clients from eap 5 to wildfly.
                      Eduardo Martins Apprentice

                      You're out of luck then, I have no experience with Spring.

                      • 8. Re: migrating ejb clients from eap 5 to wildfly.
                        Giancarlo Rosso Newbie

                        After three weeks of further investigating, and digging through EAP6/AS7.2 and Wildfly documentation, I managed to enable (I think) remote lookup.

                        Spring property placeholders are substituted, but it looks that jboss-remote-naming requires jndi.properties in war classpath.

                        With jndi.properties, and provider.url, it looks like Wildfly starts to make remote jndi lookup:



                        development.server is a jboss-eap-5.2.0, and the bean I need to lookup is bound in Global JNDI Namespace (from jmx-console) as



                          +- jndirvinterface (class: org.jnp.interfaces.NamingContext)
                          |   +- ServiceGenericEJBBean (class: org.jnp.interfaces.NamingContext)
                          |   |   +- remote-it.fineco.ejb.service.ServiceGenericEJB (class: Proxy for: org.mycompany.ejb.service.ServiceGenericEJB)

                        so I thought the right way to call it was:


                        But now I get:

                        17:57:51,673 ERROR [org.mycompany.commons.util.ServiceListHelper] (pool-5-thread-1) LISTA SERVIZI VUOTA, IMPOSSIBILE PROSEGUIRE: java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling [appName:jndirvinterface, moduleName:jndirvinterface-ejb, distinctName:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext@f4edd5
                             at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:749) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at org.jboss.ejb.client.ReceiverInterceptor.handleInvocation(ReceiverInterceptor.java:116) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at org.jboss.ejb.client.EJBClientInvocationContext.sendRequest(EJBClientInvocationContext.java:183) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at org.jboss.ejb.client.EJBInvocationHandler.sendRequestWithPossibleRetries(EJBInvocationHandler.java:253) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:198) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at org.jboss.ejb.client.EJBInvocationHandler.doInvoke(EJBInvocationHandler.java:181) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at org.jboss.ejb.client.EJBInvocationHandler.invoke(EJBInvocationHandler.java:144) [jboss-ejb-client-2.0.0.Final.jar:2.0.0.Final]
                             at com.sun.proxy.$Proxy32.getDataFromJndiService(Unknown Source)
                             at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
                             at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_51]
                             at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_51]
                             at java.lang.reflect.Method.invoke(Method.java:606) [rt.jar:1.7.0_51]
                             at org.springframework.remoting.rmi.RmiClientInterceptorUtils.invokeRemoteMethod(RmiClientInterceptorUtils.java:111) [spring-context-3.2.8.RELEASE.jar:3.2.8.RELEASE]

                        How do I get the right remote ejb name? The EJB is inside an EAR, packaged in an EJB, so looking at the docs I shoud use app/module/bean!fully-qualified-class, and it looks right to me.

                        And, do I have to expose EJBs as java:jboss/exported/ on EAP5?