Java Reference
In-Depth Information
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">
org.jnp.interfaces.NamingContextFactory
</prop>
<prop key="java.naming.provider.url">
jnp://localhost:1099</prop>
<prop key=" java.naming.factory.url.pkgs">org.jboss.naming.client</prop>
</props>
</property>
</bean>
<!- - Local EJB 3 SLSB - ->
<bean id="uwrLocalService"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value=" UwrLocalServiceBean/Local " />
</bean>
</beans>
Lookup of JMS Objects
The service locator is not limited to EJB components; it can be used for any JNDI bound
object such as a JMS queue and topic or a JDBC data source. It can also be used with web
services.
Listing 4-7 looks up a local JMS queue and topic configured in JBoss. The listing also
shows two ways of using a resource reference while accessing JNDI bound objects. One
option is to prefix it directly in the
jndiName
property; the other is to turn on the
resourceRef
property, which will automatically prepend the string
java:comp/env/:
to the
JNDI name.
Listing 4-7.
insurance-servlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="
http://www.springframework.org/schema/beans"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
