You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by bye webster <we...@gmail.com> on 2009/07/28 08:05:34 UTC

dbcp issue: unable load commons-dbcp.jar and commons-pool.jar in lib/ext

Hello,

I recently research on how to implement Database Connection Pooling into
Tomcat 5.5 server.
After downloaded dbcp.jar and pool.jar from Jakarta project and I follow
through the guideline provided.
Unfortunately, It is only working when i set jar file path in CLASSPATH but
it unable load it when it is keep inside jre/lib/ext directory.
I thought all the jar will load in /lib/ext directory for all tomcat user.

Who's know what's happening? i don't want messy my classpath setting so
who's know how to load it from lib/ext directory?

Re: dbcp issue: unable load commons-dbcp.jar and commons-pool.jar in lib/ext

Posted by Mark Thomas <ma...@apache.org>.
bye webster wrote:
> I had follow through the guideline from
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html.
> It is not working, it unable locate the <resource> in <context>. The
> datasource.getConnection was return null. My appBase is mainhost and web
> application is webapps directory.

You will probably have more luck asking for help on the Tomcat users list.

Mark

> 
> This is my context in server.xml
> 
>         <Context path="/webapps" docBase="webapps" debug="5"
> reloadable="true" crossContext="true">
>             <Resource name="jdbc/myinformix" auth="Container"
>                   type="javax.sql.DataSource"
> driverClassName="com.informix.jdbc.IfxDriver"
> 
> url="jdbc:informix-sqli://hostname:port/dbname:INFORMIXSERVER=servernum;"
>                   username="uid" password="password" maxActive="20"
> maxIdle="10" maxWait="-1"/>
> 
>         </Context>
> 
> This is my web.xml
> 
>     <resource-ref>
>         <description>DB Connection</description>
>         <res-ref-name>jdbc/myinformix</res-ref-name>
>         <res-type>javax.sql.DataSource</res-type>
>         <res-auth>Container</res-auth>
>     </resource-ref>
> 
> this is how system invoked
> 
>       Context initContext = new InitialContext();
>       Context envContext = (Context) initContext.lookup("java:/comp/env");
>       DataSource ds = (DataSource) envContext.lookup("jdbc/myinformix");
>       Connection conn = ds.getConnection();
> 
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> 
> On Tue, Jul 28, 2009 at 8:45 PM, Mark Shifman <ma...@yale.edu> wrote:
> 
>> You need to follow the tomcat documentation
>> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
>> and you don't need to download anything.
>>
>>> DBCP uses the Jakarta-Commons Database Connection Pool. It relies on
>>> number of Jakarta-Commons components:
>>>
>>>    * Jakarta-Commons DBCP
>>>    * Jakarta-Commons Collections
>>>    * Jakarta-Commons Pool
>>>
>>> These libraries are located in a single JAR at
>>> |$CATALINA_HOME/common/lib/naming-factory-dbcp.jar|. However, only the
>>> classes needed for connection pooling have been included, and the packages
>>> have been renamed to avoid interfering with applications.
>>>
>>
>> bye webster wrote:
>>
>>> Hello,
>>>
>>> I recently research on how to implement Database Connection Pooling into
>>> Tomcat 5.5 server.
>>> After downloaded dbcp.jar and pool.jar from Jakarta project and I follow
>>> through the guideline provided.
>>> Unfortunately, It is only working when i set jar file path in CLASSPATH
>>> but
>>> it unable load it when it is keep inside jre/lib/ext directory.
>>> I thought all the jar will load in /lib/ext directory for all tomcat user.
>>>
>>> Who's know what's happening? i don't want messy my classpath setting so
>>> who's know how to load it from lib/ext directory?
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
>> For additional commands, e-mail: user-help@commons.apache.org
>>
>>
> 



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


Re: dbcp issue: unable load commons-dbcp.jar and commons-pool.jar in lib/ext

Posted by bye webster <we...@gmail.com>.
I had follow through the guideline from
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html.
It is not working, it unable locate the <resource> in <context>. The
datasource.getConnection was return null. My appBase is mainhost and web
application is webapps directory.

This is my context in server.xml

        <Context path="/webapps" docBase="webapps" debug="5"
reloadable="true" crossContext="true">
            <Resource name="jdbc/myinformix" auth="Container"
                  type="javax.sql.DataSource"
driverClassName="com.informix.jdbc.IfxDriver"

url="jdbc:informix-sqli://hostname:port/dbname:INFORMIXSERVER=servernum;"
                  username="uid" password="password" maxActive="20"
maxIdle="10" maxWait="-1"/>

        </Context>

This is my web.xml

    <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/myinformix</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

this is how system invoked

      Context initContext = new InitialContext();
      Context envContext = (Context) initContext.lookup("java:/comp/env");
      DataSource ds = (DataSource) envContext.lookup("jdbc/myinformix");
      Connection conn = ds.getConnection();

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

On Tue, Jul 28, 2009 at 8:45 PM, Mark Shifman <ma...@yale.edu> wrote:

> You need to follow the tomcat documentation
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> and you don't need to download anything.
>
>>
>> DBCP uses the Jakarta-Commons Database Connection Pool. It relies on
>> number of Jakarta-Commons components:
>>
>>    * Jakarta-Commons DBCP
>>    * Jakarta-Commons Collections
>>    * Jakarta-Commons Pool
>>
>> These libraries are located in a single JAR at
>> |$CATALINA_HOME/common/lib/naming-factory-dbcp.jar|. However, only the
>> classes needed for connection pooling have been included, and the packages
>> have been renamed to avoid interfering with applications.
>>
>
>
> bye webster wrote:
>
>> Hello,
>>
>> I recently research on how to implement Database Connection Pooling into
>> Tomcat 5.5 server.
>> After downloaded dbcp.jar and pool.jar from Jakarta project and I follow
>> through the guideline provided.
>> Unfortunately, It is only working when i set jar file path in CLASSPATH
>> but
>> it unable load it when it is keep inside jre/lib/ext directory.
>> I thought all the jar will load in /lib/ext directory for all tomcat user.
>>
>> Who's know what's happening? i don't want messy my classpath setting so
>> who's know how to load it from lib/ext directory?
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@commons.apache.org
> For additional commands, e-mail: user-help@commons.apache.org
>
>

Re: dbcp issue: unable load commons-dbcp.jar and commons-pool.jar in lib/ext

Posted by Mark Shifman <ma...@yale.edu>.
You need to follow the tomcat documentation
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
and you don't need to download anything.
>
> DBCP uses the Jakarta-Commons Database Connection Pool. It relies on 
> number of Jakarta-Commons components:
>
>     * Jakarta-Commons DBCP
>     * Jakarta-Commons Collections
>     * Jakarta-Commons Pool
>
> These libraries are located in a single JAR at 
> |$CATALINA_HOME/common/lib/naming-factory-dbcp.jar|. However, only the 
> classes needed for connection pooling have been included, and the 
> packages have been renamed to avoid interfering with applications.


bye webster wrote:
> Hello,
>
> I recently research on how to implement Database Connection Pooling into
> Tomcat 5.5 server.
> After downloaded dbcp.jar and pool.jar from Jakarta project and I follow
> through the guideline provided.
> Unfortunately, It is only working when i set jar file path in CLASSPATH but
> it unable load it when it is keep inside jre/lib/ext directory.
> I thought all the jar will load in /lib/ext directory for all tomcat user.
>
> Who's know what's happening? i don't want messy my classpath setting so
> who's know how to load it from lib/ext directory?
>
>   


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