I tested a 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" />
<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">

<bean id="messageDAO" class="com.mycompany.MessageDAOImpl">

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?


ActiveMQ has a dependency into xbean-spring, which you are using as a JNDI provider. It is likely that the transitive Xbean dependency has changed because of the upgrade to ActiveMQ 5.6.0.

  • finally got back to this...I'm using xbean-spring 3.9 (same as is packaged with AMQ 5.6) but still having the same issues – Ben ODay Sep 29 '12 at 21:26

I found the issue, I added a jndi.properties file under the /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

Your Answer

