将远程 EJB 注入 Spring 时出错
Error injecting remote EJB into Spring
我正在尝试将 EJB 注入 Spring 4 应用程序上下文。我已经阅读了几本手册和教程,并且已经结束了。我不知道为什么 Spring 不能通过 JDNI 名称获取远程 Bean。当我使用 WildFly 10 启动应用程序时,出现 404 错误。
我的 Bean 定义是:
部署单元 'subdeployment "gestion-docente-ejb.jar" of deployment "gestion-docente-ear-1.0.0-SNAPSHOT.ear"' 中名为 'CursoServiceBean' 的会话 bean 的 JNDI 绑定如下:</p>
<pre><code>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>
请帮忙。
尽管 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>
我正在尝试将 EJB 注入 Spring 4 应用程序上下文。我已经阅读了几本手册和教程,并且已经结束了。我不知道为什么 Spring 不能通过 JDNI 名称获取远程 Bean。当我使用 WildFly 10 启动应用程序时,出现 404 错误。
我的 Bean 定义是:
部署单元 'subdeployment "gestion-docente-ejb.jar" of deployment "gestion-docente-ear-1.0.0-SNAPSHOT.ear"' 中名为 'CursoServiceBean' 的会话 bean 的 JNDI 绑定如下:</p>
<pre><code>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>
请帮忙。
尽管 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>