Search code examples
javaspringejb

Error injecting remote EJB into Spring


I´m trying to inject EJB into Spring 4 application context. I've read several manuals and tutorial and I have end to an end. I do not why Spring cannot get the Remote Bean by JDNI name. When I launch the app with WildFly 10 I get a 404 error.

My Bean definitions are: JNDI bindings for session bean named 'CursoServiceBean' in deployment unit 'subdeployment "gestion-docente-ejb.jar" of deployment "gestion-docente-ear-1.0.0-SNAPSHOT.ear"' are as follows:

java:global/gestion-docente-ear-1.0.0-SNAPSHOT/gestion-docente-ejb/CursoServiceBean!
com.formacion.ipartek.curso.CursoServiceRemote
java:app/gestion-docente-ejb/CursoServiceBean!
com.formacion.ipartek.curso.CursoServiceRemote
java:module/CursoServiceBean!
com.formacion.ipartek.curso.CursoServiceRemote
java:jboss/exported/gestion-docente-ear-1.0.0-SNAPSHOT/gestion-docente-ejb/CursoServiceBean!
com.formacion.ipartek.curso.CursoServiceRemote
java:global/gestion-docente-ear-1.0.0-SNAPSHOT/gestion-docente-ejb/CursoServiceBean
java:app/gestion-docente-ejb/CursoServiceBean
java:module/CursoServiceBean

bean id ="cursoServiceRemote"  class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
   property name="jndiName" value="java:module/CursoServiceBean!com.formacion.ipartek.curso.CursoServiceBean" />
   property name="jndiEnvironment">
        props>
           prop key="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</prop>
           prop key="java.naming.provider.url">ldap://localhost:9990</prop>
           prop key="java.naming.security.principal">*******/prop>
           prop key="java.naming.security.authentication">simple/prop> 
           prop key="java.naming.security.credentials">******/prop>
        /props>
    /property>
   property name="businessInterface" value="com.formacion.ipartek.curso.CursoServiceRemote" />
</bean>
<bean id="cursoServiceImp" class="com.ipartek.formacion.service.CursoServiceImp">
    property name="cursoServiceRemote" ref="cursoServiceRemote" />
</bean>

Please help.


Solution

  • Though jdni:jee I was able to inject the EJB bean into Spring.

    <jee:jndi-lookup id="cursoServiceRemote" jndi-name="java:app/gestion-docente-ejb/CursoServiceBean" />
    
    <bean id="cursoServiceImp" class="com.ipartek.formacion.service.CursoServiceImp">
        <property name="cursoServiceRemote" ref="cursoServiceRemote" />
    </bean>