Re: [OT] Re: problems at thejarbar.org
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 6/11/2010 4:53 AM, yucca...@live.co.za wrote: Hello tomcats !! :) A quick question as I tackle configuring jndi resource for first time: I was referred to using jndi in production environmrnt snd hsve noted through documentation found in test server that there are 3 possible places to define jndi resources: 1)the server .xml(for every webapp in server if I am correct. Yes, you can define site-wide JNDI resources, here, but I'd recommend against it. 2)context.xml I think this is the best place to put JNDI resource definitions. 3)web.xml You can't actually define JNDI resources, here: only map global (server.xml) ones to the webapp. As I am planning on only using this resource for multiple webapps in same domain, am I right in asuming server.xml is correct choice to define jndi resource? Perhaps. if you want to share database pools, then do it at the server.xml level. If you want each webapp to have it's own pool, you might consider separating them (even if the details are the same). In addition I am to define jndi used in server.xml again in web.xml? My experience is that you do not need to map them in web.xml, though the servlet spec seems to indicate that doing so is appropriate. I now need to know how / where to configure parameters for mysql connections or are the defaults acceptable for production? You can find connection pool settings here: http://commons.apache.org/dbcp/configuration.html You can find documentation for configuring Connector/J in the MySQL documentation that matches your version number. Good luck, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwfZQ4ACgkQ9CaO5/Lv0PD5YQCeO0ARUBBH/d6pQi7ESc8oTIXk dAgAn24ON3N3iU/VErSFk3/YpAiORS0v =yBQf -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 6/11/2010 4:53 AM, yucca...@live.co.za wrote: Hello tomcats !! :) A quick question as I tackle configuring jndi resource for first time: I was referred to using jndi in production environmrnt snd hsve noted through documentation found in test server that there are 3 possible places to define jndi resources: 1)the server .xml(for every webapp in server if I am correct. Yes, you can define site-wide JNDI resources, here, but I'd recommend against it. 2)context.xml I think this is the best place to put JNDI resource definitions. 3)web.xml You can't actually define JNDI resources, here: only map global (server.xml) ones to the webapp. As I am planning on only using this resource for multiple webapps in same domain, am I right in asuming server.xml is correct choice to define jndi resource? Perhaps. if you want to share database pools, then do it at the server.xml level. If you want each webapp to have it's own pool, you might consider separating them (even if the details are the same). In addition I am to define jndi used in server.xml again in web.xml? My experience is that you do not need to map them in web.xml, though the servlet spec seems to indicate that doing so is appropriate. I now need to know how / where to configure parameters for mysql connections or are the defaults acceptable for production? You can find connection pool settings here: http://commons.apache.org/dbcp/configuration.html You can find documentation for configuring Connector/J in the MySQL documentation that matches your version number. Good luck, - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwSo6AACgkQ9CaO5/Lv0PDuvQCcCgg07IDlP/LvRAUGq2UsIlIp zrkAoJHGUDedkqybZdcTuSNSnyLw22yC =8Ghi -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
Hello tomcats !! :) A quick question as I tackle configuring jndi resource for first time: I was referred to using jndi in production environmrnt snd hsve noted through documentation found in test server that there are 3 possible places to define jndi resources: 1)the server .xml(for every webapp in server if I am correct. 2)context.xml 3)web.xml As I am planning on only using this resource for multiple webapps in same domain, am I right in asuming server.xml is correct choice to define jndi resource? In addition I am to define jndi used in server.xml again in web.xml? I now need to know how / where to configure parameters for mysql connections or are the defaults acceptable for production? -- From: yucca...@live.co.za Sent: Thursday, June 03, 2010 12:41 AM To: Tomcat Users List users@tomcat.apache.org Subject: Re: [OT] Re: problems at thejarbar.org Ok I appreciatethis big help. I am expecting a small amount of users though so does that mean that a datasource realm may be overkill? I am not implying that this is what was being said earlier, just trying to learn more. I have noticed though that forum posters seem to assume a lot at times, an example was that I need to learn maven which itself was a good headsup although I am familiar with it already. The sad thing is that with sun/oracle transition maven documentation is rotten and many of the plugins need a revamp, especially ones for full stack jee severs I learnt a little start of this year and everything was too fresh (jboss 6 not even released yet or is it?) or was very outdated for me as I started Java when JSE 6 was released so have little interest in knowing how to use maven in legacy systems unless I get employment in enterprise(hopefuly soon), Java is in a mess st the moment with no news on JSE7 and very little info from Oracle. I took it as a blessing in disguise an started getting to know JSF and hibernate and other stuff. PS can anyone confirm that there is firefox bug when selecting a different locale for i8n testing? I am able only to change locale few times. -- From: Christopher Schultz ch...@christopherschultz.net Sent: Wednesday, June 02, 2010 6:25 AM To: Tomcat Users List users@tomcat.apache.org Subject: Re: [OT] Re: problems at thejarbar.org -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 6/2/2010 8:27 PM, yucca...@live.co.za wrote: There was a question as to why I am using a realm and application based realm and I have no idea howcome people think I am not using only tomcat realm? It's not that we think you're using a non-Tomcat Realm: it's that we think you're using the /wrong/ Tomcat Realm. See... JDBCRealm uses its own set of credentials to connect to the database and uses a single Connection object, requiring lots of synchronization to protect that shared resource. Basically, it's not appropriate for production because of those two facts. Instead, we're suggesting that you set up a DataSource and then use a DataSourceRealm which will use a connection-per-authentication-attempt and is much more high-performance. hibernate is not doing any security related stuff other than persisiting new users and thier credentials to mysql. Tomcat is only managing security and hibernate everything else... Hope this clears up discussion. :) Is hibernate using a Tomcat-created DataSource? If not, you're making your life harder by placing database connection configuration in several places instead of just one. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwGW8IACgkQ9CaO5/Lv0PALlwCgwejhODA7bB92UMEbgpIPGb8R 3RoAn3BXDzQWZ5497EKzaSP1W84Mtqu2 =zCtF -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 6/3/2010 3:41 AM, yucca...@live.co.za wrote: Ok I appreciatethis big help. I am expecting a small amount of users though so does that mean that a datasource realm may be overkill? I am not implying that this is what was being said earlier, just trying to learn more. You'll want to use a DataSource for your app's db communication, anyway, so why not use that same DataSource for your Realm? The reality is that the JDBCRealm is not good. Use it at your own risk. The sad thing is that with sun/oracle transition maven documentation is rotten and many of the plugins need a revamp Maven is an Apache project, not an Oracle/Sun project. If you have a complaint about the Apache Maven documentation, might I suggest that you talk to their community about it? Things only improve when users give feedback and/or contribute to those efforts. Java is in a mess st the moment with no news on JSE7 and very little info from Oracle. I took it as a blessing in disguise an started getting to know JSF and hibernate and other stuff. It's not like it's a waste to learn Java 6 when Java 7 is coming out: it's all backward-compatible (unless otherwise noted). Don't worry about the release schedule for Java 7 unless you are dying to have some certain functionality that only ships with that version. PS can anyone confirm that there is firefox bug when selecting a different locale for i8n testing? I am able only to change locale few times. I have never had any problem changing ff's locale. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwIGfoACgkQ9CaO5/Lv0PAnAwCfWMjkflRhfbsBYI0FJmS29kjs l8cAnRywLq1wRXiXkKuLDYD+1p4hrBK2 =WLGC -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
Hello, with all this confusion (and I am loving it) I will reveal what I am doing :p My website and webapp is to showcase my skills to get work and with a very long term goal of blogging about Java development and having a site to distribute stuff from. There was a question as to why I am using a realm and application based realm and I have no idea howcome people think I am not using only tomcat realm? I do access security stuff in application but only to determine if user is logged in to display in jsp as user is logged in as guest or not. I appreciate this forum and thank you all for replies. hibernate is not doing any security related stuff other than persisiting new users and thier credentials to mysql.Tomcat is only managing security and hibernate everything else... Hope this clears up discussion. :) -- From: Mark Eggers its_toas...@yahoo.com Sent: Tuesday, June 01, 2010 4:27 PM To: Tomcat Users List users@tomcat.apache.org Subject: [OT] Re: problems at thejarbar.org Chris, I think it all depends what you need your Realm to manage. In this instance (single application on Tomcat), then it probably doesn't matter if the Realm sits at the application, Host, or Engine level. Like you've pointed out before it's nice to have a self-contained application with all of the database configurations in one spot. Having some database configurations in META-INF/context.xml, and others in Tomcat's server.xml seems to be a maintenance / migration challenge waiting to happen. If you have multiple applications using the same Realm information, then it might make sense to move the Realm to a Host or Engine level. However I cannot think of a good use case off the top of my head to potentially run multiple hosts under one Engine with the same authentication Realm . . . . Maybe a better place to document all of this and some use case scenarios would be the Wiki. Since I'm thinking about this, I'll see what I can cobble up in the next few days. Thanks for the comments . . . . /mde/ --- On Tue, 6/1/10, Christopher Schultz ch...@christopherschultz.net wrote: From: Christopher Schultz ch...@christopherschultz.net Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, June 1, 2010, 3:03 PM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, Yes, but honestly, I'd put the Resource and Realm. configuration into my webapp's META-INF/context.xml file (which requires that localDataSource=true be set on the Realm, btw). - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 6/2/2010 8:27 PM, yucca...@live.co.za wrote: There was a question as to why I am using a realm and application based realm and I have no idea howcome people think I am not using only tomcat realm? It's not that we think you're using a non-Tomcat Realm: it's that we think you're using the /wrong/ Tomcat Realm. See... JDBCRealm uses its own set of credentials to connect to the database and uses a single Connection object, requiring lots of synchronization to protect that shared resource. Basically, it's not appropriate for production because of those two facts. Instead, we're suggesting that you set up a DataSource and then use a DataSourceRealm which will use a connection-per-authentication-attempt and is much more high-performance. hibernate is not doing any security related stuff other than persisiting new users and thier credentials to mysql. Tomcat is only managing security and hibernate everything else... Hope this clears up discussion. :) Is hibernate using a Tomcat-created DataSource? If not, you're making your life harder by placing database connection configuration in several places instead of just one. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwGW8IACgkQ9CaO5/Lv0PALlwCgwejhODA7bB92UMEbgpIPGb8R 3RoAn3BXDzQWZ5497EKzaSP1W84Mtqu2 =zCtF -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
Ok I appreciatethis big help. I am expecting a small amount of users though so does that mean that a datasource realm may be overkill? I am not implying that this is what was being said earlier, just trying to learn more. I have noticed though that forum posters seem to assume a lot at times, an example was that I need to learn maven which itself was a good headsup although I am familiar with it already. The sad thing is that with sun/oracle transition maven documentation is rotten and many of the plugins need a revamp, especially ones for full stack jee severs I learnt a little start of this year and everything was too fresh (jboss 6 not even released yet or is it?) or was very outdated for me as I started Java when JSE 6 was released so have little interest in knowing how to use maven in legacy systems unless I get employment in enterprise(hopefuly soon), Java is in a mess st the moment with no news on JSE7 and very little info from Oracle. I took it as a blessing in disguise an started getting to know JSF and hibernate and other stuff. PS can anyone confirm that there is firefox bug when selecting a different locale for i8n testing? I am able only to change locale few times. -- From: Christopher Schultz ch...@christopherschultz.net Sent: Wednesday, June 02, 2010 6:25 AM To: Tomcat Users List users@tomcat.apache.org Subject: Re: [OT] Re: problems at thejarbar.org -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 6/2/2010 8:27 PM, yucca...@live.co.za wrote: There was a question as to why I am using a realm and application based realm and I have no idea howcome people think I am not using only tomcat realm? It's not that we think you're using a non-Tomcat Realm: it's that we think you're using the /wrong/ Tomcat Realm. See... JDBCRealm uses its own set of credentials to connect to the database and uses a single Connection object, requiring lots of synchronization to protect that shared resource. Basically, it's not appropriate for production because of those two facts. Instead, we're suggesting that you set up a DataSource and then use a DataSourceRealm which will use a connection-per-authentication-attempt and is much more high-performance. hibernate is not doing any security related stuff other than persisiting new users and thier credentials to mysql. Tomcat is only managing security and hibernate everything else... Hope this clears up discussion. :) Is hibernate using a Tomcat-created DataSource? If not, you're making your life harder by placing database connection configuration in several places instead of just one. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwGW8IACgkQ9CaO5/Lv0PALlwCgwejhODA7bB92UMEbgpIPGb8R 3RoAn3BXDzQWZ5497EKzaSP1W84Mtqu2 =zCtF -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problems at thejarbar.org
According to the stack trace I posted, is it possible that hibernate could also be a seperate casue of transient mysql exception or does this only need to be fixed in tomcat? -- From: Mark Eggers its_toas...@yahoo.com Sent: Monday, May 31, 2010 11:57 AM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org I think you are running into a MySQL database connection timeout. You can use a MySQL admin interface (command line, PHPAdmin, MySQL Workbench, etc.) to verify the idle connection timeout limit. There have been comments on the web concerning this. One such discussion and a solution are here: http://lists.mysql.com/java/6578 The explanation of the parameters given in the above link can be found here: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The other solution mentioned is to use a DataSource Realm. This requires you to configure a JNDI datasource describing your database connection as well as the DataSource Realm. You can add all of this information in your web application's META-INF/context.xml file if it's application-specific. If this is a host or service-based definition, then you'll have to define the JNDI resources in a GlobalNamingResources element. See the following: http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html Note the warning that this resource will not be available to an individual web application unless you use a ResourceLink in your META-INF/context.xml file. See the globalresources link above for an example. Since you're using this connection for container managed authentication and authorization, I'm not sure why your web application would need access to this resource. However, it's 3 am, so I may have missed a few points that Chuck, Charles, or Pid will be happy to correct. To summarize - it seems the easiest fix is to add the following properties to your JDBC url: autoReconnect=true reconnectAtTxEnd=true Add them to the end of the URL, connected with ampersands. I hope this gets you up and running. . . . . . just my two cents /mde/ --- On Sun, 5/30/10, Yucca Nel yucca...@live.co.za wrote: From: Yucca Nel yucca...@live.co.za Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Sunday, May 30, 2010, 9:34 AM Yes, but I am using JDBC and followed the setup step by step from tomcat docs ?xml version=1.0 encoding=UTF-8? Server port=9170 Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Resource auth=Container description=User database name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ /GlobalNamingResources Service name=Catalina Connector port=9670 minSpareThreads=1 address=127.0.0.1 maxThreads=50 maxSpareThreads=3 connectionTimeout=3 protocol=AJP/1.3 /Connector Engine defaultHost=thejarbar.org name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/Realm className=org.apache.catalina.realm.JDBCRealm driverName=com.mysql.jdbc.Driver connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar connectionName=yucca123_tom connectionPassword=myPass userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/Host appBase=/home/yucca123/public_html name=thejarbar.org Aliaswww.thejarbar.org/Alias Context path=/the_jar_bar Listener className=org.apache.catalina.startup.TldConfig/ /Context Context docBase=/usr/local/tomcat/users/yucca123/tomcat/webapps/manager path=/manager privileged=true reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ ResourceEnvRef name=users type=org.apache.catalina.UserDatabase/ /Context Context docBase=the_jar_bar path= reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ /Context /Host /Engine /Service /Server May be missing something... http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC%20Data%20Sources This error does not occur every time -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re
Re: problems at thejarbar.org
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 5/30/2010 1:53 PM, Yucca Nel wrote: Ok I need to keep connection open to avoid exceeption but have found this is deprecated autoReconnect=true can someone provide up to date strategy for dealing with this? Don't use autoReconnect as a parameter to the JDBC driver. Instead, use the validationQuery on the connection pool to have the pool verify that the connection is still valid. MySQL Connector/J even supports a ping query that can gracefully fall-back to driver versions that don't support it. I highly recommend that you: 1. Use a Tomcat-configured DataSource 2. Use a DataSourceRealm coupled with #1 3. Tell Hibernate to use #1 That way, all your db configuration is in one place. Add this parameter to your DataSource configuration (it configures the connection pool): validationQuery=/* ping */ SELECT 1 This will cause the connection pool to execute that query every time a connection is requested from the pool, just to verify that it's properly connected. Your web application should never get a dead connection and therefore shouldn't have to deal with that situation. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwFFcIACgkQ9CaO5/Lv0PDNJACggJuwEQRRqswYU9awTjda7bM8 /KAAnAuZSd1OPmqV94qEibWHXWMyTW6Y =Rmml -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problems at thejarbar.org
Chris, based on what you're saying and the server.xml posted earlier in this thread, the following should be done? 1. Remove the JDBCRelm from the Engine node 2. Create a GlobalNamingResources Resource entry with the following: Resource name=jdbc/auth description=The Jar Bar user authentication type=javax.sql.DataSource auth=Container driverClassName=com.mysql.jdbc.Driver maxActive=10 maxIdle=3 maxWait=1 password=MyPassword url=jdbc:mysql://localhost:3306/yucca123_thejarbar validationQuery=/* ping */ SELECT 1 username=MyUser/ This is basically what I would normally put in the context.xml file of a web application for an application-specific database connection. 3. Then create a DataSource Realm under the Engine node to replace JDBCRealm. Realm className=org.apache.catalina.realm.DataSourceRealm userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name dataSourceName=jdbc/auth It was a little unclear to me from the documentation that I could put all of the resource attributes in a GlobalNamingResources Resource entry. It was also a little unclear to me that I could just refer to a global resource name with dataSourceName in the Realm. Thanks for clearing that up. . . . just my two cents /mde/ --- On Tue, 6/1/10, Christopher Schultz ch...@christopherschultz.net wrote: From: Christopher Schultz ch...@christopherschultz.net Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, June 1, 2010, 7:14 AM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Yucca Nel, On 5/30/2010 1:53 PM, Yucca Nel wrote: Ok I need to keep connection open to avoid exceeption but have found this is deprecated autoReconnect=true can someone provide up to date strategy for dealing with this? Don't use autoReconnect as a parameter to the JDBC driver. Instead, use the validationQuery on the connection pool to have the pool verify that the connection is still valid. MySQL Connector/J even supports a ping query that can gracefully fall-back to driver versions that don't support it. I highly recommend that you: 1. Use a Tomcat-configured DataSource 2. Use a DataSourceRealm coupled with #1 3. Tell Hibernate to use #1 That way, all your db configuration is in one place. Add this parameter to your DataSource configuration (it configures the connection pool): validationQuery=/* ping */ SELECT 1 This will cause the connection pool to execute that query every time a connection is requested from the pool, just to verify that it's properly connected. Your web application should never get a dead connection and therefore shouldn't have to deal with that situation. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problems at thejarbar.org
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, On 6/1/2010 3:58 PM, Mark Eggers wrote: Chris, based on what you're saying and the server.xml posted earlier in this thread, the following should be done? 1. Remove the JDBCRelm from the Engine node 2. Create a GlobalNamingResources Resource entry with the following: Yes, but honestly, I'd put the Resource and Realm. configuration into my webapp's META-INF/context.xml file (which requires that localDataSource=true be set on the Realm, btw). This is basically what I would normally put in the context.xml file of a web application for an application-specific database connection. Agreed. 3. Then create a DataSource Realm under the Engine node to replace JDBCRealm. Realm className=org.apache.catalina.realm.DataSourceRealm userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name dataSourceName=jdbc/auth Yup. It was a little unclear to me from the documentation that I could put all of the resource attributes in a GlobalNamingResources Resource entry. It was also a little unclear to me that I could just refer to a global resource name with dataSourceName in the Realm. Unfortunately, the documentation on the Tomcat website is a bit disorganized and the best places to look are often in the examples and not in the configuration reference (which itself has examples, etc.). Also, the examples are often very outdated. Patches are always welcome (I tell myself, here, mostly) :) - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.10 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAkwFg7IACgkQ9CaO5/Lv0PD/HQCgu1ydfF98NszrWLW+6Jiz1BSE SkIAn0uL2sINWTYlXhJklYaqcryYf3gD =7FTL -END PGP SIGNATURE- - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
[OT] Re: problems at thejarbar.org
Chris, I think it all depends what you need your Realm to manage. In this instance (single application on Tomcat), then it probably doesn't matter if the Realm sits at the application, Host, or Engine level. Like you've pointed out before it's nice to have a self-contained application with all of the database configurations in one spot. Having some database configurations in META-INF/context.xml, and others in Tomcat's server.xml seems to be a maintenance / migration challenge waiting to happen. If you have multiple applications using the same Realm information, then it might make sense to move the Realm to a Host or Engine level. However I cannot think of a good use case off the top of my head to potentially run multiple hosts under one Engine with the same authentication Realm . . . . Maybe a better place to document all of this and some use case scenarios would be the Wiki. Since I'm thinking about this, I'll see what I can cobble up in the next few days. Thanks for the comments . . . . /mde/ --- On Tue, 6/1/10, Christopher Schultz ch...@christopherschultz.net wrote: From: Christopher Schultz ch...@christopherschultz.net Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, June 1, 2010, 3:03 PM -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, Yes, but honestly, I'd put the Resource and Realm. configuration into my webapp's META-INF/context.xml file (which requires that localDataSource=true be set on the Realm, btw). - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: [OT] Re: problems at thejarbar.org
On Tue, Jun 1, 2010 at 4:27 PM, Mark Eggers its_toas...@yahoo.com wrote: If you have multiple applications using the same Realm information, then it might make sense to move the Realm to a Host or Engine level. However I cannot think of a good use case off the top of my head to potentially run multiple hosts under one Engine with the same authentication Realm . . . . Wait, what?? How about if you have multiple hosts, each having restricted-access admin functions being performed by the same (or largely overlapping) set of people? What sense would separate Realms make? -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problems at thejarbar.org
I think you are running into a MySQL database connection timeout. You can use a MySQL admin interface (command line, PHPAdmin, MySQL Workbench, etc.) to verify the idle connection timeout limit. There have been comments on the web concerning this. One such discussion and a solution are here: http://lists.mysql.com/java/6578 The explanation of the parameters given in the above link can be found here: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The other solution mentioned is to use a DataSource Realm. This requires you to configure a JNDI datasource describing your database connection as well as the DataSource Realm. You can add all of this information in your web application's META-INF/context.xml file if it's application-specific. If this is a host or service-based definition, then you'll have to define the JNDI resources in a GlobalNamingResources element. See the following: http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html Note the warning that this resource will not be available to an individual web application unless you use a ResourceLink in your META-INF/context.xml file. See the globalresources link above for an example. Since you're using this connection for container managed authentication and authorization, I'm not sure why your web application would need access to this resource. However, it's 3 am, so I may have missed a few points that Chuck, Charles, or Pid will be happy to correct. To summarize - it seems the easiest fix is to add the following properties to your JDBC url: autoReconnect=true reconnectAtTxEnd=true Add them to the end of the URL, connected with ampersands. I hope this gets you up and running. . . . . . just my two cents /mde/ --- On Sun, 5/30/10, Yucca Nel yucca...@live.co.za wrote: From: Yucca Nel yucca...@live.co.za Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Sunday, May 30, 2010, 9:34 AM Yes, but I am using JDBC and followed the setup step by step from tomcat docs ?xml version=1.0 encoding=UTF-8? Server port=9170 Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Resource auth=Container description=User database name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ /GlobalNamingResources Service name=Catalina Connector port=9670 minSpareThreads=1 address=127.0.0.1 maxThreads=50 maxSpareThreads=3 connectionTimeout=3 protocol=AJP/1.3 /Connector Engine defaultHost=thejarbar.org name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/Realm className=org.apache.catalina.realm.JDBCRealm driverName=com.mysql.jdbc.Driver connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar connectionName=yucca123_tom connectionPassword=myPass userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/Host appBase=/home/yucca123/public_html name=thejarbar.org Aliaswww.thejarbar.org/Alias Context path=/the_jar_bar Listener className=org.apache.catalina.startup.TldConfig/ /Context Context docBase=/usr/local/tomcat/users/yucca123/tomcat/webapps/manager path=/manager privileged=true reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ ResourceEnvRef name=users type=org.apache.catalina.UserDatabase/ /Context Context docBase=the_jar_bar path= reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ /Context /Host /Engine /Service /Server May be missing something... http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC%20Data%20Sources This error does not occur every time -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel
Re: problems at thejarbar.org
2010/5/31 Mark Eggers its_toas...@yahoo.com: http://lists.mysql.com/java/6578 http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The first parameter has to be preceded with '?', not with an ampersand, and in an XML file the ampersands must be written as 'amp;', so we get (remove the line wrap): connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar?autoReconnect=trueamp;reconnectAtTxEnd=true I have not tried the above either, so test it yourself. Best regards, Konstantin Kolinko - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: problems at thejarbar.org
Don't use that ... it still throws an error, reconnecting only after the exception is thrown. If using the db pooling in tomcat, it's better to include a validationQuery attribute in the Resource ... / element in your app's context.xml file. If on the other hand you are directly connecting the database on your own then just trap the exception, open a new connection and try again. --David On 5/30/2010 1:53 PM, Yucca Nel wrote: Ok I need to keep connection open to avoid exceeption but have found this is deprecated autoReconnect=true can someone provide up to date strategy for dealing with this? -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel wrote: The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces Servlet]The registration code that leads to error is as follows: Form:!--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 14:07:31To change this template use File | Settings | File Templates.--%...@page contentType=text/html language=java %%...@page pageEncoding=UTF-8%%...@taglib uri=http://java.sun.com/jsf/core; prefix=f %%@ taglib prefix=h uri=http://java.sun.com/jsf
Re: problems at thejarbar.org
Many thanks for hepful responses my delay I reply is due to internet in afica -- From: Mark Eggers its_toas...@yahoo.com Sent: Monday, May 31, 2010 11:57 AM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org I think you are running into a MySQL database connection timeout. You can use a MySQL admin interface (command line, PHPAdmin, MySQL Workbench, etc.) to verify the idle connection timeout limit. There have been comments on the web concerning this. One such discussion and a solution are here: http://lists.mysql.com/java/6578 The explanation of the parameters given in the above link can be found here: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Based on those two references, you'll need to modify your Realm database URL: connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbarautoReconnect=truereconnectAtTxEnd=true Note, I have not tried this, so test before production. The other solution mentioned is to use a DataSource Realm. This requires you to configure a JNDI datasource describing your database connection as well as the DataSource Realm. You can add all of this information in your web application's META-INF/context.xml file if it's application-specific. If this is a host or service-based definition, then you'll have to define the JNDI resources in a GlobalNamingResources element. See the following: http://tomcat.apache.org/tomcat-6.0-doc/config/globalresources.html Note the warning that this resource will not be available to an individual web application unless you use a ResourceLink in your META-INF/context.xml file. See the globalresources link above for an example. Since you're using this connection for container managed authentication and authorization, I'm not sure why your web application would need access to this resource. However, it's 3 am, so I may have missed a few points that Chuck, Charles, or Pid will be happy to correct. To summarize - it seems the easiest fix is to add the following properties to your JDBC url: autoReconnect=true reconnectAtTxEnd=true Add them to the end of the URL, connected with ampersands. I hope this gets you up and running. . . . . . just my two cents /mde/ --- On Sun, 5/30/10, Yucca Nel yucca...@live.co.za wrote: From: Yucca Nel yucca...@live.co.za Subject: Re: problems at thejarbar.org To: Tomcat Users List users@tomcat.apache.org Date: Sunday, May 30, 2010, 9:34 AM Yes, but I am using JDBC and followed the setup step by step from tomcat docs ?xml version=1.0 encoding=UTF-8? Server port=9170 Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Resource auth=Container description=User database name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ /GlobalNamingResources Service name=Catalina Connector port=9670 minSpareThreads=1 address=127.0.0.1 maxThreads=50 maxSpareThreads=3 connectionTimeout=3 protocol=AJP/1.3 /Connector Engine defaultHost=thejarbar.org name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/Realm className=org.apache.catalina.realm.JDBCRealm driverName=com.mysql.jdbc.Driver connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar connectionName=yucca123_tom connectionPassword=myPass userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/Host appBase=/home/yucca123/public_html name=thejarbar.org Aliaswww.thejarbar.org/Alias Context path=/the_jar_bar Listener className=org.apache.catalina.startup.TldConfig/ /Context Context docBase=/usr/local/tomcat/users/yucca123/tomcat/webapps/manager path=/manager privileged=true reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ ResourceEnvRef name=users type=org.apache.catalina.UserDatabase/ /Context Context docBase=the_jar_bar path= reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ /Context /Host /Engine /Service /Server May be missing something... http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC%20Data%20Sources This error does not occur every time -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc
problems at thejarbar.org
The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces Servlet]The registration code that leads to error is as follows: Form: !--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 14:07:31To change this template use File | Settings | File Templates.--%...@page contentType=text/html language=java %%...@page pageEncoding=UTF-8%%...@taglib uri=http://java.sun.com/jsf/core; prefix=f %%@ taglib prefix=h uri=http://java.sun.com/jsf/html; %htmlheadmeta http-equiv=Content-Type content=text/html; charset=UTF-8 /titleThe jar bar:: register/title/headf:view body style=background-color:#7b68ee;margin:autodiv align=center div align=center id=headerjsp:include page=/header.jsp//div div align=center id=centred-contentstyle=border-width:3px; border-style: solid; border-color: #7fffd4;width:800pxdiv id=h1 align=centerh:outputText value=#{registerMsg.h1} style=color:white; font-family:fantasy;font-size:x-large;/ div id=p1 align=centerh:outputText value=#{registerMsg.p1} style=font-size:large;margin-bottom:5em;color:white;/ h:form/h:form/div h:formh:panelGrid columns=2 h:outputText value=*#{registerMsg.name}: style=color:yellow;/
Re: problems at thejarbar.org
would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel wrote: The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces Servlet]The registration code that leads to error is as follows: Form:!--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 14:07:31To change this template use File | Settings | File Templates.--%...@page contentType=text/html language=java %%...@page pageEncoding=UTF-8%%...@taglib uri=http://java.sun.com/jsf/core; prefix=f %%@ taglib prefix=h uri=http://java.sun.com/jsf/html; %htmlhead meta http-equiv=Content-Type content=text/html; charset=UTF-8 / titleThe jar bar:: register/title/headf:view body style=background-color:#7b68ee;margin:auto div align=center div align=center id=headerjsp:include page=/header.jsp//div div align=center id=centred-contentstyle=border-width:3px; border-style: solid; border-color: #7fffd4;width:800px div id=h1 align=center h:outputText value=#{registerMsg.h1} style=color:white; font-family:fantasy;font-size:x-large;/ div id=p1 align=center h:outputText value=#{registerMsg.p1} style=font-size:large;margin-bottom:5em;color:white;/ h:form /h:form /div
Re: problems at thejarbar.org
Yes, but I am using JDBC and followed the setup step by step from tomcat docs ?xml version=1.0 encoding=UTF-8? Server port=9170 Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener/ Listener className=org.apache.catalina.core.JasperListener / Listener className=org.apache.catalina.mbeans.ServerLifecycleListener/ GlobalNamingResources Resource auth=Container description=User database name=UserDatabase type=org.apache.catalina.UserDatabase pathname=conf/tomcat-users.xml factory=org.apache.catalina.users.MemoryUserDatabaseFactory/ /GlobalNamingResources Service name=Catalina Connector port=9670 minSpareThreads=1 address=127.0.0.1 maxThreads=50 maxSpareThreads=3 connectionTimeout=3 protocol=AJP/1.3 /Connector Engine defaultHost=thejarbar.org name=Catalina Realm className=org.apache.catalina.realm.UserDatabaseRealm/Realm className=org.apache.catalina.realm.JDBCRealm driverName=com.mysql.jdbc.Driver connectionURL=jdbc:mysql://localhost:3306/yucca123_thejarbar connectionName=yucca123_tom connectionPassword=myPass userTable=users userNameCol=user_name userCredCol=user_pass userRoleTable=user_roles roleNameCol=role_name/Host appBase=/home/yucca123/public_html name=thejarbar.org Aliaswww.thejarbar.org/Alias Context path=/the_jar_bar Listener className=org.apache.catalina.startup.TldConfig/ /Context Context docBase=/usr/local/tomcat/users/yucca123/tomcat/webapps/manager path=/manager privileged=true reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ ResourceEnvRef name=users type=org.apache.catalina.UserDatabase/ /Context Context docBase=the_jar_bar path= reloadable=true Listener className=org.apache.catalina.startup.TldConfig/ /Context /Host /Engine /Service /Server May be missing something... http://tomcat.apache.org/tomcat-6.0-doc/jndi-resources-howto.html#JDBC%20Data%20Sources This error does not occur every time -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel wrote: The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR
Re: problems at thejarbar.org
Ok I need to keep connection open to avoid exceeption but have found this is deprecated autoReconnect=true can someone provide up to date strategy for dealing with this? -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel wrote: The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces Servlet]The registration code that leads to error is as follows: Form:!--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 14:07:31To change this template use File | Settings | File Templates.--%...@page contentType=text/html language=java %%...@page pageEncoding=UTF-8%%...@taglib uri=http://java.sun.com/jsf/core; prefix=f %%@ taglib prefix=h uri=http://java.sun.com/jsf/html; %htmlhead meta http-equiv=Content-Type content=text/html; charset=UTF-8 / titleThe jar bar:: register/title/headf:view body style=background-color:#7b68ee;margin:auto div align=center div align=center id=headerjsp:include page=/header.jsp//div div align=center id=centred-contentstyle=border-width:3px; border-style: solid; border-color: #7fffd4;width:800px div id=h1 align=center h:outputText value=#{registerMsg.h1} style=color:white; font-family:fantasy;font-size:x
Re: problems at thejarbar.org
I have found following hibernate property will this shelp? no API docs in inellij for this. Could someone explain use? -- From: Yucca Nel yucca...@live.co.za Sent: Sunday, May 30, 2010 7:53 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org Ok I need to keep connection open to avoid exceeption but have found this is deprecated autoReconnect=true can someone provide up to date strategy for dealing with this? -- From: Jeff jwi...@cox.net Sent: Sunday, May 30, 2010 5:54 PM To: Tomcat Users List users@tomcat.apache.org Subject: Re: problems at thejarbar.org would this help? http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html#Common%20Problems On 5/30/2010 10:08 AM, Yucca Nel wrote: The following is becoming a common and serious problem and I am unable to find a google solution for it... I have never seen sych an error and it does not appear to be common enough to get many google hits but when it happens, no one is able to register at my site... Stck trace: Caused by: com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure The last packet successfully received from the server was 4,290,127 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.mysql.jdbc.Util.handleNewInstance(Util.java:406) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1074) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:3052) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2938) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3481) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077) at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228) at org.apache.catalina.realm.JDBCRealm.getPassword(JDBCRealm.java:550) ... 15 more Caused by: java.io.EOFException: Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:2497) at com.mysql.jdbc.MysqlIO.reuseAndReadPacket(MysqlIO.java:2949) ... 23 more ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - Communications link failure The last packet successfully received from the server was 4,299,820 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.hibernate.util.JDBCExceptionReporter - No operations allowed after connection closed.Connection was implicitly closed by the driver. ERROR TP-Processor6 org.apache.catalina.core.ContainerBase.[Catalina].[thejarbar.org].[/].[Faces Servlet]The registration code that leads to error is as follows: Form:!--Created by IntelliJ IDEA.User: ownerDate: 02.mai.2010Time: 14:07:31To change this template use File | Settings | File Templates.--%...@page contentType=text/html language=java %%...@page pageEncoding=UTF-8%%...@taglib uri=http://java.sun.com/jsf/core; prefix=f %%@ taglib prefix=h uri=http://java.sun.com/jsf/html; %htmlhead meta http-equiv=Content-Type content=text/html; charset=UTF-8 / titleThe jar bar:: register/title/headf:view body style=background-color:#7b68ee;margin:auto