tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brett Randall <brett_...@yahoo.com.au>
Subject Re: problem setting up JNDI
Date Mon, 03 Jan 2005 05:19:07 GMT
Did you add the res ref to your web.xml?  Also note
you are using the older MySQL JDBC driver.

 --- faisal <programmerforlife@softhome.net> wrote: 
> hi guys.
> I m getting some problems setting up JNDI for mysql
> db. i ve copied 
> mysql driver in
> <tomcat-dir>\jakarta-tomcat-5.0.19\common\lib.
> i ve attached my hibernateApp.xml which is placed
> under my 
>
<tomcat-dir>\jakarta-tomcat-5.0.19\conf\Catalina\localhost.
> 
> i m using jakarta-tomcat-5.0.19 which is embedded in
> Netbeans 3.6.
> 
> upon excecuting index.jsp i m getting following
> exceptions.
> 
> javax.servlet.ServletException: Name jdbc is not
> bound in this Context
>     
>
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
>     
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
>    
>
org.apache.jsp.index_jsp._jspService(index_jsp.java:66)
>    
>
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
>    
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>     
>
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
>    
>
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
>    
>
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
>    
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>     
>
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:305)
> 
> please help me.
> > <?xml version='1.0' encoding='utf-8'?>
> <Context path="/hibernateapp"
> docBase="hibernateapp">
> 	<Resource name="jdbc/inventory" scope="Shareable"
> type="javax.sql.DataSource"/>
> 	<ResourceParams name="jdbc/inventory">
> 		<parameter>
> 			<name>factory</name>
> 		
>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
> 		</parameter>
> 		<!-- DBCP database connection settings -->
> 		<parameter>
> 			<name>url</name>
> 		
> <value>jdbc:mysql://localhost:3306/inventory</value>
> 		</parameter>
> 		<parameter>
> 			<name>driverClassName</name>
> 			<value>org.gjt.mm.mysql.Driver</value>
> 		</parameter>
> 		<parameter>
> 			<name>username</name>
> 			<value>faisal</value>
> 		</parameter>
> 		<parameter>
> 			<name>password</name>
> 			<value>faisal</value>
> 		</parameter>
> 		<!-- DBCP connection pooling options -->
> 		<parameter>
> 			<name>maxWait</name>
> 			<value>3000</value>
> 		</parameter>
> 		<parameter>
> 			<name>maxIdle</name>
> 			<value>100</value>
> 		</parameter>
> 		<parameter>
> 			<name>maxActive</name>
> 			<value>10</value>
> 		</parameter>
> 	</ResourceParams>
> </Context>> /*
>  * inventoryDB.java
>  *
>  * Created on January 1, 2005, 4:52 PM
>  */
> 
> package com.inventory;
> 
> /**
>  *
>  * @author  faziz
>  */
> public class inventoryDB {
>     
>     private javax.naming.Context context=null;
>     private javax.sql.DataSource dataSource=null;
>     private java.sql.Connection connection=null;
>     
>     /** Creates a new instance of inventoryDB */
>     public inventoryDB() throws Exception {
>         javax.naming.Context initContext=new
> javax.naming.InitialContext();
>        
>
context=(javax.naming.Context)initContext.lookup("java:comp/env");
>         if(context==null) throw new Exception("No
> Environment Context");
>         
>        
>
dataSource=(javax.sql.DataSource)context.lookup("jdbc/inventory");
>        
>     }   
> }
> 
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail:
tomcat-user-help@jakarta.apache.org 

Find local movie times and trailers on Yahoo! Movies.
http://au.movies.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Mime
View raw message