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

how to configure (server.xml) for mysql dev with tomcat/JDBC

 Hello all;

I'm in need of some help in setting up my environment correctly. I have
mysql 5.0, tomcat 6, and am running tomcat through apache2.

I downloaded mysql-connector-java-5.0.8-bin.jar and put it in

/usr/local/tomcat/apache-tomcat-6.0.14/lib

There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if thats
correct

I did this also:

export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
mysql-connector-java-5.0.8-bin.jar:$CLASSPATH

As you can see, I'm pretty clueless as to what to do. I am inexperienced
with configuring tomcat so this seems very complex to me.  Here is the best
info I could find after a few hours of searching the web:

http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-j2ee.html#connector-j-usagenotes-tomcat

This is for tomcat5.5, not tomcat 6.   Not sure whats supposed to in place
of the  (...) after <Context  either.
Would it be safe to follow these directions even though I have tomcat6 ? I'm
starting to realize that
sometimes it's better not to install the latest versions of software, as
there's often less info about them.

I'm not sure if its ok to add Context elements to the main server.xml file
like that in tomcat6.
>From the docs i read at the Apache-Tomcat6 site, it seems to indicate that
it isn't.
Not sure if I need to configure any other .xml files either. I've run across
info that says you need to
add a <resource> element somewhere. Any info would be greatly appreciated,
even if its just pointing 
me to some directions for configuring tomcat6 for mysql.

 Thanks in advance.
-- 
View this message in context: http://www.nabble.com/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14793219.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: cuco2772 [mailto:poaa27@gmail.com] 
> Subject: RE: how to configure (server.xml) for mysql dev with 
> tomcat/JDBC
> 
> Thats the directory that the binary download extracted into. 

There's no "binary download" of the MySQL driver - the .zip (or .tar.gz)
file contains the full source and build scripts as well as the driver
.jar file.  The .zip should be expanded somewhere completely outside of
Tomcat, and only the .jar copied to Tomcat's lib directory.

> I decided to move the  mysql-connector-java-5.0.8 directory
> to /apache-tomcat-6.0.14/lib also, in case some of those files
> were needed.  

Bad idea.  The driver .jar contains everything needed.  Don't make
arbitrary changes "just in case" - you'll only be introducing problems.

 - 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
Thats the directory that the binary download extracted into. It contains
subdirectories src, doc, debug, and other stuff like README, as well as the
.jar file. I had the directory originally in
webapps/examples/WEB-INF/lib,and copied the .jar file to its present
location in 
/apache-tomcat-6.0.14/lib. 
I decided to move the  mysql-connector-java-5.0.8 directory to
/apache-tomcat-6.0.14/lib also, in case
some of those files were needed.  


Caldarale, Charles R wrote:
> 
>> From: cuco2772 [mailto:poaa27@gmail.com] 
>> Subject: RE: how to configure (server.xml) for mysql dev with 
>> tomcat/JDBC
>> 
>> Would it be in this directory in tomcat ?:
>> /usr/local/tomcat/apache-tomcat-6.0.14/lib/mysql-connector-java-5.0.8 
> 
> I don't know why you would create that directory; it doesn't appear to
> be needed for anything.
> 
> The lib directory is the appropriate location for the driver jar; this
> allows Tomcat to manage the DB connection pooling.
> 
>  - 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
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14795028.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: cuco2772 [mailto:poaa27@gmail.com] 
> Subject: RE: how to configure (server.xml) for mysql dev with 
> tomcat/JDBC
> 
> Would it be in this directory in tomcat ?:
> /usr/local/tomcat/apache-tomcat-6.0.14/lib/mysql-connector-java-5.0.8 

I don't know why you would create that directory; it doesn't appear to
be needed for anything.

The lib directory is the appropriate location for the driver jar; this
allows Tomcat to manage the DB connection pooling.

 - 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by David Smith <dn...@cornell.edu>.
Let's see if we can clear up the whole context.xml thing. 

Each webapp has it's own "context.xml" file.  The context.xml file in 
the conf directory is the one bringing defaults for ALL webapps to the 
party.  Don't mess with that file unless you want to change the default 
tomcat behavior.  Restore that to the original provided by your tomcat 
download. 

Create a new "context.xml" file and place it in one of two places:  
named context.xml literally in your webapp's META-INF folder OR in 
tomcat's conf/Catalina/localhost folder and name it after your webapp 
(e.g. myApp.xml).  In that file is just the Context element for your 
webapp, it's attributes, and any elements inside it like <Resource ... 
/> where you define your database pool.

