You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by boday <be...@initekconsulting.com> on 2012/10/01 19:08:55 UTC

Spring JNDI datasource not recognized after upgrade to ActiveMQ 5.6.0

I tested my ActiveMQ 5.5.0 (fuse version) app in AMQ 5.6.0 and noticed that
our Spring JNDI configured Oracle datasources aren't being found.

The only thing I changed in my applications was the pom.xml versions of
AMQ/Spring (to match the 5.6 versions). Otherwise, I'm using the identical
application code and configuration (activemq.xml, jndi.xml, etc), but my
Spring JDBC DAOs (v3.0.5) are failing to find them.

No errors in the logs otherwise, just this Spring Application Context
initialization error...

javax.naming.NameNotFoundException; remaining name 'jdbc/myDataSource'

here is the relevant Spring jndi config (conf/jndi.xml, included in
conf/activemq.xml)...

<bean id="jndi"
class="org.apache.xbean.spring.jndi.SpringInitialContextFactory" 
    factory-method="makeInitialContext" scope="singleton">
    <property name="entries" ref="jndiEntries" />
</bean>
<util:map id="jndiEntries">
    <entry key="jdbc/myDataSource">
    <bean id="myDBCPDataSource"
class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName" value="oracle.jdbc.OracleDriver" />
        ...

then my application references it like this...

<bean id="myDataSource"
class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName">
        <value>jdbc/myDataSource</value>
    </property>
</bean>

<bean id="messageDAO" class="com.mycompany.MessageDAOImpl">
    <property name="dataSource" ref="myDataSource" />
</bean>

That said, I tested without using JNDI (instead just hardcoded the
datasource in my app) and everything works as expected. So that should rule
out everything except the Spring JNDI registration/lookup of the datasource,
etc.

So, what am I missing?

note: also on
http://stackoverflow.com/questions/11748318/spring-jndi-datasource-not-recognized-after-upgrade-to-activemq-5-6-0



--
View this message in context: http://activemq.2283324.n4.nabble.com/Spring-JNDI-datasource-not-recognized-after-upgrade-to-ActiveMQ-5-6-0-tp4657289.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Spring JNDI datasource not recognized after upgrade to ActiveMQ 5.6.0

Posted by boday <be...@initekconsulting.com>.
I found the issue, I added a jndi.properties file under the <amq>/conf
directory containing the following and it works fine now (didn't need this
under AMQ 5.5, strange)...

java.naming.factory.initial =
org.apache.xbean.spring.jndi.SpringInitialContextFactory



--
View this message in context: http://activemq.2283324.n4.nabble.com/Spring-JNDI-datasource-not-recognized-after-upgrade-to-ActiveMQ-5-6-0-tp4657289p4657304.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.