This context.xml is the one in /conf. From what I understand (and according
to the apache site) this
is where you put stuff that you want to be loaded by all webapps.
The /META-INF/context.xml would be for things that are more application
specific.(I'm making an educated guess here).  Here is what my
/conf/context.xml looks like:

<!-- The contents of this file will be loaded for each web application -->
<Context>

    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat
restarts -->
    <!--
    <Manager pathname="" />
    -->

    <!-- Uncomment this to enable Comet connection tacking (provides events
         on session expiration as well as webapp lifecycle) -->
    <!--
    <Valve
className="org.apache.catalina.valves.CometConnectionManagerValve" />
    -->

</Context>

<Context path="/DBTest" docBase="DBTest"
        debug="5" reloadable="true" crossContext="true">

    <!-- maxActive: Maximum number of dB connections in pool. Make sure you
         configure your mysqld max_connections large enough to handle
         all of your db connections. Set to 0 for no limit.
         -->

    <!-- maxIdle: Maximum number of idle dB connections to retain in pool.
         Set to -1 for no limit.  See also the DBCP documentation on this
         and the minEvictableIdleTimeMillis configuration parameter.
         -->

    <!-- maxWait: Maximum time to wait for a dB connection to become
available
         in ms, in this example 10 seconds. An Exception is thrown if
         this timeout is exceeded.  Set to -1 to wait indefinitely.
         -->

    <!-- username and password: MySQL dB username and password for dB
connections  -->

    <!-- driverClassName: Class name for the old mm.mysql JDBC driver is
         org.gjt.mm.mysql.Driver - we recommend using Connector/J though.
         Class name for the official MySQL Connector/J driver is
com.mysql.jdbc.Driver.
         -->

    <!-- url: The JDBC connection url for connecting to your MySQL dB.
         The autoReconnect=true argument to the url makes sure that the
         mm.mysql JDBC Driver will automatically reconnect if mysqld closed
the
         connection.  mysqld by default closes idle connections after 8
hours.
         -->

  <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="javauser" password="javadude"
driverClassName="com.mysql.jdbc.Driver"
              
url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>

</Context>

I added the second <Context element  and all the stuff within.  Originally
it was just the first <Context
element, and the stuff there.

Should I have put that second <Context element in /META-IINF instead ?


cuco2772 wrote:
> 
> I set up the test app and the database as per the instructions provided on
> that link you gave me which
> I will reproduce here :
> 
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html
> 
> I put everything within the <Context ... element (under heading 2.Context
> Configuration) into 
> a separate <Context element in conf/context.xml.  (Underneath the first
> one)
> 
> Inside webapps I created a directory called DBTest for the webapp. Inside
> that I created a WEB-INF
> subdirectory, and put a web.xml with the contents of everything under 
> heading 3. web.xml configuration.  I added a subdirectory /lib to WEB-INF
> into which I copied
> both jstl.jar and standard.jar. (As per the directions under heading 4.
> Test Code) 
> I copied test.jsp to the DBTest directory and when I tried to 
> access the url ttp:localhost:8080/DBTest/test.jsp,  I got the all too
> familiar '404, Resource not found' error.
> 
> I can't of anything I did wrong, at least as far as the directions on that
> site go.
> Is there any thing additional that needs to go into web.xml that I am
> leaving out ?
> 
> A quick peek at catalina.out showed this :
> 
>   [EMAIL PROTECTED]:/usr/local/tomcat/apache-tomcat-6.0.14/logs# tail -n 100
> catalina.out
> Jan 14, 2008 5:26:24 PM org.apache.catalina.core.StandardContext start
> SEVERE: Error getConfigured
> Jan 14, 2008 5:26:24 PM org.apache.catalina.core.StandardContext start
> SEVERE: Context [/docs] startup failed due to previous errors
> Jan 14, 2008 5:26:24 PM org.apache.tomcat.util.digester.Digester
> fatalError
> SEVERE: Parse Fatal Error at line 20 column 2: The markup in the document
> following the root element must be well-formed.
> 
> So it seems to be complaining about my context.xml. The offending line
> looks to be :
> 
>  <Context path="/DBTest" docBase="DBTest"
>         debug="5" reloadable="true" crossContext="true">
> 
> Could the path attribute be incorrect ? I followed the directions exactly. 
> 
> 
> David Smith-2 wrote:
>> 
>> Find the mysql-connector-java-5.0.8.jar file in the download you 
>> received from mysql.com.  Put only that file in tomcat's lib directory.  
>> Remove the rest from tomcat's lib directory and things should be good to 
>> go.  If the mysql .jar file is located anywhere else in your tomcat 
>> installation including any of your webapps, please remove it from all 
>> those other places.  It can be either in tomcat's lib directory OR your 
>> webapp's WEB-INF/lib directory -- never both.
>> 
>> --David
>> 
>> cuco2772 wrote:
>>> Where is the jdbc driver normally located ? I did a 'locate jdbc' and
>>> found
>>> it in a bunch of places, ie, 
>>> /usr/lib/jvm/java-6-sun-1.6.0.00/imq/demo/jdbc/config.properties.mysql
>>>
>>> Would it be in this directory in tomcat ?:
>>>
>>> [EMAIL 
>>> PROTECTED]:/usr/local/tomcat/apache-tomcat-6.0.14/lib/mysql-connector-java-5.0.8
>>>  
>>>
>>> (I also have the mysql-connector-java-5.0.8-bin.jar file copied to /lib,
>>> but
>>> not in
>>> mysql-connector-java-5.0.8.
>>>
>>>
>>> Caldarale, Charles R wrote:
>>>   
>>>>> From: cuco2772 [mailto:[EMAIL PROTECTED] 
>>>>> Subject: Re: how to configure (server.xml) for mysql dev with 
>>>>> tomcat/JDBC
>>>>>
>>>>> I gathered from that doc that you would put a <Context> 
>>>>> element directly in conf/context.xml, and not in
>>>>> server.xml, as previously. 
>>>>>       
>>>> No.  The <Context> element in conf/context.xml is for attributes that
>>>> are common to all webapps deployed in Tomcat.  An individual webapp's
>>>> <Context> element should be in the webapp's META-INF/context.xml file.
>>>>
>>>>  - 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: [EMAIL PROTECTED]
>>>> For additional commands, e-mail: [EMAIL PROTECTED]
>>>>
>>>>
>>>>
>>>>     
>>>
>>>   
>> 
>> 
>> ---------------------------------------------------------------------
>> To start a new topic, e-mail: users@tomcat.apache.org
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14825061.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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to