0
我想知道如何使用JNDI將對象(如果它需要EJB)插入JBoss(5.0)?使用JNDI將Bean插入到JBoss
我在春天的applicationContext.xml 以下 bean定義:
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
<context:annotation-config/>
<bean id="myServiceFacade" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="MyServiceFacadeBean/remote"/>
<property name="cache" value="true"/>
<property name="lookupOnStartup" value="true"/>
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory
</prop>
<prop key="java.naming.provider.url">localhost:1099</prop>
<prop key="java.naming.factory.url.pkgs">org.jboss.naming:org.jnp.interfaces
</prop>
</props>
</property>
<property name="proxyInterface" value="my.company.service.facade.MyServiceFacade"/>
</bean>
,當我嘗試運行JBoss的我得到:
Caused by: javax.naming.NameNotFoundException: MyServiceFacadeBean/remote
at org.jboss.ha.jndi.HAJNDI.lookupRemotely(HAJNDI.java:264)
at org.jboss.ha.jndi.HAJNDI.lookup(HAJNDI.java:205)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.ha.framework.interfaces.HARMIClient.invoke(HARMIClient.java:318)
at $Proxy165.lookup(Unknown Source)
也許一些額外的步驟應該用於註冊進行對象與JBoss/JNDI?
請注意,我已經嘗試將ejb特定文件放到JBoss(jboss.xml,ejb-jar.xml)中,但這沒有幫助。