File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes [Error]NameNotFoundException: jndi-lookup name is not associated with this context Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Customer Requirements for Developers this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "[Error]NameNotFoundException: jndi-lookup name is not associated with this context" Watch "[Error]NameNotFoundException: jndi-lookup name is not associated with this context" New topic

[Error]NameNotFoundException: jndi-lookup name is not associated with this context

Ramon Bonet

Joined: Jun 02, 2013
Posts: 8
Hi all,

Trying to run the application into browser, the following error appears:

javax.naming.NameNotFoundException: name hibernate/TFCappDS is not associated with this context

I connect to data Source with JNDI lookup, my app server is VMware vFabric tc Server, and I'm using Hibernate as the ORM framwork.

The fact is, I really don't know what name should I put as a jndi name.

Furthermore, I read in some places that is necessary to define JNDI lookup name as a <resource> in server.xml file from Server directory, and then to reference JNDI from Server's web, in context.xml from the same directory. But I have no idea about how to create this server resource, or what values should I write considering my server and ORM cases (VMware vFabric tc Server, Hibernate)

All my current code about JNDI and dataSource bean is this, at Spring xml file:

And I added the following resource, inside server.xml VMware tc Server file:

But It still does not recognize jndi name as a part of this context.

About this, I have two questions:

Can someone tell me if I have the correct values of 'url' and 'driverClassName' parameters, considering postgres??

Does Anyone know if there's something more to do, after editing servlet-context.xml and server.xml like this, to get JNDI-lookup name finally recognized? Or am I just simply wrong from de begining?

Very grateful to everyone
Ankit Garg

Joined: Aug 03, 2008
Posts: 9376

The Postgres related stuff is fine. As for the lookup can you follow the answer given here which mentions adding something to context.xml...

SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
I agree. Here's the link:
subject: [Error]NameNotFoundException: jndi-lookup name is not associated with this context
jQuery in Action, 3rd edition