2017-02-19 70 views
0

我正試圖將EJB注入Spring 4應用程序上下文中。我已經閱讀了幾本手冊和教程,並且我已經結束了。我不明白爲什麼Spring無法通過JDNI名稱獲得遠程Bean。當我使用WildFly 10啓動應用程序時,出現404錯誤。在Spring中注入遠程EJB時出錯

我的bean定義: 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> 

請幫助。

+0

只要做一個JNID查找,不要使用'SimpleRemoteStatelessSessionProxyFactoryBean',因爲這基本上是針對EJB 2而不是EJB3的。 –

+0

感謝thougth jnid我明白了。 – Observer

回答

0

雖然jdni:jee我能夠將EJB bean注入到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>