This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Java in General and the fly likes Warning: Resource reference is not defined for JNDI name Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Warning: Resource reference is not defined for JNDI name" Watch "Warning: Resource reference is not defined for JNDI name" New topic
Author

Warning: Resource reference is not defined for JNDI name

David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
Getting the above message when using the following code:



It works, but I get this message in the log:



However, you may note that the jndiContext isn't in the proper format which should be:



When I use this jndiContextValue, I get NullPointerExceptions when I perform a DataSource.getConnection() call.

I'm using: Sun ONE Application Server 7.0.0_04
Sheldon Fernandes
Ranch Hand

Joined: Aug 18, 2004
Posts: 157
Use the <resource-ref> element to declare a web application's reference to an
external resource.

For example:
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192
I did not post this, but I already have this in my web.xml



I even created a sun-web.xml, but it didn't seem to have any effect:

David Hibbs
Ranch Hand

Joined: Dec 19, 2002
Posts: 374
a) your res-ref-name needs to start with java:comp/env
b) make sure you also bind that reference to your jdbc name. WSAD is very nice in doing this, but you otherwise likely need to do it with the AAT. It will end up in your ibm-web-bnd.xmi file.


"Write beautiful code; then profile that beautiful code and make little bits of it uglier but faster." --The JavaPerformanceTuning.com team, Newsletter 039.
David Yutzy
tumbleweed and gunslinger
Ranch Hand

Joined: Jun 29, 2001
Posts: 192

a) your res-ref-name needs to start with java:comp/env


Really? Every example I found doesn't have this syntax in either the web.xml or the sun-web.xml. It DOES have this syntax when you try to get it from the Context...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Warning: Resource reference is not defined for JNDI name