You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by AbelMacAdam <ab...@gmail.com> on 2008/01/02 14:05:24 UTC

NamingException

I have a piece of code that should get me a dataSource (from an example I'm
playing with from a Struts book):
[code]
    try {
      logger.info("DAOBase.getConnection: ====== InitialContext ======");
      context = new InitialContext();
      logger.info("DAOBase.getConnection: ====== context.lookup  ======");
      dataSource = (DataSource)
context.lookup("java:/comp/env/jdbc/myDataSource");
    }
    catch (NamingException e) {
      logger.info("DAOBase.getConnection: ====== NamingException ======",
e.fillInStackTrace());	
      throw new DAOException();
    }
[/code]

This is a piece of my logging:
[logging]
13:04:33,449 INFO  app15a.action.CreateCustomerAction - AMc: ++++++
getConnection ++++++++
13:04:33,449 INFO  app15a.action.CreateCustomerAction -
DAOBase.getConnection: ====== InitialContext ======
13:04:33,449 INFO  app15a.action.CreateCustomerAction -
DAOBase.getConnection: ====== context.lookup  ======
13:04:33,449 INFO  app15a.action.CreateCustomerAction -
DAOBase.getConnection: ====== NamingException ======
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
	at app15a.dao.DAOBase.getConnection(DAOBase.java:34)
	at
app15a.dao.CustomerDAOMySQLImpl.createCustomer(CustomerDAOMySQLImpl.java:44)
	at app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:44)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:421)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:852)
	at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:584)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
	at java.lang.Thread.run(Unknown Source)
[/logging]

As you might have noticed, I'm fairly new to this part of the neighborhood.
What should I do to remove this error?

I was advised to put the JDBC driver in the common/lib directory of my
TOMCAT_HOME. I don't have a common directory. I do have a TOMCAT_HOME/lib
directory. Am I correct in assuming I put my driver in that directory?

I also added the following Context element to my
TOMCAT_HOME/conf/server.xml:
[code]
    <!-- AMc: 02/01/2008: MySQL DataSource Object -->
    <Context path="/app15a" docBase="app15a" reloadable="true" debug="8">
        <Loader checkInterval="7" reloadable="true" />
        <Resource name="jdbc/myDataSource" auth="Container"
type="javax.sql.DataSource" />
        <ResourceParams name="jdbc/myDataSource">
            <parameter>
                <name>factory</name>
               
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
                <name>maxActive</name>
                <value>100</value>
            </parameter>
            <parameter>
                <name>maxWait</name>
                <value>10000</value>
            </parameter>
            <parameter>
                <name>username</name>
                <value>root</value>
            </parameter>
            <parameter>
                <name>password</name>
                <value></value>
            </parameter>
            <parameter>
                <name>driverClass</name>
                <value>com.mysql.jdbc.Driver</value>
            </parameter>
            <parameter>
                <name>url</name>
                <value>jdbc:mysql://localhost/test</value>
            </parameter>
        </ResourceParams>
    </Context>
  </Service>
</Server>
[/code]
Am I correct in assuming this piece of code does not contain a reference to
my JDBC driver? 

Any help would be appreciated, as I do not see what else I can do.

TIA,
Abel
-- 
View this message in context: http://www.nabble.com/NamingException-tp14578063p14578063.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: NamingException

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: AbelMacAdam [mailto:abel.macadam@gmail.com] 
> Subject: Re: NamingException
> 
> The context file contained the following entry:
> <Context path="/app15a" docBase="app15a" reloadable="true" debug="8">

More problems due to using old doc: the path and docBase attributes are
not allowed when using a META-INF/context.xml file.  They will probably
be ignored, but don't risk it.
http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: NamingException

