geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aaaaa <aa...@mytrashmail.com>
Subject spring configuration to get datasource via jndi from geronimo
Date Fri, 05 Sep 2008 06:54:43 GMT

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.


Mime
View raw message