This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Other Java Products and Servers and the fly likes JNDI on startup Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Products » Other Java Products and Servers
Bookmark "JNDI on startup" Watch "JNDI on startup" New topic

JNDI on startup

karthik kesan

Joined: May 09, 2006
Posts: 1
I need to load my JNDI datasource before the startup servlet,becacuse in startupservlet I am having some code which loads some values from the database.

I am using the lookup code to get the JNDI name ,but it is not finding that name.

web.xml code added this code after taglibs definitions
<description>Primary database</description>

sun-web.xml code

java code:
initContext = new InitialContext();
source = (DataSource) initContext.lookup ("java:comp/env/jdbc/wbol");

can anyone help me out to resolve this issue.
Carl Trusiak

Joined: Jun 13, 2000
Posts: 3340
You need to configure the JNDI Data Source in the Admin application for the server.

I Hope This Helps
Carl Trusiak, SCJP2, SCWCD
I agree. Here's the link:
subject: JNDI on startup
It's not a secret anymore!