This rule flags
- the
environment
element in a
jndi-lookup
element, and
- the property named
jndiEnvironment
.
These items are flagged so the user can verify that the values used are valid.
The following code is an example of an
environment
element which will get flagged in a Spring configuration file:
<jee:jndi-lookup id="dataSource" jndi-name="jdbc/MyDataSource">
<jee:environment>
key1=value1
key2=value2
</jee:environment>
</jee:jndi-lookup>
The following code is an example of an
jndiEnvironment
property element which will get flagged in a Spring configuration file:
<bean id="myBean" class="com.someBean">
<property name="ds" ref="myDataSource"/>
<property name="jndiEnvironment">
<props>
<prop key="key1">value1</prop>
<prop key="key2">value2</prop>
</props>
</property>
<jee:jndi-lookup id="myDataSource" jndi-name="jdbc/springdb"/>
</bean>
In both of the preceding examples, the user needs to make sure that the values
(value1 and value2 for key1 and key2)
are valid in the WebSphere Application Server environment.
In the following example the values for
java.naming.factory.initial and
java.naming.provider.url
are invalid in the Websphere environment.
<beans xmlns:jee="http://www.springframework.org/schema/jee" ... >
...
<jee:jndi-lookup id="connectionFactory" jndi-name="myConnectionFactory">
<jee:environment>
java.naming.factory.initial=weblogic.jndi.WLInitialContextFactory
java.naming.provider.url=t3://localhost:7001
</jee:environment>
</jee:jndi-lookup>
...
</bean>
For additional information, see: