Hi i am getting the following errors:

com.btt.bms.dal.DALException: Name java:comp is not bound in this context & javax.naming.NameNotFoundException: Name java:comp is not bound in this Context

Here i am sharing sample snippet:

DALBroker.java

package com.btt.bms.dal;

import javax.xml.parsers.*;
import org.xml.sax.*;
import org.w3c.dom.*;
import java.util.*;
import java.io.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
import java.net.URL;
import com.btt.bms.controller.*;
import com.btt.bms.util.Constants;

/** When an application starts only one instance of DALBroker class will be
* created, providing a global print of access to it. The Singleton pattern
* will be used to create an instance of DALbroker class. The instance will
* read the query.xml file. The query.xml file will contain all the queries
* that are required by the application to retrieve, insert, update and delete
* records. It also instantiate a collection having the mapping of DALQuery
* objects with query name.*/

public class DALBroker
{

/** File path of the queries.xml file
*/
String XMLQUERIESPATH = Constants.getConfigXMLPath()+"queries.xml";
/** File path of the queries.xml file
*/
String XMLOBJECTSPATH = Constants.getConfigXMLPath()+"objects.xml";

/** JNDI name for the data source
*/
final String JNDICONTEXT = "java:comp/env/jdbc/btt";

/** Map of query names and DALQuery objects.
*/
private HashMap _mapQueries = new HashMap();

/** Map of query names and DALQuery objects.
*/
private HashMap _mapObjects = new HashMap();

/** Datasource to the underlying RDBMS.
*/
private DataSource _objDataSource;

/** Single instance of the object to be used across the application.
*/
private final static DALBroker _objInstance = new DALBroker();

/**
* Creates new DalBroker object. It instantiates a map, which stores the
* mapping of the query name with the DALQueryobjects and also initiaizes
* the datasource, using JNDI, to the underlying RDBMS.
*
*/

private DALBroker()
{
try
{

XMLQUERIESPATH = Constants.getConfigXMLPath()+"queries.xml";

XMLOBJECTSPATH = Constants.getConfigXMLPath()+"objects.xml";
DocumentBuilderFactory objFactory = DocumentBuilderFactory.newInstance();
objFactory.setIgnoringElementContentWhitespace(tru e);
DocumentBuilder objDomBuilder = objFactory.newDocumentBuilder();

File objFile = new File(XMLOBJECTSPATH);

Document objDoc = objDomBuilder.parse(objFile);

Element objElement = objDoc.getDocumentElement();
NodeList objChildren = objElement.getElementsByTagName("object");
for (int i = 0; i < objChildren.getLength(); i++)
{
DALObject objObject = new DALObject(objChildren.item(i));
_mapObjects.put(objObject.getObjectName(), objObject);
}

//objFile = new File(strPath, XMLQUERIESPATH);
objFile = new File(XMLQUERIESPATH);
objDoc = objDomBuilder.parse(objFile);

objElement = objDoc.getDocumentElement();
objChildren = objElement.getElementsByTagName("query");
for (int i = 0; i < objChildren.getLength(); i++)
{
DALQuery objQuery = new DALQuery(objChildren.item(i), _mapObjects);
_mapQueries.put(objQuery.getQueryName(), objQuery);
}

Context objContext = new InitialContext();
_objDataSource = (DataSource) objContext.lookup(JNDICONTEXT);


}
catch (Exception e)
{
e.printStackTrace();
}
}

/** Fetches the single refrence to the global object to be shared throughout the
* application.
* @return DALBroker Refrence to a global instance of DALBroker class.
*/
public static DALBroker getInstance()
{
return _objInstance;
}

/** Initializes and returns a refrence to the underlying JDBC datasource.
*
* @throws DALException Thrown in case if there is an error in connecting to the datasource.
* @return Initialized DALConnection object.
*/
public DALConnection getConnection()
throws DALException
{
try
{
if(_objDataSource!= null)
{
return new DALConnection(_objDataSource.getConnection());
}
else
{
Context objContext = new InitialContext();
_objDataSource = (DataSource) objContext.lookup(JNDICONTEXT);
if(_objDataSource!= null)
{
return new DALConnection(_objDataSource.getConnection());
}
return null;
}
}
catch (Exception e)
{

e.printStackTrace();
throw new DALException(e.getMessage());
}
}

/** Retrieves the refrence to a DALQuery object form the initialized set.
* @param strQueryName Name of the query to retrieve.
* @throws QueryNotFoundException Thrown if the query was not found in the initialized query map.
* @return Refrence to the DALQquery object.
*
*/
public DALQuery getQuery(String strQueryName)
throws QueryNotFoundException
{

DALQuery objQuery = (DALQuery) _mapQueries.get(strQueryName);
if (objQuery == null)
{
throw new QueryNotFoundException("The query name was not found.");
}
else
{
return objQuery;
}
}


/** Retrieves the refrence to a DALObject object form the initialized set.
* @param strObjectName Name of the object to retrieve.
* @throws ObjectNotFoundException Thrown if the object was not found in the initialized object map.
* @return Refrence to the DALQObject object.
*
*/

public DALObject getObject(String strObjectName)
throws ObjectNotFoundException
{
DALObject objObject = (DALObject) _mapObjects.get(strObjectName);
if (objObject == null)
{
throw new ObjectNotFoundException("The object name was not found.");
}
else
{
return objObject;
}
}

/** Retrieves all the query names in th current context.
*
* @return Collection containing all the query names in the current context.
*/
public Collection getQueryNames()
{
return _mapQueries.keySet();
}

/** Retrieves all the object names in th current context.
*
* @return Collection containing all the object names in the current context.
*/
public Collection getObjectNames()
{
return _mapObjects.keySet();
}

/* public static void main(String args[])
{
}*/
}


context.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/hrhelpdesk">
<Resource driverClassName="org.postgresql.Driver" maxActive="100" maxIdle="50" maxWait="5000" name="jdbc/btt" password="password" type="javax.sql.DataSource" url="jdbcostgresql://127.0.0.1:5432/BTS" username="postgres"/>
<ResourceLink global="jdbc/btt" name="jdbc/btt" type="javax.sql.DataSource"/>
</Context>

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<servlet>
<servlet-name>HTTPController</servlet-name>
<servlet-class>com.btt.bms.controller.HTTPController</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>AJAXController</servlet-name>
<servlet-class>com.btt.bms.controller.AJAXController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HTTPController</servlet-name>
<url-pattern>*.action</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>AJAXController</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<resource-ref>
<description>postgreSQL connection</description>
<res-ref-name>jdbc/btt</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>