tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dirk Weigenand" <Dirk.Weigen...@gmx.de>
Subject Re: jndi question
Date Mon, 22 Aug 2005 08:37:25 GMT
Hi Sean,

> --- Urspr√ľngliche Nachricht ---
> Von: Sean Rowe <ichabooka@gmail.com>
> An: tomcat-user@jakarta.apache.org
> Betreff: jndi question
> Datum: Mon, 22 Aug 2005 01:26:49 -0500
> 
> I have tried for several hours now to get connection pooling for my 
> MySql database to work, but have been unable to do so.  I keep getting 
> this error:
> 
> javax.naming.NoInitialContextException: Cannot instantiate class:
> org.apache.commons.dbcp.BasicDataSourceFactory
> 
> 
 
> It's bombing out on this code:
> 
>     Properties p=new Properties();
>      
>
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.apache.commons.dbcp.BasicDataSourceFactory");
>      p.put(Context.PROVIDER_URL,"jdbc:mysql://localhost:3306");
>      Context initCtx = new InitialContext(p); // here's where it dies
> 

You're mixing up some concepts here. Context.INITIAL_CONTEXT_FACTORY is
meant to provide the name of a factory producing JNDI contexts, not a
factory for producing JDBC DataSources. The same goes for the next line of
code. Context.PROVIDER_URL is not used for providing information about a
database connection.

There is extensive documentation on the tomcat web site regarding JNDI
ressource configuration. Have a look at the following URL:

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-resources-howto.html

> Can someone please help me, or at least point me in the direction of 
> some documentation that I've missed?  I've searched google and every 
> other search engine I can think of.  Thanks in advance.
> 
> Sean Rowe
> 

Regards
        Dirk

-- 
GMX DSL = Maximale Leistung zum minimalen Preis!
2000 MB nur 2,99, Flatrate ab 4,99 Euro/Monat: http://www.gmx.net/de/go/dsl

---------------------------------------------------------------------
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