Tuesday, July 29, 2008

JNDI object with [java:/jdbc/xxxx] not found: JNDI implementation returned null

Getting this error?

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested @@exception is javax.naming.NameNotFoundException: JNDI object with [java:/jdbc/pgds] not found: JNDI implementation returned null


Have a look at my issue:
http://pastebin.com/f6bdf6331

Using MyEclipse? Deploying to Jboss?
Took me about a week to figure this one out.

Solution
You're probably deploying MyEclipse bundled jboss*jar libraries to the WEB-INF/lib directory. The Jboss AS classloader seems to pick up these libraries before the out of the box jboss ones. Looks like it was trying to bind the datasource to the wrong version of the DataSource classes. Removed them from Project Properties->Libraries and wallaaa, works.

I am now 40 gray hairs worse off, but it's worth it if this tip helps you. Let me know if it does.