Posted by AbelMacAdam <ab...@gmail.com>.
I'm using Tomcat 6.0. I found the solution by the way. I executed the
following steps:
1. I created a DataSource (I hope I have the language correct): In META-INF
I added a context.xml, as adding this DataSource to
%TOMCAT_HOME%/conf/server.xml is not the way to go (Changes in the code
would lead to having to restart Tomcat). The context file contained the
following entry:
<Context path="/app15a" docBase="app15a" reloadable="true" debug="8">
<Loader checkInterval="7" reloadable="true"/>
<Resource name="jdbc/myDataSource" auth="Container"
type="javax.sql.DataSource"
factory="org.apache.commons.dbcp.BasicDataSourceFactory" maxActive="100"
maxIdle="30" maxWait="10000" username="root" password=""
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/test"/>
</Context>
2. I copied a mysql-connector-java-5.1.5-bin.jar to my %TOMCAT_HOME%/lib 
3. I copied commons-dbcp-1.2.2.jar en commons-pool-1.3.jar files to the same
directory (ad I think more applications would benefit from these "Common"
files I preferred to have them in %TOMCAT_HOME%/lib, instead of the apps
lib.)

So the ResourceParams is now indeed part of the Resource element. 

Don't you love learning how it should work from an "old" book. But that is
the risk I run when I buy myself a book and next install software that is
new compared to the the book. I just saw a new version covering Struts 2.0
will come out in March this year. Hopefully I will be knowledgeable enough
at that time not needing that book to learn about 2.0 (only to reference
it).


