You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by aaaaa <aa...@mytrashmail.com> on 2008/09/05 08:54:43 UTC
spring configuration to get datasource via jndi from geronimo
hi all,
I'm trying to get geronimo datasource via jndi to use in junit test like:
Code:
...
UserDAOTest extends AbstractDependencyInjectionSpringContextTests{
...
protected DataSource dataSource;
public UserDAOTest() {
setPopulateProtectedVariables(true);
}
...
how should I configure dataSource in spring config ?
what "java.naming.factory.initial" and ava.naming.provider.url should I set?
<bean id="applicationServerEnviromentProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="java.naming.factory.initial"></prop>
<prop key="java.naming.provider.url">127.0.0.1:4201</prop>
</props>
</property>
</bean>
<bean id="dataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName"><value>java:jdbc/testdb</value></property>
<property name="jndiEnvironment"><ref
local="applicationServerEnviromentProperties"/></property>
</bean>
I tried to use:
<prop
key="java.naming.factory.initial">com.sun.jndi.rmi.registry.RegistryContextFactory</prop>
<prop key="java.naming.provider.url">rmi://localhost:1099</prop>
but I get javax.naming.namenotfoundexception...
spring 2.5.4
geronimo 2.1.1
thanks.
--
View this message in context: http://www.nabble.com/spring-configuration-to-get-datasource-via-jndi-from-geronimo-tp19325891s134p19325891.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.