--David

cuco2772 wrote:
> 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 :
>>
>>   root@coati:/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 ?:
>>>>
>>>> root@coati:/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:poaa27@gmail.com] 
>>>>>> 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: 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: cuco2772 [mailto:poaa27@gmail.com] 
> Subject: Re: how to configure (server.xml) for mysql dev with 
> tomcat/JDBC
> 
> A final note on this thread.  I'm wondering about the purpose 
> of having both a web.xml in DBTest/WEB-INF and a context.xml
> in DBTest/META-INF.

Sounds like you need to become familiar with the servlet spec (JSR-154).
The syntax and semantics of web.xml are defined by the spec, but the
<Context> element is unique to Tomcat, defining container-specific items
not covered by the spec.

> First of all, which does tomcat look at first ?

Don't know, and I don't think it matters.  Both have to be examined.
The real question is which one overrides if there are conflicts between
the two; I can't answer it because I haven't looked at that portion of
the code.

> So I was under the impression that META-INF was more normally 
> used to place .jars or .wars,

That's completely wrong.  Jars go into WEB-INF/lib (as required by the
servlet spec); .war files are packaged webapps and must be placed in a
container specified deployment location.

> what does the 'auth' attribute for ?

It specifies whether the container or the webapp is responsible for any
authentication required to utilize the resource.  Again, read the
servlet spec.

 - 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
A final note on this thread.  I'm wondering about the purpose of having both
a web.xml in 
DBTest/WEB-INF and a context.xml in DBTest/META-INF.  First of all, which
does tomcat look at first ?
If I had to guess I'd say it probably loads the web.xml first because of
this:

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

Then it looks for the definitions for the things referenced above  in
META-INF/context.xml, ie:

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

So I was under the impression that META-INF was more normally  used to place
.jars or .wars,
but I guess in this case it's ok for contexts too ?

And maybe I'm getting too much into the minuteia of this at the moment, but
what does the
'auth' attribute for ? Usually auth is short for authorization, or maybe
authority.
'auth=Container' doesn't make any sense to me. 
Thanks again for all the helpful replies.


cuco2772 wrote:
> 
> Just a follow up.  I copied the 2nd <Context to META-INF/context.xml and
> it worked !
> It's kind of funny because I was saying to myself "There is 0% chance this
> is going to work"  to prepare
> myself for the usual failures and multitudes of tries it's taken to get
> things to work up to now.
> I guess I was surprised that things worked after only the third or 4th
> try. Thanks David !
> 
> 
> David Smith-2 wrote:
>> 
>> Yes -- your on the right path now.  Your email seems to have crossed 
>> with mine.  Take the <Context  > element for DBTest out of 
>> conf/context.xml and put it in one of these two places -- 
>> conf/Catalina/localhost/DBTest.xml or
>> webapps/DBTest/META-INF/context.xml):
>> 
>> All it needs to contain is:
>> 
>>  <Context>
>>   <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>
>> 
>> --David
>> 
>> cuco2772 wrote:
>>> I'm starting to think that putting that <Context in the main
>>> conf/context.xml
>>> is not the way to go.
>>> It makes my other test webapp 'cucoweb' break. Should I put this
>>> <Context in
>>> a context.xml within
>>> DBTest, ie, in the DBTest directory, or some subdirectory of it ? 
>>> Should I
>>> rename it to DBTest.xml ?
>>>  
>>>
>>>
>>> cuco2772 wrote:
>>>   
>>>> 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 :
>>>>>
>>>>>   root@coati:/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 ?:
>>>>>>>
>>>>>>> root@coati:/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:poaa27@gmail.com] 
>>>>>>>>> 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: 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/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14855490.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
Just a follow up.  I copied the 2nd <Context to META-INF/context.xml and it
worked !
It's kind of funny because I was saying to myself "There is 0% chance this
is going to work"  to prepare
myself for the usual failures and multitudes of tries it's taken to get
things to work up to now.
I guess I was surprised that things worked after only the third or 4th try.
Thanks David !