David Smith-2 wrote:
> 
> ResourceParams doesn't exist in tomcat 5.5, 6.0.  All those parameters 
> became attributes of the <Resource .../> element.  What version of 
> tomcat are you using Abel?
> 
> --David
> 
> Mariano wrote:
> 
>>First of all if you are working with tomcat 5.5 you have to put your jdbc
>>library file in TOMCAT_HOME/common/lib but if you are using Tomcat 6.0 you
>>have to put files in TOMCAT_HOME/lib.
>>
>>I think that ResourceParams is nested to Resource and you have it out of
>>Resource.
>>
>>You must follow guidelines in
>>http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
>>to create DBCP.
>>
>>I hope this help you.
>>
>>Mariano
>>
>>-----Mensaje original-----
>>De: AbelMacAdam [mailto:abel.macadam@gmail.com]
>>Enviado el: miercoles, 02 de enero de 2008 14:05
>>Para: users@tomcat.apache.org
>>Asunto: NamingException
>>
>>
>>
>>I have a piece of code that should get me a dataSource (from an example
I'm
>>playing with from a Struts book):
>>[code]
>>    try {
>>      logger.info("DAOBase.getConnection: ====== InitialContext ======");
>>      context = new InitialContext();
>>      logger.info("DAOBase.getConnection: ====== context.lookup  ======");
>>      dataSource = (DataSource)
>>context.lookup("java:/comp/env/jdbc/myDataSource");
>>    }
>>    catch (NamingException e) {
>>      logger.info("DAOBase.getConnection: ====== NamingException ======",
>>e.fillInStackTrace());
>>      throw new DAOException();
>>    }
>>[/code]
>>
>>This is a piece of my logging:
>>[logging]
>>13:04:33,449 INFO  app15a.action.CreateCustomerAction - AMc: ++++++
>>getConnection ++++++++
>>13:04:33,449 INFO  app15a.action.CreateCustomerAction -
>>DAOBase.getConnection: ====== InitialContext ======
>>13:04:33,449 INFO  app15a.action.CreateCustomerAction -
>>DAOBase.getConnection: ====== context.lookup  ======
>>13:04:33,449 INFO  app15a.action.CreateCustomerAction -
>>DAOBase.getConnection: ====== NamingException ======
>>javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
>>	at app15a.dao.DAOBase.getConnection(DAOBase.java:34)
>>	at
>>app15a.dao.CustomerDAOMySQLImpl.createCustomer(CustomerDAOMySQLImpl.java:44)
>>	at
app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:44)
>>	at
>>org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
>>sor.java:421)
>>	at
>>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
>>	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
>>	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
>>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>>	at
>>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
>>FilterChain.java:290)
>>	at
>>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
>>ain.java:206)
>>	at
>>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
>>va:233)
>>	at
>>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
>>va:175)
>>	at
>>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
>>)
>>	at
>>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102
>>)
>>	at
>>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
>>:109)
>>	at
>>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>>	at
>>org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:
>>852)
>>	at
>>org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(H
>>ttp11AprProtocol.java:584)
>>	at
org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
>>	at java.lang.Thread.run(Unknown Source)
>>[/logging]
>>
>>As you might have noticed, I'm fairly new to this part of the
neighborhood.
>>What should I do to remove this error?
>>
>>I was advised to put the JDBC driver in the common/lib directory of my
>>TOMCAT_HOME. I don't have a common directory. I do have a TOMCAT_HOME/lib
>>directory. Am I correct in assuming I put my driver in that directory?
>>
>>I also added the following Context element to my
>>TOMCAT_HOME/conf/server.xml:
>>[code]
>>    <!-- AMc: 02/01/2008: MySQL DataSource Object -->
>>    <Context path="/app15a" docBase="app15a" reloadable="true" debug="8">
>>        <Loader checkInterval="7" reloadable="true" />
>>        <Resource name="jdbc/myDataSource" auth="Container"
>>type="javax.sql.DataSource" />
>>        <ResourceParams name="jdbc/myDataSource">
>>            <parameter>
>>                <name>factory</name>
>>
>><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>>            </parameter>
>>            <parameter>
>>                <name>maxActive</name>
>>                <value>100</value>
>>            </parameter>
>>            <parameter>
>>                <name>maxWait</name>
>>                <value>10000</value>
>>            </parameter>
>>            <parameter>
>>                <name>username</name>
>>                <value>root</value>
>>            </parameter>
>>            <parameter>
>>                <name>password</name>
>>                <value></value>
>>            </parameter>
>>            <parameter>
>>                <name>driverClass</name>
>>                <value>com.mysql.jdbc.Driver</value>
>>            </parameter>
>>            <parameter>
>>                <name>url</name>
>>                <value>jdbc:mysql://localhost/test</value>
>>            </parameter>
>>        </ResourceParams>
>>    </Context>
>>  </Service>
>></Server>
>>[/code]
>>Am I correct in assuming this piece of code does not contain a reference
to
>>my JDBC driver?
>>
>>Any help would be appreciated, as I do not see what else I can do.
>>
>>TIA,
>>Abel
>>--
>>View this message in context:
>>http://www.nabble.com/NamingException-tp14578063p14578063.html
>>Sent from the Tomcat - User mailing list archive at Nabble.com.
>>
>>
>>---------------------------------------------------------------------
>>To start a new topic, e-mail: users@tomcat.apache.org
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>---------------------------------------------------------------------
>>To start a new topic, e-mail: users@tomcat.apache.org
>>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>>For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>  
>>
> 
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/NamingException-tp14578063p14598133.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: NamingException

Posted by David Smith <dn...@cornell.edu>.
ResourceParams doesn't exist in tomcat 5.5, 6.0.  All those parameters 
became attributes of the <Resource .../> element.  What version of 
tomcat are you using Abel?

--David

Mariano wrote:

