You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by mlus <ml...@39596.com> on 2010/01/28 09:02:36 UTC
How to get DataSouce from JNDI ?
Hi.
I want to create JAAS Authentication Plugin.
This plugin module get login date through javax.sql.DataSource.
In activemq.xml, I set ....
<bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource">
<property name="serverName" value="localhost"/>
<property name="databaseName" value="activemq"/>
<property name="portNumber" value="0"/>
<property name="user" value="activemq"/>
<property name="password" value="activemq"/>
<property name="dataSourceName" value="postgres"/>
<property name="initialConnections" value="1"/>
<property name="maxConnections" value="10"/>
</bean>
In plugin module class,
Context initCtx = new InitialContext();
Object obj = initCtx.lookup(postgres-ds);
DataSouce ds = (DataSouce)obj.
Plugin Module class can't get DataSouce from JNDI !!
How can I get DataSouce from JNDI ?
Thank you.
Re: How to get DataSouce from JNDI ?
Posted by mlus <ml...@39596.com>.
Thank you for reply
> that definition of postgres-ds is not defined in jndi, but Spring. So you
> need to use Spring application context to obtain it (or register it in some
> kind of jndi store).
configure jndi.properties below.
java.naming.factory.initial=org.apache.xbean.spring.jndi.SpringInitialContextFactory
java.naming.provider.url=jndi.xml
in jndi.xml define ds-postgres DataSouce.
now, module can get datasouce!!.
Regards
Re: How to get DataSouce from JNDI ?
Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,
that definition of postgres-ds is not defined in jndi, but Spring. So you
need to use Spring application context to obtain it (or register it in some
kind of jndi store).
Cheers
--
Dejan Bosanac - http://twitter.com/dejanb
Open Source Integration - http://fusesource.com/
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net
On Thu, Jan 28, 2010 at 9:02 AM, mlus <ml...@39596.com> wrote:
> Hi.
>
> I want to create JAAS Authentication Plugin.
>
> This plugin module get login date through javax.sql.DataSource.
>
> In activemq.xml, I set ....
>
> <bean id="postgres-ds" class="org.postgresql.ds.PGPoolingDataSource">
> <property name="serverName" value="localhost"/>
> <property name="databaseName" value="activemq"/>
> <property name="portNumber" value="0"/>
> <property name="user" value="activemq"/>
> <property name="password" value="activemq"/>
> <property name="dataSourceName" value="postgres"/>
> <property name="initialConnections" value="1"/>
> <property name="maxConnections" value="10"/>
> </bean>
>
>
> In plugin module class,
>
> Context initCtx = new InitialContext();
> Object obj = initCtx.lookup(postgres-ds);
> DataSouce ds = (DataSouce)obj.
>
>
> Plugin Module class can't get DataSouce from JNDI !!
>
> How can I get DataSouce from JNDI ?
>
> Thank you.
>