David Smith-2 wrote:
> 
> Yes -- your on the right path now.  Your email seems to have crossed 
> with mine.  Take the <Context  > element for DBTest out of 
> conf/context.xml and put it in one of these two places -- 
> conf/Catalina/localhost/DBTest.xml or
> webapps/DBTest/META-INF/context.xml):
> 
> All it needs to contain is:
> 
>  <Context>
>   <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>
> 
> --David
> 
> cuco2772 wrote:
>> I'm starting to think that putting that <Context in the main
>> conf/context.xml
>> is not the way to go.
>> It makes my other test webapp 'cucoweb' break. Should I put this <Context
>> in
>> a context.xml within
>> DBTest, ie, in the DBTest directory, or some subdirectory of it ?  Should
>> I
>> rename it to DBTest.xml ?
>>  
>>
>>
>> cuco2772 wrote:
>>   
>>> 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 :
>>>>
>>>>   root@coati:/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 ?:
>>>>>>
>>>>>> root@coati:/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:poaa27@gmail.com] 
>>>>>>>> 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: 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/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14848963.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by David Smith <dn...@cornell.edu>.
Yes -- your on the right path now.  Your email seems to have crossed 
with mine.  Take the <Context  > element for DBTest out of 
conf/context.xml and put it in one of these two places -- 
conf/Catalina/localhost/DBTest.xml or webapps/DBTest/META-INF/context.xml):

All it needs to contain is:

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

--David

cuco2772 wrote:
> I'm starting to think that putting that <Context in the main conf/context.xml
> is not the way to go.
> It makes my other test webapp 'cucoweb' break. Should I put this <Context in
> a context.xml within
> DBTest, ie, in the DBTest directory, or some subdirectory of it ?  Should I
> rename it to DBTest.xml ?
>  
>
>
> cuco2772 wrote:
>   
>> 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 :
>>>
>>>   root@coati:/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 ?:
>>>>>
>>>>> root@coati:/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:poaa27@gmail.com] 
>>>>>>> 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: 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
I'm starting to think that putting that <Context in the main conf/context.xml
is not the way to go.
It makes my other test webapp 'cucoweb' break. Should I put this <Context in
a context.xml within
DBTest, ie, in the DBTest directory, or some subdirectory of it ?  Should I
rename it to DBTest.xml ?
 


cuco2772 wrote:
> 
> 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 :
>> 
>>   root@coati:/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 ?:
>>>>
>>>> root@coati:/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:poaa27@gmail.com] 
>>>>>> 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: 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/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14826255.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
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 :
> 
>   root@coati:/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 ?:
>>>
>>> root@coati:/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:poaa27@gmail.com] 
>>>>> 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: 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/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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Mark Thomas [mailto:markt@apache.org] 
> Subject: Re: how to configure (server.xml) for mysql dev with 
> tomcat/JDBC
> 
> Which bit do you think is broken?

I don't think the doc is actually broken in this area, just a bit
misleading.  The <Context> examples in the JNDI Datasource HOW-TO
continue to use the path and docBase attributes; these should be removed
to conform to the current practice of keeping <Context> elements out of
server.xml.

 - 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by Mark Thomas <ma...@apache.org>.
Christopher Schultz wrote:
> Cuco,
> 
> cuco2772 wrote:
> | 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.
> 
> I think those instructions have been (sadly) broken for a long time. I'm
> not sure why nobody has fixed them:

Which bit do you think is broken?

As to the why - Tomcat is a community to which we all contribute. Given 
this, the question is really 'Why haven't you done something about it?'

If you spot a mistake - create a bugzilla entry. Better yet, provide a 
patch to fix it.

Mark

---------------------------------------------------------------------
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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by Mark Thomas <ma...@apache.org>.
Christopher Schultz wrote:
> Cuco,
> 
> cuco2772 wrote:
> | 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.
> 
> I think those instructions have been (sadly) broken for a long time. I'm
> not sure why nobody has fixed them:

Which bit do you think is broken?

Mark

---------------------------------------------------------------------
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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Cuco,

cuco2772 wrote:
| 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.

I think those instructions have been (sadly) broken for a long time. I'm
not sure why nobody has fixed them:

<Context> elements in META-INF/context.xml /should not/ contain "path"
of "docBase" attributes at all. Remove them. That change may fix your
404 problems, then we can move on to the JDBC issues.

As for your non-well-formed XML file, you'll have to post more of the
XML file or debug it yourself. The line of XML you provided is perfectly
valid, so the error must be somewhere else or involve much more of the
document that you posted.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeMB6sACgkQ9CaO5/Lv0PCKuACgmT8cw5YEwfsquCFTi/uwrZ0Q
YS8An1p89hVUHbLqP0G3FlyTDhSyLWqK
=QIvg
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
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 :

  root@coati:/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 ?:
>>
>> root@coati:/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:poaa27@gmail.com] 
>>>> 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: 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/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14822673.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by David Smith <dn...@cornell.edu>.
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 ?:
>
> root@coati:/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:poaa27@gmail.com] 
>>> 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: 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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
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 ?:

root@coati:/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:poaa27@gmail.com] 
>> 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: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14794771.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: cuco2772 [mailto:poaa27@gmail.com] 
> 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: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
I read the docs at the link you provided but have a few questions.
I gathered from that doc that you would put a <Context> element directly in
conf/context.xml, and not in
server.xml, as previously. 

Do you need to somehow reference your webapp within the context, in other
words, do you need separate
<Contexts for each webapp ?  How do you reference your webapp within the
<Context ?
Please forgive the elementary questions. This is not easy stuff to wrap your
mind around for noobs.
Thanks



David Smith-2 wrote:
> 
>>
>> There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if
>> thats
>> correct
>>   
> Remove this one.  It will conflict with the one in tomcat's lib directory.
> 
>> export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
>> mysql-connector-java-5.0.8-bin.jar:$CLASSPATH
>>   
> Don't ever set the classpath -- it will cause whole worlds of pain and 
> agony.  Tomcat's classloaders will handle finding the jars and making 
> them available.
> 
> I would highly recommend you take a look at 
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 
> for authoritative information on how to configure tomcat 6.
> 
> --David
> 
> cuco2772 wrote:
>>  Hello all;
>>
>> I'm in need of some help in setting up my environment correctly. I have
>> mysql 5.0, tomcat 6, and am running tomcat through apache2.
>>
>> I downloaded mysql-connector-java-5.0.8-bin.jar and put it in
>>
>> /usr/local/tomcat/apache-tomcat-6.0.14/lib
>>
>> There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if
>> thats
>> correct
>>
>> I did this also:
>>
>> export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
>> mysql-connector-java-5.0.8-bin.jar:$CLASSPATH
>>
>> As you can see, I'm pretty clueless as to what to do. I am inexperienced
>> with configuring tomcat so this seems very complex to me.  Here is the
>> best
>> info I could find after a few hours of searching the web:
>>
>> http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-j2ee.html#connector-j-usagenotes-tomcat
>>
>> This is for tomcat5.5, not tomcat 6.   Not sure whats supposed to in
>> place
>> of the  (...) after <Context  either.
>> Would it be safe to follow these directions even though I have tomcat6 ?
>> I'm
>> starting to realize that
>> sometimes it's better not to install the latest versions of software, as
>> there's often less info about them.
>>
>> I'm not sure if its ok to add Context elements to the main server.xml
>> file
>> like that in tomcat6.
>> From the docs i read at the Apache-Tomcat6 site, it seems to indicate
>> that
>> it isn't.
>> Not sure if I need to configure any other .xml files either. I've run
>> across
>> info that says you need to
>> add a <resource> element somewhere. Any info would be greatly
>> appreciated,
>> even if its just pointing 
>> me to some directions for configuring tomcat6 for mysql.
>>
>>  Thanks in advance.
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14794245.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

cuco,

cuco2772 wrote:
| Thanks for the link. Under the DBCP heading it states 'Versions of mysql
| ...........that have been known to work'. I dont see any mention of my
| version, 5.0. Could that possibly be an issue as far as things like JDBC?
| I'd prefer to resolve any version issues before I attempt this.

MySQL 5.0 and the Connector/J 5.0.8 certainly /do/ work with DBCP.

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkeKuiQACgkQ9CaO5/Lv0PCyagCgle9kf4iYlTs+lWnmxFqzpxxe
zQwAoKr10T4fZbtGhhTpI+uljZTIYiH8
=stAU
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by cuco2772 <po...@gmail.com>.
Thanks for the link. Under the DBCP heading it states 'Versions of mysql
...........that have been known to work'. I dont see any mention of my
version, 5.0. Could that possibly be an issue as far as things like JDBC? 
I'd prefer to resolve any version issues before I attempt this.
 

