Re: MySQL DBCP Connection Example?
Markus Schönhaber wrote: Martin Gainty: Im not baiting you but rebutting your wrong answer to davids right answer you pick fights with people and state what they say is wrong without doing any research Oh, please, this is ridiculous! You are wrong - as you are so often. And all the foot stamping of yours won't change that. Christopher was even kind enough to point you to the relevant part of the docs to make the research *you* have failed to do easier. Moreover, I have yet to see Christopher to pick fights with people or to do name calling on others (as *you* did). For the second time in recent memory, also on a thread about DBCP. p You should read Mark's reply to your previous post closely and do as he proposes in the last sentence. Regards mks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: MySQL DBCP Connection Example?
Im not baiting you but rebutting your wrong answer to davids right answer you pick fights with people and state what they say is wrong without doing any research Martin Gainty __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Sat, 18 Oct 2008 22:37:45 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Subject: Re: MySQL DBCP Connection Example? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin, Martin Gainty wrote: getting tired ot correcting these emails..david i From: [EMAIL PROTECTED] To: users@tomcat.apache.org Subject: Re: MySQL DBCP Connection Example? David, David Smith wrote: As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. docBase:yes path:no It is illegal to set the path of a Contect unless the context is MGPerfectly LEGAL Not so, Martin. Please read the documentation for the path attribute on TC's documentation (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html) which clearly states this legality. Just because TC doesn't complain if you set the path attribute (I would argue that it /should/) doesn't mean that it is legal. -(dumbkopf) chris Martin, I'm not going to get into a flame war with you no matter how much you bait me. I will continue to try to help users of this list with helpful and correct information that can be backed up by the official documentation. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkj6nXkACgkQ9CaO5/Lv0PACUACdGu/CFZcx5Jt5cSAHgXoArZy2 YqsAn3RYJy44hgMMfenEfsmBsPWZC6mB =KxdA -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ When your life is on the go—take your life with you. http://clk.atdmt.com/MRT/go/115298558/direct/01/
Re: MySQL DBCP Connection Example?
Martin Gainty: Im not baiting you but rebutting your wrong answer to davids right answer you pick fights with people and state what they say is wrong without doing any research Oh, please, this is ridiculous! You are wrong - as you are so often. And all the foot stamping of yours won't change that. Christopher was even kind enough to point you to the relevant part of the docs to make the research *you* have failed to do easier. Moreover, I have yet to see Christopher to pick fights with people or to do name calling on others (as *you* did). You should read Mark's reply to your previous post closely and do as he proposes in the last sentence. Regards mks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MySQL DBCP Connection Example?
Martin Gainty wrote: getting tired ot correcting these emails..david i Chris is correct in this case. It is you who is in error Martin. From: [EMAIL PROTECTED] To: users@tomcat.apache.org Subject: Re: MySQL DBCP Connection Example? David, David Smith wrote: As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. docBase:yes path:no It is illegal to set the path of a Contect unless the context is MGPerfectly LEGAL No. Chris is 100% correct. Path should only ever be used in a Context element when defined in server.xml and defining contexts in server.xml is a bad idea (as is made clear in the docs). comment out your manager context in /conf/Catalina/localhost !--Context docBase=${catalina.home}/server/webapps/manager privileged=true antiResourceLocking=false antiJARLocking=false -- !--ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ -- !-- /Context -- and look at what I see in the log DEBUG main org.apache.catalina.session.ManagerBase - No persisted data file found and you get 404 when accessing the manager app defined in server.xml, which you shouldn't do. Tomcat will use the name of the XML file as the context path (unless it's called ROOT, in which case the context path with be ). -(dumbkopf) chris There is no need for name calling even if Chris was wrong (which he isn't). Lets try and keep it professional. An apology would be a good place to start. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MySQL DBCP Connection Example?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Martin, Martin Gainty wrote: getting tired ot correcting these emails..david i From: [EMAIL PROTECTED] To: users@tomcat.apache.org Subject: Re: MySQL DBCP Connection Example? David, David Smith wrote: As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. docBase:yes path:no It is illegal to set the path of a Contect unless the context is MGPerfectly LEGAL Not so, Martin. Please read the documentation for the path attribute on TC's documentation (http://tomcat.apache.org/tomcat-6.0-doc/config/context.html) which clearly states this legality. Just because TC doesn't complain if you set the path attribute (I would argue that it /should/) doesn't mean that it is legal. -(dumbkopf) chris Martin, I'm not going to get into a flame war with you no matter how much you bait me. I will continue to try to help users of this list with helpful and correct information that can be backed up by the official documentation. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkj6nXkACgkQ9CaO5/Lv0PACUACdGu/CFZcx5Jt5cSAHgXoArZy2 YqsAn3RYJy44hgMMfenEfsmBsPWZC6mB =KxdA -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MySQL DBCP Connection Example?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David, David Smith wrote: As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. docBase:yes path:no It is illegal to set the path of a Contect unless the context is defined in server.xml, which you shouldn't do. Tomcat will use the name of the XML file as the context path (unless it's called ROOT, in which case the context path with be ). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkj4/2sACgkQ9CaO5/Lv0PDDngCgltZddUlasKaEJHpi/y54SvjB 9ysAn0Gk1fYRPI/HecvvOqhJc7+KxLfQ =MTsj -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: MySQL DBCP Connection Example?
getting tired ot correcting these emails..david i From: [EMAIL PROTECTED] To: users@tomcat.apache.org Subject: Re: MySQL DBCP Connection Example? -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David, David Smith wrote: As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. docBase:yes path:no It is illegal to set the path of a Contect unless the context is MGPerfectly LEGAL comment out your manager context in /conf/Catalina/localhost !--Context docBase=${catalina.home}/server/webapps/manager privileged=true antiResourceLocking=false antiJARLocking=false -- !--ResourceLink name=users global=UserDatabase type=org.apache.catalina.UserDatabase/ -- !-- /Context -- and look at what I see in the log DEBUG main org.apache.catalina.session.ManagerBase - No persisted data file found and you get 404 when accessing the manager app defined in server.xml, which you shouldn't do. Tomcat will use the name of the XML file as the context path (unless it's called ROOT, in which case the context path with be ). - -(dumbkopf) chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkj4/2sACgkQ9CaO5/Lv0PDDngCgltZddUlasKaEJHpi/y54SvjB 9ysAn0Gk1fYRPI/HecvvOqhJc7+KxLfQ =MTsj -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] _ Want to read Hotmail messages in Outlook? The Wordsmiths show you how. http://windowslive.com/connect/post/wedowindowslive.spaces.live.com-Blog-cns!20EE04FBC541789!167.entry?ocid=TXT_TAGLM_WL_hotmail_092008
Re: MySQL DBCP Connection Example?
Very true ... I've been working way too much lately. --David Christopher Schultz wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 David, David Smith wrote: As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. docBase:yes path:no It is illegal to set the path of a Contect unless the context is defined in server.xml, which you shouldn't do. Tomcat will use the name of the XML file as the context path (unless it's called ROOT, in which case the context path with be ). - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkj4/2sACgkQ9CaO5/Lv0PDDngCgltZddUlasKaEJHpi/y54SvjB 9ysAn0Gk1fYRPI/HecvvOqhJc7+KxLfQ =MTsj -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- David Smith Programmer/Analyst College of Agriculture and Life Sciences Cornell University B32 Morrison Hall Ithaca, NY 14853 Phone: (607) 255-4521 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
MySQL DBCP Connection Example?
I am attempting to setup a tomcat mysql connection in order to allow users to write jsp webapps that can use a mysql database backend. I have understood that this page seems to be a walkthrough on how to set this up, and I'm running into problems in the MySQL DBCP Example section. http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html I have followed the steps verbatim (except the javauser account password in mysql, I'm using something different) In step 2, I put the context... entry separate of the existing context entry located in $CATALINA_ROOT/conf/context.xml In step 3, I put the description and resource-ref at the end of the web.xml file (right before /web-app and I have created a testfile in $CATALINA_ROOT/webapps/ROOT/test.jsp When I restart tomcat, logs/catalina.out has some lines like the following (where line 36 is the new Context ... entry): Oct 15, 2008 1:55:02 PM org.apache.tomcat.util.digester.Digester fatalError SEVERE: Parse Fatal Error at line 36 column 2: The markup in the document following the root element must be well-formed. org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(XMLDocumentScannerImpl.java:1394) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644) at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:789) at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:728) at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1009) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.StandardContext.init(StandardContext.java:5338) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4086) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288) at
Re: MySQL DBCP Connection Example?
It'd be helpful if you could post that file. Sanitize it for db usernames and passwords, but post it so we can see what it looks like. Also, run it through an XML validator to see if there's any issues. Netbeans has one built-in. --David Tim Potter wrote: I am attempting to setup a tomcat mysql connection in order to allow users to write jsp webapps that can use a mysql database backend. I have understood that this page seems to be a walkthrough on how to set this up, and I'm running into problems in the MySQL DBCP Example section. http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html I have followed the steps verbatim (except the javauser account password in mysql, I'm using something different) In step 2, I put the context... entry separate of the existing context entry located in $CATALINA_ROOT/conf/context.xml In step 3, I put the description and resource-ref at the end of the web.xml file (right before /web-app and I have created a testfile in $CATALINA_ROOT/webapps/ROOT/test.jsp When I restart tomcat, logs/catalina.out has some lines like the following (where line 36 is the new Context ... entry): Oct 15, 2008 1:55:02 PM org.apache.tomcat.util.digester.Digester fatalError SEVERE: Parse Fatal Error at line 36 column 2: The markup in the document following the root element must be well-formed. org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195) at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:174) at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:388) at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1411) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$TrailingMiscDriver.next(XMLDocumentScannerImpl.java:1394) at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:645) at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:508) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807) at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737) at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107) at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205) at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522) at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1644) at org.apache.catalina.startup.ContextConfig.processContextConfig(ContextConfig.java:789) at org.apache.catalina.startup.ContextConfig.contextConfig(ContextConfig.java:728) at org.apache.catalina.startup.ContextConfig.init(ContextConfig.java:1009) at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:279) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.StandardContext.init(StandardContext.java:5338) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4086) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:926) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:889) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053) at org.apache.catalina.core.StandardHost.start(StandardHost.java:719) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443) at org.apache.catalina.core.StandardService.start(StandardService.java:516) at org.apache.catalina.core.StandardServer.start(StandardServer.java:710) at org.apache.catalina.startup.Catalina.start(Catalina.java:578) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
Re: MySQL DBCP Connection Example?
These are my web.xml, context.xml, and test.jsp files (truncated). Let me know if there are any other files you would like to see. [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/web.xml ?xml version=1.0 encoding=ISO-8859-1? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 !-- Introduction == -- !-- There is a bunch of stuff not included as its not relevant to this -- !-- Default Welcome File List = -- !-- When a request URI refers to a directory, the default servlet looks -- !-- for a welcome file within that directory and, if present, -- !-- to the corresponding resource URI for display. If no welcome file -- !-- is present, the default servlet either serves a directory listing, -- !-- or returns a 404 status, depending on how it is configured. -- !-- -- !-- If you define welcome files in your own application's web.xml -- !-- deployment descriptor, that list *replaces* the list configured -- !-- here, so be sure that you include any of the default values that -- !-- you wish to include. -- welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/context.xml ?xml version='1.0' encoding='utf-8'? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource /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 -1 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. --
Re: MySQL DBCP Connection Example?
I think I see your problem. Don't modify the default web.xml file or the default context.xml file unless you really have good reason to. Instead, your webapp should be layed out similar to this, per the servlet spec: DBTest - test.jsp - WEB-INF - web.xml - lib - standard.jar - jstl.jar - META-INF - context.xml All this goes under tomcat's webapps directory. Separately, put your mysql driver jar in tomcat's /lib directory for tomcat 6.0.x, /common/lib for most previous versions of tomcat. All the additional stuff you put in tomcat's /conf/web.xml and /conf/context.xml should be put in the web.xml and context.xml files shown above under DBTest. I've included standard.jar and jstl.jar above because your test.jsp is using the sql jstl taglib. --David Tim Potter wrote: These are my web.xml, context.xml, and test.jsp files (truncated). Let me know if there are any other files you would like to see. [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/web.xml ?xml version=1.0 encoding=ISO-8859-1? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 !-- Introduction == -- !-- There is a bunch of stuff not included as its not relevant to this -- !-- Default Welcome File List = -- !-- When a request URI refers to a directory, the default servlet looks -- !-- for a welcome file within that directory and, if present, -- !-- to the corresponding resource URI for display. If no welcome file -- !-- is present, the default servlet either serves a directory listing, -- !-- or returns a 404 status, depending on how it is configured. -- !-- -- !-- If you define welcome files in your own application's web.xml -- !-- deployment descriptor, that list *replaces* the list configured -- !-- here, so be sure that you include any of the default values that -- !-- you wish to include. -- welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/context.xml ?xml version='1.0' encoding='utf-8'? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- !-- The contents of this file will be loaded for each web application -- Context !-- Default set of monitored resources -- WatchedResourceWEB-INF/web.xml/WatchedResource /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 -1 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,
Re: MySQL DBCP Connection Example?
David, Thanks for your input, I can test that out, but that would be a different direction than I think I want to go. I have running an apache web server that users access home directories (mod_user) in order to run thier primarily php scripted web pages, but some would like the option of jsp. So currently I have tomcat running with mod_jk, and jkmount setup in apache awaiting /*.jsp to interpret, and i'm able to successfully run a test.jsp page which gets interpreted. On that note, should I just as easily create a ~user/public_html/WEB-INF/web.xml ...or do I need to modify things to the DBCP to function. Thanks and I appreciate the instructions! Tim Potter On Wed, Oct 15, 2008 at 6:00 PM, David Smith [EMAIL PROTECTED] wrote: I think I see your problem. Don't modify the default web.xml file or the default context.xml file unless you really have good reason to. Instead, your webapp should be layed out similar to this, per the servlet spec: DBTest - test.jsp - WEB-INF - web.xml - lib - standard.jar - jstl.jar - META-INF - context.xml All this goes under tomcat's webapps directory. Separately, put your mysql driver jar in tomcat's /lib directory for tomcat 6.0.x, /common/lib for most previous versions of tomcat. All the additional stuff you put in tomcat's /conf/web.xml and /conf/context.xml should be put in the web.xml and context.xml files shown above under DBTest. I've included standard.jar and jstl.jar above because your test.jsp is using the sql jstl taglib. --David Tim Potter wrote: These are my web.xml, context.xml, and test.jsp files (truncated). Let me know if there are any other files you would like to see. [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/web.xml ?xml version=1.0 encoding=ISO-8859-1? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 !-- Introduction == -- !-- There is a bunch of stuff not included as its not relevant to this -- !-- Default Welcome File List = -- !-- When a request URI refers to a directory, the default servlet looks -- !-- for a welcome file within that directory and, if present, -- !-- to the corresponding resource URI for display. If no welcome file -- !-- is present, the default servlet either serves a directory listing, -- !-- or returns a 404 status, depending on how it is configured. -- !-- -- !-- If you define welcome files in your own application's web.xml -- !-- deployment descriptor, that list *replaces* the list configured -- !-- here, so be sure that you include any of the default values that -- !-- you wish to include. -- welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/context.xml ?xml version='1.0' encoding='utf-8'? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under
RE: MySQL DBCP Connection Example?
From: Tim Potter [mailto:[EMAIL PROTECTED] Subject: Re: MySQL DBCP Connection Example? I can test that out, but that would be a different direction than I think I want to go. I don't think David was strong enough in his recommendations: you may not ever add additional Context elements to conf/context.xml - they really do need to be placed in each webapp's META-INF directory. Alternatively, you can place required Context elements in a conf/Catalina/[host]/[appName].xml file - one per webapp that actually needs a Context element (many don't). Likewise, updating conf/web.xml to specify settings for individual webapps results in those settings being applied to all webapps, even the ones that are distributed with Tomcat - not a good idea. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: MySQL DBCP Connection Example?
The servlet spec was designed around webapps being completely self-contained packages of pages and logic. I'm sure there are people on this list who what you are looking for ... I haven't. Maybe they can chime in here. As an alternative to storing webapps in tomcat's webapps directory, you could place a Context ... ... /Context xml fragment in a file in conf/Catalina/localhost with docBase and path properly set. Then the user deploy their own webapp in the folder pointed to by the docBase attribute. --David Tim Potter wrote: David, Thanks for your input, I can test that out, but that would be a different direction than I think I want to go. I have running an apache web server that users access home directories (mod_user) in order to run thier primarily php scripted web pages, but some would like the option of jsp. So currently I have tomcat running with mod_jk, and jkmount setup in apache awaiting /*.jsp to interpret, and i'm able to successfully run a test.jsp page which gets interpreted. On that note, should I just as easily create a ~user/public_html/WEB-INF/web.xml ...or do I need to modify things to the DBCP to function. Thanks and I appreciate the instructions! Tim Potter On Wed, Oct 15, 2008 at 6:00 PM, David Smith [EMAIL PROTECTED] wrote: I think I see your problem. Don't modify the default web.xml file or the default context.xml file unless you really have good reason to. Instead, your webapp should be layed out similar to this, per the servlet spec: DBTest - test.jsp - WEB-INF - web.xml - lib - standard.jar - jstl.jar - META-INF - context.xml All this goes under tomcat's webapps directory. Separately, put your mysql driver jar in tomcat's /lib directory for tomcat 6.0.x, /common/lib for most previous versions of tomcat. All the additional stuff you put in tomcat's /conf/web.xml and /conf/context.xml should be put in the web.xml and context.xml files shown above under DBTest. I've included standard.jar and jstl.jar above because your test.jsp is using the sql jstl taglib. --David Tim Potter wrote: These are my web.xml, context.xml, and test.jsp files (truncated). Let me know if there are any other files you would like to see. [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/web.xml ?xml version=1.0 encoding=ISO-8859-1? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -- web-app xmlns=http://java.sun.com/xml/ns/javaee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd; version=2.5 !-- Introduction == -- !-- There is a bunch of stuff not included as its not relevant to this -- !-- Default Welcome File List = -- !-- When a request URI refers to a directory, the default servlet looks -- !-- for a welcome file within that directory and, if present, -- !-- to the corresponding resource URI for display. If no welcome file -- !-- is present, the default servlet either serves a directory listing, -- !-- or returns a 404 status, depending on how it is configured. -- !-- -- !-- If you define welcome files in your own application's web.xml -- !-- deployment descriptor, that list *replaces* the list configured -- !-- here, so be sure that you include any of the default values that -- !-- you wish to include. -- welcome-file-list welcome-fileindex.html/welcome-file welcome-fileindex.htm/welcome-file welcome-fileindex.jsp/welcome-file /welcome-file-list descriptionMySQL Test App/description resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app [EMAIL PROTECTED]:~$ cat /usr/local/tomcat/conf/context.xml ?xml version='1.0' encoding='utf-8'? !-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the License); you may not use this file except in compliance