>First of all if you are working with tomcat 5.5 you have to put your jdbc
>library file in TOMCAT_HOME/common/lib but if you are using Tomcat 6.0 you
>have to put files in TOMCAT_HOME/lib.
>
>I think that ResourceParams is nested to Resource and you have it out of
>Resource.
>
>You must follow guidelines in
>http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
>to create DBCP.
>
>I hope this help you.
>
>Mariano
>
>-----Mensaje original-----
>De: AbelMacAdam [mailto:abel.macadam@gmail.com]
>Enviado el: miercoles, 02 de enero de 2008 14:05
>Para: users@tomcat.apache.org
>Asunto: NamingException
>
>
>
>I have a piece of code that should get me a dataSource (from an example I'm
>playing with from a Struts book):
>[code]
>    try {
>      logger.info("DAOBase.getConnection: ====== InitialContext ======");
>      context = new InitialContext();
>      logger.info("DAOBase.getConnection: ====== context.lookup  ======");
>      dataSource = (DataSource)
>context.lookup("java:/comp/env/jdbc/myDataSource");
>    }
>    catch (NamingException e) {
>      logger.info("DAOBase.getConnection: ====== NamingException ======",
>e.fillInStackTrace());
>      throw new DAOException();
>    }
>[/code]
>
>This is a piece of my logging:
>[logging]
>13:04:33,449 INFO  app15a.action.CreateCustomerAction - AMc: ++++++
>getConnection ++++++++
>13:04:33,449 INFO  app15a.action.CreateCustomerAction -
>DAOBase.getConnection: ====== InitialContext ======
>13:04:33,449 INFO  app15a.action.CreateCustomerAction -
>DAOBase.getConnection: ====== context.lookup  ======
>13:04:33,449 INFO  app15a.action.CreateCustomerAction -
>DAOBase.getConnection: ====== NamingException ======
>javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
>	at app15a.dao.DAOBase.getConnection(DAOBase.java:34)
>	at
>app15a.dao.CustomerDAOMySQLImpl.createCustomer(CustomerDAOMySQLImpl.java:44)
>	at app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:44)
>	at
>org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
>sor.java:421)
>	at
>org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
>	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
>	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
>	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>	at
>org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
>FilterChain.java:290)
>	at
>org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
>ain.java:206)
>	at
>org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
>va:233)
>	at
>org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
>va:175)
>	at
>org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
>)
>	at
>org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102
>)
>	at
>org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
>:109)
>	at
>org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
>	at
>org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:
>852)
>	at
>org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(H
>ttp11AprProtocol.java:584)
>	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
>	at java.lang.Thread.run(Unknown Source)
>[/logging]
>
>As you might have noticed, I'm fairly new to this part of the neighborhood.
>What should I do to remove this error?
>
>I was advised to put the JDBC driver in the common/lib directory of my
>TOMCAT_HOME. I don't have a common directory. I do have a TOMCAT_HOME/lib
>directory. Am I correct in assuming I put my driver in that directory?
>
>I also added the following Context element to my
>TOMCAT_HOME/conf/server.xml:
>[code]
>    <!-- AMc: 02/01/2008: MySQL DataSource Object -->
>    <Context path="/app15a" docBase="app15a" reloadable="true" debug="8">
>        <Loader checkInterval="7" reloadable="true" />
>        <Resource name="jdbc/myDataSource" auth="Container"
>type="javax.sql.DataSource" />
>        <ResourceParams name="jdbc/myDataSource">
>            <parameter>
>                <name>factory</name>
>
><value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>            </parameter>
>            <parameter>
>                <name>maxActive</name>
>                <value>100</value>
>            </parameter>
>            <parameter>
>                <name>maxWait</name>
>                <value>10000</value>
>            </parameter>
>            <parameter>
>                <name>username</name>
>                <value>root</value>
>            </parameter>
>            <parameter>
>                <name>password</name>
>                <value></value>
>            </parameter>
>            <parameter>
>                <name>driverClass</name>
>                <value>com.mysql.jdbc.Driver</value>
>            </parameter>
>            <parameter>
>                <name>url</name>
>                <value>jdbc:mysql://localhost/test</value>
>            </parameter>
>        </ResourceParams>
>    </Context>
>  </Service>
></Server>
>[/code]
>Am I correct in assuming this piece of code does not contain a reference to
>my JDBC driver?
>
>Any help would be appreciated, as I do not see what else I can do.
>
>TIA,
>Abel
>--
>View this message in context:
>http://www.nabble.com/NamingException-tp14578063p14578063.html
>Sent from the Tomcat - User mailing list archive at Nabble.com.
>
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>---------------------------------------------------------------------
>To start a new topic, e-mail: users@tomcat.apache.org
>To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: users-help@tomcat.apache.org
>
>  
>


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: NamingException

Posted by Mariano <ml...@sescam.org>.
First of all if you are working with tomcat 5.5 you have to put your jdbc
library file in TOMCAT_HOME/common/lib but if you are using Tomcat 6.0 you
have to put files in TOMCAT_HOME/lib.

