Here it is: Context ctx = new InitialContext(); if(ctx == null ) throw new Exception("Boom - No Context"); ds = (DataSource)ctx.lookup("jdbc/TestDB");
Francesco -----Messaggio originale----- Da: David Smith [mailto:[EMAIL PROTECTED] Inviato: giovedì 7 aprile 2005 14.47 A: Tomcat Users List Oggetto: Re: Using Tomcat 5.5.x with Mysql Could you post the code used in doing the lookup? What I see here appears to imply you are using jdbc: as the jndi name to look up. As posted earlier, your jndi should look more like java:comp/env/jdbc/TestDB in the code where you do the lookup. --David Marchioni Francesco wrote: >Hi all, >I'm trying to configure a Connection Pool with Tomcat 5.5.x and MySql 4.1. >Unfortunately I cannot lookup from JNDI context the Datasource. > >JNDI lookup failed : javax.naming.NameNotFoundException: Name jdbc: is not >bound in this Context >javax.naming.NameNotFoundException: Name jdbc is not bound in this Context > at org.apache.naming.NamingContext.lookup(NamingContext.java:769) > at org.apache.naming.NamingContext.lookup(NamingContext.java:152) > at >org.apache.naming.SelectorContext.lookup(SelectorContext.java:136) > at javax.naming.InitialContext.lookup(Unknown Source) > at fad.bean.BaseManager.<init>(BaseManager.java:34) > at fad.bean.UserManager.<init>(UserManager.java:13) > at fad.bean.UserManager.getInstance(UserManager.java:23) > at fad.bean.LinkManager.getUserLinks(LinkManager.java:48) > at >fad.listener.SessionListener.buildSession(SessionListener.java:74) > at >fad.listener.SessionListener.sessionCreated(SessionListener.java:31) > at >org.apache.catalina.session.StandardSession.tellNew(StandardSession.java:37 1 >) > at >org.apache.catalina.session.StandardSession.setId(StandardSession.java:343) > at >org.apache.catalina.session.ManagerBase.createSession(ManagerBase.java:748) > at >org.apache.catalina.session.StandardManager.createSession(StandardManager.j a >va:290) > at >org.apache.catalina.connector.Request.doGetSession(Request.java:2199) > at >org.apache.catalina.connector.Request.getSession(Request.java:2017) > at >org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:8 2 >2) > at >org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:8 3 >3) > at >org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java: 1 >48) > at >org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:1 2 >3) > at >org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryI m >pl.java:104) > at org.apache.jasper.runtime.JspFactoryImpl.getPageContext( > >The configuration is the same published on Tomcat docs > >server.xml: > ><Context path="/DBTest" docBase="DBTest" > debug="5" reloadable="true" crossContext="true"> > > <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" > maxActive="100" maxIdle="30" maxWait="10000" > username="admin" password="admin" >driverClassName="com.mysql.jdbc.Driver" > url="jdbc:mysql://localhost:3306/fad?autoReconnect=true"/> > ></Context> > >web.xml: > ><web-app xmlns="http://java.sun.com/xml/ns/j2ee" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" > version="2.4"> > <description>MySQL Test App</description> > <resource-ref> > <description>DB Connection</description> > <res-ref-name>jdbc/TestDB</res-ref-name> > <res-type>javax.sql.DataSource</res-type> > <res-auth>Container</res-auth> > </resource-ref> ></web-app> > >Does anybody know if Tomcat can create a Connection pool with MySQL4.1 ? >Personally I've tried with JBoss4.1 and it works.....why not with tomcat >5.5.x ? >Thanks >Francesco > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]