RE: memory issues with live redeploy
We ran into the same problem up thru version 5.5.7 - the only work around was to use Stop/Start rather than Reload/Redeploy. We've since updated to Tomcat 5.5.9, which seems to have corrected the problem. Thanks, Scott Stewart -Original Message- From: George Finklang [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 28, 2005 5:34 PM To: tomcat-user@jakarta.apache.org Subject: memory issues with live redeploy Working with a couple different tomcat 5.0.X versions, I'm having issues with tomcat's memory footprint increasing when I live redeploy. I do this 2 or 3 times and the server runs out of memory, though normally it can run for weeks without problem. I can't seem to find direct references to this in the online docs. Is it jsp compilation or session state usage (or other things I can affect)? Or is it just a known limitation in the container? --George - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Disable Directory listing
In the web.xml in the conf directory, set the listings param to have a value of false like this: servlet servlet-namedefault/servlet-name servlet-class org.apache.catalina.servlets.DefaultServlet /servlet-class init-param param-namedebug/param-name param-value0/param-value /init-param init-param param-namelistings/param-name param-valuefalse/param-value /init-param load-on-startup1/load-on-startup /servlet Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine Street Suite 200 Orlando, FL 32801 USA -Original Message- From: Brett Simpson [mailto:[EMAIL PROTECTED] Sent: Friday, May 07, 2004 6:43 AM To: [EMAIL PROTECTED] Subject: Disable Directory listing How can I disable Directory listing in Tomcat? Thanks, Brett - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem connecting to mysql database with Tomcat and JNDI
Well, looking at your Context definition, I'm not seeing the following required element: Resource name=jdbc/address auth=Container type=javax.sql.DataSource / Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine Street Suite 200 Orlando, FL 32801 USA -Original Message- From: Robert S. Jones [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 5:35 PM To: [EMAIL PROTECTED] Subject: Problem connecting to mysql database with Tomcat and JNDI Folks, I'm having trouble connecting to a mysql database through Tomcat. I'm using Tomcat 5.0.9a with mysql 4.0.14. I have the mysql 3.0.8 JDBC driver in ${TOMCAT_HOME}/common/lib. I'm running RedHat 8.0 with a stock kernel. I've been able to connect to the database without JNDI services. I believe I have the database user set up correctly. I have been all over the web trying to figure out what the problem is. It seems like everyone is having this problem, but no two solutions are the same. FWIW I've tried a lot of this on Tomcat 4 and have had the same results. I've traced the problem to the following code from the JSP file below: conn = ds.getConnection(); Any thoughts/ideas would be greatly appreciated. I'm at the end of my rope on this. Here is the error message I'm getting. java.lang.NullPointerException org.apache.jsp.usingDataSource_jsp._jspService(usingDataSource_jsp.java:74) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3 20) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) javax.servlet.http.HttpServlet.service(HttpServlet.java:856) Here is the JSP page I'm using: [EMAIL PROTECTED] import=java.sql.*, javax.sql.*, javax.naming.*% html head titleUsing a DataSource/title /head body h1Using a DataSource/h1 % DataSource ds = null; Connection conn = null; ResultSet result = null; Statement stmt = null; ResultSetMetaData rsmd = null; try { Context context = new InitialContext(); Context envCtx = (Context) context.lookup(java:comp/env); ds = (DataSource)envCtx.lookup(jdbc/address); if (ds != null) { conn = ds.getConnection(); stmt = conn.createStatement(); result = stmt.executeQuery(SELECT * FROM AddressList); } } catch (SQLException e) { System.out.println(Error occurred + e); } int columns = 0; try { rsmd = result.getMetaData(); // bad line columns = rsmd.getColumnCount(); } catch (SQLException e) { System.out.println(Error occurred + e); } % table width=90% border=1 tr % // write out the header cells containing the column labels try { for (int i = 1; i = columns; i++) { out.write(th + rsmd.getColumnLabel(i) + /th); } % /tr % // now write out one row for each entry in the database table while (result.next()) { out.write(tr); for (int i = 1; i = columns; i++) { out.write(td + result.getString(i) + /td); } out.write(/tr); } // close the connection, resultset, and the statement result.close(); stmt.close(); conn.close(); } // end of the try block catch (SQLException e) { System.out.println(Error + e); } // ensure everything is closed finally { try { if (stmt != null) { stmt.close(); } } catch (SQLException e) {} try { if (conn != null) { conn.close(); } } catch (SQLException e ) {} } % /table /body /html Here are the changes I made to my server.xml file. Of course, I've changed the username/password entries here. Context path=/db-test docBase=db-test debug=0 reloadable=true ResourceParams name=jdbc/address parameter nameusername/name valueusername/value /parameter parameter namepassword/name valuepassword/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/ADDRESS/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter /ResourceParams /Context Here is the web.xml file I am using in my WEB-INF directory. ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app resource-ref res-ref-namejdbc/address/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app Rob - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
RE: DataSourceRealm with MySQL
I believe the dataSourceName attribute in your Realm definition needs to exactly match the name given to your Resource element defined within your GlobalNamingResources. Therefore, you may want to change your dataSourceName to just read jdbc/authority. Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] work: (407) 515-8656 cell : (407) 435-1036 fax : (407) 515-9001 ClearSky Mobile Media, Inc. 56 E. Pine Street Suite 200 Orlando, FL 32801 USA -Original Message- From: Steve Wilkinson [mailto:[EMAIL PROTECTED] Sent: Friday, August 22, 2003 8:13 AM To: [EMAIL PROTECTED] Subject: DataSourceRealm with MySQL Hi, I'm struggling with creating a DataSourceRealm with MySQL. I'm running Tomcat 4.1.27-LE-jdk14 on Windows2K First, I can get the following example to work: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how to.html So, I don't think it's a MySQL thing. I've tried the settings from Scott Stewart's email and it doesn't work: http://www.mail-archive.com/[EMAIL PROTECTED]/msg99745.html Here is my server.xml: -- server.xml - Server port=8005 shutdown=SHUTDOWN debug=0 Listener className=org.apache.catalina.mbeans.ServerLifecycleListener debug=0/ Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=0/ GlobalNamingResources Resource name=jdbc/authority type=javax.sql.DataSource auth=Container/ ResourceParams name=jdbc/authority parameter nameusername/name valuemysql/value /parameter parameter namepassword/name valuemysql/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name value jdbc:mysql://localhost:3306/authority?autoReconnect=true /value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value1/value /parameter parameter namemaxWait/name value1/value /parameter /ResourceParams /GlobalNamingResources Service name=Tomcat-Standalone Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8080 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=8443 acceptCount=100 debug=0 connectionTimeout=2 useURIValidationHack=false disableUploadTimeout=true / Engine name=Standalone defaultHost=localhost debug=99 Logger className=org.apache.catalina.logger.FileLogger prefix=catalina_log. suffix=.txt timestamp=true/ Realm className=org.apache.catalina.realm.DataSourceRealm debug=99 dataSourceName=java:/comp/env/jdbc/authority userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/ Host name=localhost debug=99 appBase=webapps unpackWARs=true autoDeploy=true Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=localhost_access_log. suffix=.txt pattern=common resolveHosts=false/ Logger className=org.apache.catalina.logger.FileLogger directory=logs prefix=localhost_log. suffix=.txt timestamp=true/ /Host /Engine /Service /Server - Here is the error message I get from Tomcat when I use my server.xml above: ServerLifecycleListener: Can't create mbean for realm org.apache.catalina.realm. [EMAIL PROTECTED] Note, I was able to the the JDBCRealm working fine. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Globally defined JNDI DataSource (was: JNDI DataSource Realm)
Do you have a ResourceLink defined within your context(s) pointing back to your globally-defined Resource? For example: ResourceLink name=jdbc/Auth global=jdbc/Auth type=javax.sql.DataSource / I can't think of anything else right now. Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine Street Suite 200 Orlando, FL 32801 USA -Original Message- From: Madere, Colin [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 19, 2003 12:38 PM To: 'Tomcat Users List' Subject: RE: Globally defined JNDI DataSource (was: JNDI DataSource Realm) (Renamed subject/topic since the DataSource Realm part works now, just the normal JNDI DataSource for my code gives the name jdbc not bound error) Yes, driver is in /commmon/lib. I'm quite experienced using JDBC access from servlets, just not with JNDI. As far as how I'm instantiating, isn't it supposed to be the same no matter if it's defined in the Context or Globally? Here it is anyway, same result with commented out string and other: -- javax.naming.Context ctx = new InitialContext(); // DS = (DataSource)ctx.lookup(java:comp/env/jdbc/Auth); DS = (DataSource)ctx.lookup( jdbc/Auth ); Conn = DS.getConnection(); -- Both give same error, but the commented out one works when the Resource is in the DefaultContext. Also, all the surrounding/supporting code of this has worked for years in production as a regular JDBC connection. If anyone thinks they can help but this is getting too jumbled, I'll repost with configs and skeleton code. Let me know, I'd love for this to be a config problem only :) -Original Message- From: Scott Stewart [mailto:[EMAIL PROTECTED] Sent: Monday, August 18, 2003 7:28 AM To: 'Tomcat Users List' Subject: RE: JNDI DataSource Realm Where is your JDBC driver .jar file located? It should be in TOMCAT-HOME/common/lib. Also, how are you instantiating your DataSource object within your code? Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -Original Message- From: Madere, Colin [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 3:44 PM To: 'Tomcat Users List' Subject: RE: JNDI DataSource Realm Ok, so changing the dataSourceName attribute in the Realm config (as you suggest which contradicts the HOWTO) to the short name I've given my resource makes the Realm auth work with the globally defined datasource. Yay! However, when trying to connect to the datasource (moved the jdbc/Auth resource from DefaultContext tag to GlobalNamingResources tag), my servlet application still gives the same Name jdbc is not bound in this Context error. You mention not having to put a resource-ref in the context specific web.xml file, and I assume your suggestion to put ResourceLink tag in the Context (in my case putting it in the DefaultContext tag so it works, or should, for all autodeployed contexts) is what you mean removes the need for the those aforementioned entries. However, it doesn't appear to work (as it _does_ work when I move the whole Resource/ResourceParams tags into the DefaultContext tag. Don't want to do this as I will have multiple virtual hosts using the same resource...) Doubt it's of importance, but adding the resource-ref you suggest is not necessary produces the elusive Cannot load JDBC driver class 'null' error, which I believe is unrelated. Any more ideas why my app would not see the global resource as defined below as a global resource and then resource-linked in the default context? -Original Message- From: Scott Stewart [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:27 PM To: 'Tomcat Users List' Subject: RE: JNDI DataSource Realm I posted this awhile back (for MySQL), but here it is again. Also, when you define your DataSource in this manner, you do not need the resource-ref node in your context-specific web.xml files. The global DataSource definition !-- Global JNDI resources -- GlobalNamingResources !-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users -- Resource name=jdbc/MySQLConnectPool auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/MySQLConnectPool parameter nameusername/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter
RE: JNDI DataSource Realm
Where is your JDBC driver .jar file located? It should be in TOMCAT-HOME/common/lib. Also, how are you instantiating your DataSource object within your code? Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -Original Message- From: Madere, Colin [mailto:[EMAIL PROTECTED] Sent: Friday, August 15, 2003 3:44 PM To: 'Tomcat Users List' Subject: RE: JNDI DataSource Realm Ok, so changing the dataSourceName attribute in the Realm config (as you suggest which contradicts the HOWTO) to the short name I've given my resource makes the Realm auth work with the globally defined datasource. Yay! However, when trying to connect to the datasource (moved the jdbc/Auth resource from DefaultContext tag to GlobalNamingResources tag), my servlet application still gives the same Name jdbc is not bound in this Context error. You mention not having to put a resource-ref in the context specific web.xml file, and I assume your suggestion to put ResourceLink tag in the Context (in my case putting it in the DefaultContext tag so it works, or should, for all autodeployed contexts) is what you mean removes the need for the those aforementioned entries. However, it doesn't appear to work (as it _does_ work when I move the whole Resource/ResourceParams tags into the DefaultContext tag. Don't want to do this as I will have multiple virtual hosts using the same resource...) Doubt it's of importance, but adding the resource-ref you suggest is not necessary produces the elusive Cannot load JDBC driver class 'null' error, which I believe is unrelated. Any more ideas why my app would not see the global resource as defined below as a global resource and then resource-linked in the default context? -Original Message- From: Scott Stewart [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:27 PM To: 'Tomcat Users List' Subject: RE: JNDI DataSource Realm I posted this awhile back (for MySQL), but here it is again. Also, when you define your DataSource in this manner, you do not need the resource-ref node in your context-specific web.xml files. The global DataSource definition !-- Global JNDI resources -- GlobalNamingResources !-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users -- Resource name=jdbc/MySQLConnectPool auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/MySQLConnectPool parameter nameusername/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://your IP here:3306/your DB name here?autoReconnect=true/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter namemaxActive/name value200/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /GlobalNamingResources Realm definition using global DataSource Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/MySQLConnectPool userTable=customers userNameCol=customer_username userCredCol=customer_password userRoleTable=roles roleNameCol=role debug=0 / Context reference to global DataSource -- ResourceLink name=jdbc/MySQLConnectPool global=jdbc/MySQLConnectPool type=javax.sql.DataSource
RE: JNDI DataSource Realm
I posted this awhile back (for MySQL), but here it is again. Also, when you define your DataSource in this manner, you do not need the resource-ref node in your context-specific web.xml files. The global DataSource definition !-- Global JNDI resources -- GlobalNamingResources !-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users -- Resource name=jdbc/MySQLConnectPool auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/MySQLConnectPool parameter nameusername/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://your IP here:3306/your DB name here?autoReconnect=true/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter namemaxActive/name value200/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /GlobalNamingResources Realm definition using global DataSource Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/MySQLConnectPool userTable=customers userNameCol=customer_username userCredCol=customer_password userRoleTable=roles roleNameCol=role debug=0 / Context reference to global DataSource -- ResourceLink name=jdbc/MySQLConnectPool global=jdbc/MySQLConnectPool type=javax.sql.DataSource / Hope this helps!! Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -Original Message- From: Madere, Colin [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 5:17 PM To: 'Tomcat Users List' Subject: JNDI DataSource Realm Tomcat 4.1.27 PostgreSQL 7.3.4 pg73jdbc3.jar Trying to use JNDI as a Realm source for both auth and data access for a whole server, therefore trying as a GlobalNamingContext attribute. No love. * Set up as a JDBC Realm, auth works. * Set up Datasource as JNDI Resource within DefaultContext, data access works. Move Resource and params to GlobalNamingContext and I get the Name jdbc is not bound in this Context error. Saw lots of refs to this error via Google, but none relevant AFAICT. (Do I look up resources in the global context differently? If so doesn't that kind of break the idea of it being an abstractly defined data source?) Anyone successfully using GlobalNamingContext for DataSources? Using these components (Tomcat 4.1.x, postgreSQL)? Change Realm from JDBC to DataSourceRealm and auth does not work (or report any errors in logs). server.xml (with DataSourceRealm commented out) Server port=8005 shutdown=SHUTDOWN debug=0 Listener className=org.apache.catalina.mbeans.ServerLifecycleListener debug=0/ Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=0/ !-- Global JNDI resources -- GlobalNamingResources /GlobalNamingResources !-- Define the Tomcat Stand-Alone Service -- Service name=Tomcat-Standalone !-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -- Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8080 minProcessors=5 maxProcessors=75 enableLookups=true redirectPort=8443 acceptCount=100 debug=0
RE: Tomcat 4.1 https problem
I am running Tomcat 4.1.24 in standalone mode using https with no problems. How do you have the non-SSL and SSL Connectors defined in your server.xml? Also, where do your key/cert files live (i.e. within the Tomcat directory structure somewhere)? Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -Original Message- From: Tim Davidson [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 9:08 AM To: Tomcat Users List Subject: RE: Tomcat 4.1 https problem I had the same problem, it seems to occur when you uncomment the connector in server.xml and causes tomcat to exit, making it impossible to see what the error message was. I gave up in the end. Have you been able to get it working? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, August 08, 2003 12:42 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: Re: Tomcat 4.1 https problem Hou, Rowena, you may by change server.xml like this,try again. You will be sucessful. keystoreFile=mykeystore keystorePass = password === 2003-08-06 16:23:00 === Hi, I've been running Tomcat as a standalone Web server for a while. My project run fine at http with sign applet. I want to switch from HTTP to HTTPS. I followed the directions in the document http://jakarta.apache.org/tomcat/tomcat-4.1-doc/ssl-howto.html; : 1. keytool -genkey -alias tomcat -keyalg RSA -keystore mykeystore 2. keytool -certreq -keyalg RSA -alias tomcat -file certreq.csr -keystore mykeystore and 3. uncommented the connector provided by the config file: Connector className=org.apache.coyote.tomcat4.CoyoteConnector port=8443 minProcessors=5 maxProcessors=75 enableLookups=true acceptCount=10 debug=0 scheme=https secure=true useURIValidationHack=false Factory className=org.apache.coyote.tomcat4.CoyoteServerSocketFactory clientAuth=false protocol=TLS keystoreFile=full path to mykeystore keystorePass- changeit / /Connector However, it isn't working. I can't start Tomcat at all. I don't get any errors at prompt or in the logs; I tried to use command window run start tomcat. It popup a command prompt and disappear. If I change className to Factory className=org.apache.catalina.net.SSLServerSocketFactory which used in document. I can start Tomcat and get http://localhost:8443; work but not https://localhost:8443 ( I commented out connector for http in server.xml file). I use jakarta-tomcat-4.1.12-LE-jdk14 which come with jbuilder 8. runing on Window 2000 and IE 6 Question: 1. How can I fix the problem. 2. How can I find out error message? I tried to rum catalina debug -security from command prompt. Most of error message is unrecognized. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] = = = = = = = = = = = = = = = = = = = = [EMAIL PROTECTED] 2003-08-08 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Problem confinguring MySQL JNDI Datasource RH Linux 7.2
Well, at first glance it appears that you are using an incorrectly named parameter for the DataSource implementation that you are now using. The link you provided states that you need to provide a parameter named user; however, you are still using the username parameter that I provided in my example. Try changing this to user. Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] ClearSky Mobile Media, Inc. 56 E. Pine Street Suite 200 Orlando, FL 32801 USA -Original Message- From: Don Ross [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 4:59 PM To: Tomcat Users List Subject: RE: Problem confinguring MySQL JNDI Datasource RH Linux 7.2 Scott, I tried your suggestion and I am still getting the same error. Below is the log from the context DBTest, which I setup to use the datasource. I tried another suggestion from following URL: http://www.java-internals.com/code/resourcefactory/readme.html which also defined the datasource GlobalNamingResources section and got a little further. The java-internals suggestion uses a different resource type and added a factory parameter that references a jar file that I had to install in $CATALINA_HOME/common/lib/ After tryig their suggestion I following error: java.sql.SQLException: Invalid authorization specification: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES) error at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:659) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562) at com.mysql.jdbc.Connection.init(Connection.java:491) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource. java:199) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource. java:163) at com.mysql.jdbc.jdbc2.optional.MysqlDataSource.getConnection(MysqlDataSource. java:134) at foo.DBTest.init(DBTest.java:23) Doesn't look like my user and password parameters are getting processed Here are the sections I updated: ResourceLink name=jdbc/MySQLConnectPool global=jdbc/MySQLConnectPool type=com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource / Resource name=jdbc/MySQLConnectPool auth=Container type=com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource / ResourceParams name=jdbc/MySQLConnectPool parameter namefactory/name valuecom.java_internals.resourcefactory.MyResourceFactory/value /parameter parameter nameserverName/name valuelocalhost/value /parameter parameter namedatabaseName/name valuejavatest/value /parameter parameter nameusername/name valuejavauser/value /parameter parameter namepassword/name valuejavadude/value /parameter /ResourceParams DBTest log file after I implemented your changes 2003-07-31 17:10:14 StandardContext[/DBTest]: Starting 2003-07-31 17:10:14 StandardContext[/DBTest]: Processing start(), current available=false 2003-07-31 17:10:14 StandardContext[/DBTest]: Configuring default Resources 2003-07-31 17:10:14 StandardContext[/DBTest]: Configuring non-privileged default Loader 2003-07-31 17:10:14 StandardContext[/DBTest]: Configuring default Manager 2003-07-31 17:10:14 StandardContext[/DBTest]: Processing standard container startup 2003-07-31 17:10:14 WebappLoader[/DBTest]: Deploying class repositories to work directory /usr/local/jakarta-tomcat-4.1.24/work/Standalone/localhost/DBTest 2003-07-31 17:10:14 WebappLoader[/DBTest]: Deploy class files /WEB-INF/classes to /usr/local/jakarta-tomcat-4.1.24/webapps/DBTest/WEB-INF/classes 2003-07-31 17:10:14 WebappLoader[/DBTest]: Reloading checks are enabled for this Context 2003-07-31 17:10:14 ContextConfig[/DBTest]: ContextConfig: Processing START 2003-07-31 17:10:14 StandardContext[/DBTest]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 2003-07-31 17:10:14 StandardContext[/DBTest]: Setting deployment descriptor public ID to '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 2003-07-31 17:10:14 ContextConfig[/DBTest]: Accumulating TLD resource paths 2003-07-31 17:10:14 ContextConfig[/DBTest]: Scanning taglib elements in web.xml 2003-07-31 17:10:14 ContextConfig[/DBTest]: Scanning TLDs in /WEB-INF subdirectory 2003-07-31 17:10:14 ContextConfig[/DBTest]: Scanning JARs in /WEB-INF/lib subdirectory 2003-07-31 17:10:14
RE: Problem confinguring MySQL JNDI Datasource RH Linux 7.2
You certainly can define your MySQL JNDI Datasource within the GlobalResourceParams node in server.xml. This is how I have it set up currently and everything works fine (I am running Tomcat 4.1.24). I sent the following out the other day in response to a different thread, but it applies here as well: The global DataSource definition !-- Global JNDI resources -- GlobalNamingResources !-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users -- Resource name=jdbc/MySQLConnectPool auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/MySQLConnectPool parameter nameusername/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://your IP here:3306/your DB name here?autoReconnect=true/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter namemaxActive/name value200/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /GlobalNamingResources Realm definition using global DataSource Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/MySQLConnectPool userTable=customers userNameCol=customer_username userCredCol=customer_password userRoleTable=roles roleNameCol=role debug=0 / Context reference to global DataSource -- ResourceLink name=jdbc/MySQLConnectPool global=jdbc/MySQLConnectPool type=javax.sql.DataSource / Hope this helps!! Thanks, Scott Stewart -Original Message- From: Geralyn M Hollerman [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 1:24 PM To: [EMAIL PROTECTED] Subject: Re: Problem confinguring MySQL JNDI Datasource RH Linux 7.2 [EMAIL PROTECTED] wrote: I have followed instructions provided for configuring JNDI Datasource for MySQL (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-exa mples-howto.html), and am running into problem on RedHat Linux 7.2. Here is my configuration: RedHat Linux 7.2 (kernel-2.4.7-10) Tomcat 4.1.24 (Clean install) MySQL 4.0.12 Using mysql-connector-java-3.0.8-stable-bin.jar (driver installed in $CATALINA_HOME/common/lib/) I copied the example code straight from the URL and made following change to DBTest context for my system and mysql driver. server.xml snippet !-- Class name for mm.mysql JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- 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. -- parameter nameurl/name valuejdbc:mysql://dns name of system:3306/javatest?autoReconnect=true/value /parameter /ResourceParams /server.xml snippet I get following error in catalina.out when bringing up test.jsp that uses the datasource. catalina.out error
RE: Problem confinguring MySQL JNDI Datasource RH Linux 7.2
OBTW, when you define your DataSource in this manner, you do not need the resource-ref node in your context-specific web.xml files. Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] work: (407) 515-8656 cell : (407) 435-1036 fax : (407) 515-9001 ClearSky Mobile Media, Inc. 56 E. Pine Street Suite 200 Orlando, FL 32801 USA -Original Message- From: Scott Stewart Sent: Thursday, July 31, 2003 1:45 PM To: 'Tomcat Users List' Subject: RE: Problem confinguring MySQL JNDI Datasource RH Linux 7.2 You certainly can define your MySQL JNDI Datasource within the GlobalResourceParams node in server.xml. This is how I have it set up currently and everything works fine (I am running Tomcat 4.1.24). I sent the following out the other day in response to a different thread, but it applies here as well: The global DataSource definition !-- Global JNDI resources -- GlobalNamingResources !-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users -- Resource name=jdbc/MySQLConnectPool auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/MySQLConnectPool parameter nameusername/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://your IP here:3306/your DB name here?autoReconnect=true/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter namemaxActive/name value200/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /GlobalNamingResources Realm definition using global DataSource Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/MySQLConnectPool userTable=customers userNameCol=customer_username userCredCol=customer_password userRoleTable=roles roleNameCol=role debug=0 / Context reference to global DataSource -- ResourceLink name=jdbc/MySQLConnectPool global=jdbc/MySQLConnectPool type=javax.sql.DataSource / Hope this helps!! Thanks, Scott Stewart -Original Message- From: Geralyn M Hollerman [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 1:24 PM To: [EMAIL PROTECTED] Subject: Re: Problem confinguring MySQL JNDI Datasource RH Linux 7.2 [EMAIL PROTECTED] wrote: I have followed instructions provided for configuring JNDI Datasource for MySQL (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-exa mples-howto.html), and am running into problem on RedHat Linux 7.2. Here is my configuration: RedHat Linux 7.2 (kernel-2.4.7-10) Tomcat 4.1.24 (Clean install) MySQL 4.0.12 Using mysql-connector-java-3.0.8-stable-bin.jar (driver installed in $CATALINA_HOME/common/lib/) I copied the example code straight from the URL and made following change to DBTest context for my system and mysql driver. server.xml snippet !-- Class name for mm.mysql JDBC driver -- parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter !-- 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
RE: problem
My first question to you would be, What does your server.xml look like?. Thanks, Scott Stewart -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 2:18 PM To: [EMAIL PROTECTED] Subject: problem Why is this happening? http://placeanad.classifiedmarketplace.net:8080/adwebster Bobbie Atristain Internet Systems Administrator Media General, INC. 804.649.6156 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat and MySQL
Look closely at your URL - it is malformed. it should read: connectionURL=jdbc:mysql://localhost/authority?user=leesonpassword= Thanks, Scott Stewart -Original Message- From: engp0510 [mailto:[EMAIL PROTECTED] Sent: Thursday, July 31, 2003 11:48 AM To: [EMAIL PROTECTED] Subject: Tomcat and MySQL Hi, I am using Tomcat 4.0 and MySQL 4.0.14 on WIn2K Professional. In Server.XML of Tomcat, I use: Realm className=org.apache.catalina.realm.JDBCRealm debug=99 driverName=org.gjt.mm.mysql.Driver connectionURL=jdbc:mysql://localhost/authority?user=leeson;password= userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name / In MySQL, I set all user must access database with password and grant user 'leeson' with all privileges. I can use leeson and password to log into MySQL. But when I start tomcat-standalone, there is always : Catalina.start: LifecycleException: Exception opening database connection: java.sql.SQLException: Invalid authorizatio n specification: Access denied for user: 'leeson;[EMAIL PROTECTED]' (Using password: NO) LifecycleException: Exception opening database connection: java.sql.SQLException: Invalid authorization specification: Access denied for user: 'leeson;[EMAIL PROTECTED]' (Using password: NO) at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:615) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:307) at org.apache.catalina.core.StandardService.start(StandardService.java:388) at org.apache.catalina.core.StandardServer.start(StandardServer.java:505) at org.apache.catalina.startup.Catalina.start(Catalina.java:776) at org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at org.apache.catalina.startup.Catalina.process(Catalina.java:179) 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:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218) - Root Cause - java.sql.SQLException: Invalid authorization specification: Access denied for user: 'leeson;[EMAIL PROTECTED]' (Using p assword: NO) at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:659) at com.mysql.jdbc.Connection.createNewIO(Connection.java:1562) at com.mysql.jdbc.Connection.init(Connection.java:491) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:346) at org.apache.catalina.realm.JDBCRealm.open(JDBCRealm.java:548) at org.apache.catalina.realm.JDBCRealm.start(JDBCRealm.java:613) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1108) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:307) at org.apache.catalina.core.StandardService.start(StandardService.java:388) at org.apache.catalina.core.StandardServer.start(StandardServer.java:505) at org.apache.catalina.startup.Catalina.start(Catalina.java:776) at org.apache.catalina.startup.Catalina.execute(Catalina.java:681) at org.apache.catalina.startup.Catalina.process(Catalina.java:179) 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:324) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:218) Can anyone help me? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [Q] server.xml vs context.xml ?
Hi Riann, I have successfully implemented a globally available DataSource within my server.xml. What follows are the relevant excerpts from my server.xml file that enabled me to do this. FYI - I am using Tomcat 4.1.24. The global DataSource definition !-- Global JNDI resources -- GlobalNamingResources !-- Editable user database that can also be used by JNDI DatabaseRealm to authenticate users -- Resource name=jdbc/MySQLConnectPool auth=Container type=javax.sql.DataSource / ResourceParams name=jdbc/MySQLConnectPool parameter nameusername/name value/value /parameter parameter namepassword/name value/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://your IP here:3306/your DB name here?autoReconnect=true/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter namemaxActive/name value200/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /GlobalNamingResources Realm definition using global DataSource Realm className=org.apache.catalina.realm.DataSourceRealm dataSourceName=jdbc/MySQLConnectPool userTable=customers userNameCol=customer_username userCredCol=customer_password userRoleTable=roles roleNameCol=role debug=0 / Context reference to global DataSource -- ResourceLink name=jdbc/MySQLConnectPool global=jdbc/MySQLConnectPool type=javax.sql.DataSource / Hope this helps!! Thanks, Scott Stewart [EMAIL PROTECTED] -Original Message- From: Riaan Oberholzer [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 29, 2003 9:26 AM To: [EMAIL PROTECTED] Subject: [Q] server.xml vs context.xml ? I've had the problem where defining a Datasource in a server.xml (as sub element of the context element) did not work, but moving it to a context.xml for the application (named 'appname.xml' eg) it worked fine. What is the general rule regarding when to declare e.g. Datasources for a specific application in the server.xml and when to put it in a context.xml? The Tomcat HOW-TO documentation explains that you must do it in the server.xml, but this doesn't sound like the best solution to me. Why would one method work and the other not? Pro's con's of each? The obvious difference is that updating server.xml would require a server restart where working with a context.xml does not. But in the server.xml you can specify resources globally for for all apps, right? I tried this first, but couldn't get it working... only when the resource was specific to my application could I actually use it without getting errors. __ Do you Yahoo!? Yahoo! SiteBuilder - Free, easy-to-use web site design software http://sitebuilder.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat Education
Wrox Professional Apache Tomcat (covers 4.x) Apache Tomcat Security Handbook Professional Java Servlets 2.3 Wiley - Apache Tomcat Bible Also, the tomcat site (http://jakart.apache.org/tomcat) is a good source of info. I have found that the best/fastest way to find your way to the doco you need within this site is to use Google. Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] work: 407-515-8656 cell : 407-435-1036 fax : 407-515-9001 ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -Original Message- From: Ben Johnson [mailto:[EMAIL PROTECTED] Sent: Monday, July 28, 2003 11:12 AM To: Tomcat Users List Subject: Tomcat Education Hello all, I'm new to the Tomcat world and I'm desperately trying to find some good resources to learn from. I bought Professional Apache Tomcat (Wrox) and it's decent but it's for version 3.0 or something. I also have a Servlet book from O'Reilly but it doesn't help when integrating with Tomcat. I've spent an inordinate number of hours just trying to figure out how to pull DataSources using the admin tool and I still haven't figured it out. Anybody have any resource or book ideas? Thanks! Ben Johnson Senior Software Developer Collect America, LTD. 1999 Broadway, Suite 2150 Denver, CO 80202 [p]: 303.296.3345 x124 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: SingleSignOn on within an aliased Host
Bill, Thanks for your reply! However, I have discovered an interesting twist to my scenario that doesn't make sense to me given your explanation below. FYI - I am currently running Tomcat 4.1.x and Apache 2 on a RHL platform. Now, for the interesting/puzzling part: if I initially connect via http to www.hostname.com and then connect via https to secure.hostname.com, I can subsequently connect via http to secure.hostname.com without losing the session created when connecting via https. Apparently, I only lose the session information when I switch from https to http AND go to the aliased hostname. Any further thoughts? Thanks, Scott Stewart [Manager, Software Development] [EMAIL PROTECTED] work: 407-515-8656 cell : 407-435-1036 fax : 407-515-9001 ClearSky Mobile Media, Inc. 56 E. Pine St. Suite 200 Orlando, FL 32801 USA -Original Message- From: Bill Barker [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 11:44 PM To: [EMAIL PROTECTED] Subject: Re: SingleSignOn on within an aliased Host This should really be in the FAQ (if it isn't already). For security reasons, if you establish a session under https on TC 4.x and higher, the session is not accessible if you later fall back to http. TC 3.3.1 doesn't have this restriction, but TC 3.3.2 release will (with an option to turn it off for backwards compatiblity only). Scott Stewart [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Is anyone aware of any known issues regarding the use of SingleSignOn within an aliased host? I currently have a single host defined in server.xml (say, www.hostname.com www.hostname.com ) with one alias defined for that host (say, secure.hostname.com). I am using SSL container-managed security (form based) to segregate account signup, account management and other secured portions of the site from the generally accessible areas. The problem I am having is that once I authententicate myself via https to secure.hostname.com, if I surf over to the unsecured site via an http call to www.hostname.com www.hostname.com all knowledge of myself has disappeared (i.e. calls to getUserPrincipal() return null). Does this make sense? Any thoughts??? Thanks in advance to any help that you may be able to provide, Scott - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
SingleSignOn on within an aliased Host
Is anyone aware of any known issues regarding the use of SingleSignOn within an aliased host? I currently have a single host defined in server.xml (say, www.hostname.com www.hostname.com ) with one alias defined for that host (say, secure.hostname.com). I am using SSL container-managed security (form based) to segregate account signup, account management and other secured portions of the site from the generally accessible areas. The problem I am having is that once I authententicate myself via https to secure.hostname.com, if I surf over to the unsecured site via an http call to www.hostname.com www.hostname.com all knowledge of myself has disappeared (i.e. calls to getUserPrincipal() return null). Does this make sense? Any thoughts??? Thanks in advance to any help that you may be able to provide, Scott