Hi,
I'm using 2 JndiTemplates to access two EJB's which are deployed on different machines and therefore the properties are different.
The problem is that when the beans are loaded and when running a test to consult one of the Ejb's I get a SecurityException because it's still using the properties of the first JndiTemplate instead of the properties of the second.
Is this a problem of caching ?? Can I destroy a JndiTemplate after it's been used ?
Here are the 2 JndiTemplates and the beans : Ripservice makes use of the JndiTemplate and DmfaConsultation makes use of the JndiTemplate2 bean but somehow the latter still uses the properties of the first template :
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">${java.naming.fa ctory.initial}</prop>
<prop key="java.naming.provider.url">${java.naming.provi der.url}</prop>
<prop key="java.naming.security.principal">${java.naming .security.principal}</prop>
<prop key="java.naming.security.credentials">${java.nami ng.security.credentials}</prop>
</props>
</property>
</bean>
<bean id="jndiTemplate2" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">${java.naming.fa ctory.initial}</prop>
<prop key="java.naming.provider.url">${dmfaconsult.java. naming.provider.url}</prop>
<prop key="java.naming.security.principal">${dmfaconsult .java.naming.security.principal}</prop>
<prop key="java.naming.security.credentials">${dmfaconsu lt.java.naming.security.credentials}</prop>
</props>
</property>
</bean>
<!-- A reference to a RipService instance -->
<bean id="ripService" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate" />
</property>
<property name="jndiName">
<value>${ripService.jndiName}</value>
</property>
<property name="businessInterface">
<value>be.smalsmvm.common.businessservices.rip.ser vice.RipService</value>
</property>
</bean>
<!-- A reference to a DmfaConsult instance -->
<bean id="dmfaConsultation" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
<property name="jndiTemplate">
<ref bean="jndiTemplate2" />
</property>
<property name="jndiName">
<value>${dmfaConsultService.jndiName}</value>
</property>
<property name="businessInterface">
<value>be.smalsmvm.common.dmfaconsultation.ejb.Dmf aConsultation</value>
</property>
</bean>
Thanks for any info !


Reply With Quote