I think that ResourceParams is nested to Resource and you have it out of
Resource.

You must follow guidelines in
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
to create DBCP.

I hope this help you.

Mariano

-----Mensaje original-----
De: AbelMacAdam [mailto:abel.macadam@gmail.com]
Enviado el: miercoles, 02 de enero de 2008 14:05
Para: users@tomcat.apache.org
Asunto: NamingException



I have a piece of code that should get me a dataSource (from an example I'm
playing with from a Struts book):
[code]
    try {
      logger.info("DAOBase.getConnection: ====== InitialContext ======");
      context = new InitialContext();
      logger.info("DAOBase.getConnection: ====== context.lookup  ======");
      dataSource = (DataSource)
context.lookup("java:/comp/env/jdbc/myDataSource");
    }
    catch (NamingException e) {
      logger.info("DAOBase.getConnection: ====== NamingException ======",
e.fillInStackTrace());
      throw new DAOException();
    }
[/code]

This is a piece of my logging:
[logging]
13:04:33,449 INFO  app15a.action.CreateCustomerAction - AMc: ++++++
getConnection ++++++++
13:04:33,449 INFO  app15a.action.CreateCustomerAction -
DAOBase.getConnection: ====== InitialContext ======
13:04:33,449 INFO  app15a.action.CreateCustomerAction -
DAOBase.getConnection: ====== context.lookup  ======
13:04:33,449 INFO  app15a.action.CreateCustomerAction -
DAOBase.getConnection: ====== NamingException ======
javax.naming.NameNotFoundException: Name jdbc is not bound in this Context
	at app15a.dao.DAOBase.getConnection(DAOBase.java:34)
	at
app15a.dao.CustomerDAOMySQLImpl.createCustomer(CustomerDAOMySQLImpl.java:44)
	at app15a.action.CreateCustomerAction.execute(CreateCustomerAction.java:44)
	at
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProces
sor.java:421)
	at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:226)
	at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1164)
	at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:415)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:290)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:233)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:175)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
	at
org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:
852)
	at
org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(H
ttp11AprProtocol.java:584)
	at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1508)
	at java.lang.Thread.run(Unknown Source)
[/logging]

As you might have noticed, I'm fairly new to this part of the neighborhood.
What should I do to remove this error?

I was advised to put the JDBC driver in the common/lib directory of my
TOMCAT_HOME. I don't have a common directory. I do have a TOMCAT_HOME/lib
directory. Am I correct in assuming I put my driver in that directory?

I also added the following Context element to my
TOMCAT_HOME/conf/server.xml:
[code]
    <!-- AMc: 02/01/2008: MySQL DataSource Object -->
    <Context path="/app15a" docBase="app15a" reloadable="true" debug="8">
        <Loader checkInterval="7" reloadable="true" />
        <Resource name="jdbc/myDataSource" auth="Container"
type="javax.sql.DataSource" />
        <ResourceParams name="jdbc/myDataSource">
            <parameter>
                <name>factory</name>

<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
            <parameter>
                <name>maxActive</name>
                <value>100</value>
            </parameter>
            <parameter>
                <name>maxWait</name>
                <value>10000</value>
            </parameter>
            <parameter>
                <name>username</name>
                <value>root</value>
            </parameter>
            <parameter>
                <name>password</name>
                <value></value>
            </parameter>
            <parameter>
                <name>driverClass</name>
                <value>com.mysql.jdbc.Driver</value>
            </parameter>
            <parameter>
                <name>url</name>
                <value>jdbc:mysql://localhost/test</value>
            </parameter>
        </ResourceParams>
    </Context>
  </Service>
</Server>
[/code]
Am I correct in assuming this piece of code does not contain a reference to
my JDBC driver?

Any help would be appreciated, as I do not see what else I can do.

TIA,
Abel
--
View this message in context:
http://www.nabble.com/NamingException-tp14578063p14578063.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org