I know the names of the Environment variables for the first jndi lookup - we can expect these to always remain the same. They are a requirement for the web application and must be provided by the container - whether these are linked to some global entry or simply supplied in the context.xml does not matter to me - as long as they are set.
<Environment name="javaNamingFactoryInitial" value="org.jnp.interfaces.NamingContextFactory" type="java.lang.String" />
<Environment name="javaNamingProviderUrl" value="jnp://host:1099" type="java.lang.String" />
<Environment name="javaNamingFactoryUrlPkgs" value="org.jboss.naming:org.jnp.interface" type="java.lang.String" />
I tried the following:
Code:
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<constructor-arg index="0">
<props>
<prop key="java.naming.factory.initial">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef" value="true" />
<property name="jndiName" value="javaNamingFactoryInitial" />
</bean>
</prop>
<prop key="java.naming.provider.url">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef" value="true" />
<property name="jndiName" value="javaNamingProviderUrl" />
</bean>
</prop>
<prop key="java.naming.factory.url.pkgs">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="resourceRef" value="true" />
<property name="jndiName" value="javaNamingFactoryUrlPkgs" />
</bean>
</prop>
</props>
</constructor-arg>
</bean>