You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Marchioni Francesco <f....@pride.it> on 2005/04/07 15:09:10 UTC

Using Tomcat 5.5.x with Mysql

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:371
)
	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.ja
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:82
2)
	at
org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:83
3)
	at
org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:1
48)
	at
org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:12
3)
	at
org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryIm
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: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Using Tomcat 5.5.x with Mysql

Posted by David Smith <dn...@cornell.edu>.
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:371
>)
>	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.ja
>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:82
>2)
>	at
>org.apache.catalina.connector.RequestFacade.getSession(RequestFacade.java:83
>3)
>	at
>org.apache.jasper.runtime.PageContextImpl._initialize(PageContextImpl.java:1
>48)
>	at
>org.apache.jasper.runtime.PageContextImpl.initialize(PageContextImpl.java:12
>3)
>	at
>org.apache.jasper.runtime.JspFactoryImpl.internalGetPageContext(JspFactoryIm
>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: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>  
>



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