David Smith-2 wrote:
> 
>>
>> There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if
>> thats
>> correct
>>   
> Remove this one.  It will conflict with the one in tomcat's lib directory.
> 
>> export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
>> mysql-connector-java-5.0.8-bin.jar:$CLASSPATH
>>   
> Don't ever set the classpath -- it will cause whole worlds of pain and 
> agony.  Tomcat's classloaders will handle finding the jars and making 
> them available.
> 
> I would highly recommend you take a look at 
> http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 
> for authoritative information on how to configure tomcat 6.
> 
> --David
> 
> cuco2772 wrote:
>>  Hello all;
>>
>> I'm in need of some help in setting up my environment correctly. I have
>> mysql 5.0, tomcat 6, and am running tomcat through apache2.
>>
>> I downloaded mysql-connector-java-5.0.8-bin.jar and put it in
>>
>> /usr/local/tomcat/apache-tomcat-6.0.14/lib
>>
>> There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if
>> thats
>> correct
>>
>> I did this also:
>>
>> export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
>> mysql-connector-java-5.0.8-bin.jar:$CLASSPATH
>>
>> As you can see, I'm pretty clueless as to what to do. I am inexperienced
>> with configuring tomcat so this seems very complex to me.  Here is the
>> best
>> info I could find after a few hours of searching the web:
>>
>> http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-j2ee.html#connector-j-usagenotes-tomcat
>>
>> This is for tomcat5.5, not tomcat 6.   Not sure whats supposed to in
>> place
>> of the  (...) after <Context  either.
>> Would it be safe to follow these directions even though I have tomcat6 ?
>> I'm
>> starting to realize that
>> sometimes it's better not to install the latest versions of software, as
>> there's often less info about them.
>>
>> I'm not sure if its ok to add Context elements to the main server.xml
>> file
>> like that in tomcat6.
>> From the docs i read at the Apache-Tomcat6 site, it seems to indicate
>> that
>> it isn't.
>> Not sure if I need to configure any other .xml files either. I've run
>> across
>> info that says you need to
>> add a <resource> element somewhere. Any info would be greatly
>> appreciated,
>> even if its just pointing 
>> me to some directions for configuring tomcat6 for mysql.
>>
>>  Thanks in advance.
>>   
> 
> 
> ---------------------------------------------------------------------
> 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/how-to-configure-%28server.xml%29-for-mysql-dev-with-tomcat-JDBC-tp14793219p14793614.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: how to configure (server.xml) for mysql dev with tomcat/JDBC

Posted by David Smith <dn...@cornell.edu>.
>
> There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if thats
> correct
>   
Remove this one.  It will conflict with the one in tomcat's lib directory.

> export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
> mysql-connector-java-5.0.8-bin.jar:$CLASSPATH
>   
Don't ever set the classpath -- it will cause whole worlds of pain and 
agony.  Tomcat's classloaders will handle finding the jars and making 
them available.

I would highly recommend you take a look at 
http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html 
for authoritative information on how to configure tomcat 6.

--David

cuco2772 wrote:
>  Hello all;
>
> I'm in need of some help in setting up my environment correctly. I have
> mysql 5.0, tomcat 6, and am running tomcat through apache2.
>
> I downloaded mysql-connector-java-5.0.8-bin.jar and put it in
>
> /usr/local/tomcat/apache-tomcat-6.0.14/lib
>
> There is also a copy in ...webapps/examples/WEB-INF/lib/, not sure if thats
> correct
>
> I did this also:
>
> export setCLASSPATH=/usr/local/tomcat/apache-tomcat-6.0.14/lib/
> mysql-connector-java-5.0.8-bin.jar:$CLASSPATH
>
> As you can see, I'm pretty clueless as to what to do. I am inexperienced
> with configuring tomcat so this seems very complex to me.  Here is the best
> info I could find after a few hours of searching the web:
>
> http://dev.mysql.com/doc/refman/5.0/en/connector-j-usagenotes-j2ee.html#connector-j-usagenotes-tomcat
>
> This is for tomcat5.5, not tomcat 6.   Not sure whats supposed to in place
> of the  (...) after <Context  either.
> Would it be safe to follow these directions even though I have tomcat6 ? I'm
> starting to realize that
> sometimes it's better not to install the latest versions of software, as
> there's often less info about them.
>
> I'm not sure if its ok to add Context elements to the main server.xml file
> like that in tomcat6.
> From the docs i read at the Apache-Tomcat6 site, it seems to indicate that
> it isn't.
> Not sure if I need to configure any other .xml files either. I've run across
> info that says you need to
> add a <resource> element somewhere. Any info would be greatly appreciated,
> even if its just pointing 
> me to some directions for configuring tomcat6 for mysql.
>
>  Thanks in advance.
>   


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