Re: disable caching of static files in tomcat 5.5
- Original Message - From: Joerg Endrullis [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Tuesday, September 16, 2008 1:13 PM Subject: disable caching of static files in tomcat 5.5 Hi, I have a dynamically generated image a.jpg and I want Tomcat to always deliver the current version. Unfortunately Tomcat seems to have some kind of caching of static files? Where can one disable caching of static files in Tomcat? Why do I think Tomcat has caching of static files... You can reproduce the problem as follows: - create two different images x.jpg and y.jpg - then create a symbolic link from a.jpg to x.jpg, download a.jpg, change the symbolic link to y.jpg, download a.jpg again: $ ln -s x.jpg a.jpg; $ wget http://localhost:8180/a.jpg?time=0; $ rm a.jpg; $ ln -s y.jpg a.jpg; $ wget http://localhost:8180/a.jpg?time=1 You will see that both downloaded images a.jpg.1 and a.jpg.2 are equal to x.jpg, which leads to the conclusion that Tomcat uses some kind of caching. (in order to reproduce the problem, the commands have to be executed fast after each other, if you wait 5 seconds before the last wget, then Tomcat returns the correct image) Btw. it does not help to attach an artificial time-stamp to the URL: $ ln -s x.jpg a.jpg; $ wget http://localhost:8180/a.jpg?time=0; $ rm a.jpg; $ ln -s y.jpg a.jpg; $ wget http://localhost:8180/a.jpg?time=1 will produce identical images a.jpg?time=0 and a.jpg?time=1. Any help would be appreciated. Thanks, Joerg Joerg, not sure here... but this is what I think is happening... The images are been delivered to the page using ETAGS... basically they look at the file on disk size and modified time... If that changes they send it, if it does change it, nothing is sent to the browser... It seems to imply that symboloc links are not changing these links... but I dont think linux is that stupid... So I think its just the browser hanging on so try this... in the main JSP servlet/html page do this... response.setHeader(Cache-Control, no-cache); response.setHeader(Expires, Sun, 15 Jan 1998 17:00:00 GMT); response.setHeader(Pragma, no-cache); response.setDateHeader(Max-Age, 0); In html this is all meta tags... just look em up... Now you saying to the browser do not cache this page... and I'm hopng thats the images as well, and that ETAGS are not an issue with links... ie if it doesnt work... linux is showing tomcat the same modified time (doubtful) or tomcat can detect the change of the file, and does not update the etag stuff... more likely... hopefully telling the whole page not to cache gets around it... You have to do it all those ways because MS did their own thing... as usual ;) Have fun... --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() If that is all correct then why do my active connections keep increasing? Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] Context Resource name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / /Context [/code] My Host configuration in server.xml [code] Host name=www.mysite.com deployOnStartup=true debug=0 appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false Valve className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ Aliasmysite.com/Alias /Host [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS = Logger.getLogger(manyconnections); private static BasicDataSource ds = null; public static DataSource getDataSource() throws SQLException { if (ds == null) { DATASOURCE.info(DataSource is NULL ); MANY_CONNECTIONS.info(DataSource is NULL ); try { final Context initContext = new InitialContext(); ds = (BasicDataSource)initContext.lookup(java:/comp/env/jdbc/myDB); initContext.close(); logDataSource(ds); return ds; } catch (final NamingException e) { e.printStackTrace(); throw new RuntimeException(Java naming exception when getting connection from tomcat pool: + e.getMessage()); } } else { logDataSource(ds); return ds; } } /** * Logs the datasource. * @param ds */ private static void logDataSource(final BasicDataSource ds) {
Re: Balance and sync data
On Tue, Sep 16, 2008 at 6:38 AM, Martin Spinassi [EMAIL PROTECTED] wrote: I don't know yet, I didn't try it yet, I was waiting to see if there is a better solution than rsync them every minute. Why not have your upload servlet invoke rsync when a new file has been stored? -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
How exaclt do you mean? Anywhere in my code where you have seen that? Thanks! Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 10:26:03 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() If that is all correct then why do my active connections keep increasing? Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / [/code] My Host configuration in server.xml [code] appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ mysite.com [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS = Logger.getLogger(manyconnections); private static BasicDataSource ds = null; public static DataSource getDataSource() throws SQLException { if (ds == null) { DATASOURCE.info(DataSource is NULL ); MANY_CONNECTIONS.info(DataSource is NULL ); try { final Context initContext = new InitialContext(); ds = (BasicDataSource)initContext.lookup(java:/comp/env/jdbc/myDB); initContext.close(); logDataSource(ds); return ds; } catch (final NamingException e) { e.printStackTrace(); throw new RuntimeException(Java naming exception when getting connection from tomcat pool: + e.getMessage()); } } else { logDataSource(ds); return ds; } } /** * Logs the datasource. * @param ds */ private static void logDataSource(final BasicDataSource ds) { DATASOURCE.info(The max active connections are : + ds.getMaxActive()); DATASOURCE.info(The max idle connections are : + ds.getMaxIdle()); DATASOURCE.info(The max wait is : + ds.getMaxWait()); DATASOURCE.info(The max opening prepared statements are : + ds.getMaxOpenPreparedStatements()); DATASOURCE.info(The number of active connections are : + ds.getNumActive()); DATASOURCE.info(The
RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
At the end of the servlet or JSP or whichever, you need to kill off connections created that you establish. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 9:56 AM To: Tomcat Users List Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing How exaclt do you mean? Anywhere in my code where you have seen that? Thanks! Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 10:26:03 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() -- -- If that is all correct then why do my active connections keep increasing? -- -- Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / [/code] My Host configuration in server.xml [code] appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ mysite.com [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS = Logger.getLogger(manyconnections); private static BasicDataSource ds = null; public static DataSource getDataSource() throws SQLException { if (ds == null) { DATASOURCE.info(DataSource is NULL ); MANY_CONNECTIONS.info(DataSource is NULL ); try { final Context initContext = new InitialContext(); ds = (BasicDataSource)initContext.lookup(java:/comp/env/jdbc/myDB); initContext.close(); logDataSource(ds); return ds; } catch (final NamingException e) { e.printStackTrace(); throw new RuntimeException(Java naming exception when getting connection from tomcat pool: + e.getMessage()); } } else { logDataSource(ds); return ds; } } /** * Logs the datasource. * @param ds */ private static void logDataSource(final BasicDataSource ds) { DATASOURCE.info(The max active connections are :
RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
Yes, as I said in the first post, that I have checked through all the code, and I am closing all the connections (in a finally block) after they have been used. final Connection connection = datasource.getConnection(); try { ... .. blah .. blah } finally { connection.close(); } Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 11:02:46 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org At the end of the servlet or JSP or whichever, you need to kill off connections created that you establish. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 9:56 AM To: Tomcat Users List Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing How exaclt do you mean? Anywhere in my code where you have seen that? Thanks! Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 10:26:03 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() -- -- If that is all correct then why do my active connections keep increasing? -- -- Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / [/code] My Host configuration in server.xml [code] appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ mysite.com [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS = Logger.getLogger(manyconnections); private static BasicDataSource ds = null; public static DataSource getDataSource() throws SQLException { if (ds == null) { DATASOURCE.info(DataSource is NULL ); MANY_CONNECTIONS.info(DataSource is NULL ); try { final Context initContext = new InitialContext(); ds =
Re: Balance and sync data
On Tue, 2008-09-16 at 07:37 -0700, Hassan Schroeder wrote: On Tue, Sep 16, 2008 at 6:38 AM, Martin Spinassi [EMAIL PROTECTED] wrote: I don't know yet, I didn't try it yet, I was waiting to see if there is a better solution than rsync them every minute. Why not have your upload servlet invoke rsync when a new file has been stored? Is that possible? I'm far away from a java programmer, and have few fights against tomcat to know those kinds of tricks. Can you give me some more details or where to get some more info? This looks like what I was searching for. Thanks! Martín - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
- Original Message - From: sinoea kaabi [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:10 PM Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Yes, as I said in the first post, that I have checked through all the code, and I am closing all the connections (in a finally block) after they have been used. final Connection connection = datasource.getConnection(); try { BUT you have a return branches; HERE It can never get to HERE Just put the return after the finally blah .. blah } finally { connection.close(); } Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 11:02:46 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org At the end of the servlet or JSP or whichever, you need to kill off connections created that you establish. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 9:56 AM To: Tomcat Users List Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing How exaclt do you mean? Anywhere in my code where you have seen that? Thanks! Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 10:26:03 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() -- -- If that is all correct then why do my active connections keep increasing? -- -- Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / [/code] My Host configuration in server.xml [code] appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ mysite.com [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS =
Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
return statements do not prevent the finally block from executing: http://java.sun.com/docs/books/tutorial/essential/exceptions/finally.html B. Johnny Kewl wrote: - Original Message - From: sinoea kaabi [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:10 PM Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Yes, as I said in the first post, that I have checked through all the code, and I am closing all the connections (in a finally block) after they have been used. final Connection connection = datasource.getConnection(); try { BUT you have a return branches; HERE It can never get to HERE Just put the return after the finally blah .. blah } finally { connection.close(); } Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 11:02:46 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org At the end of the servlet or JSP or whichever, you need to kill off connections created that you establish. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 9:56 AM To: Tomcat Users List Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing How exaclt do you mean? Anywhere in my code where you have seen that? Thanks! Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 10:26:03 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() -- -- If that is all correct then why do my active connections keep increasing? -- -- Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / [/code] My Host configuration in server.xml [code] appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ mysite.com [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL =
RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
Yeah, that should be closing itwould you be establishing the connection(s) anywhere else though? And do you have a ResultsSet that you're leaving open? You would need to close that, too. Same for any prepared or callable statement as well. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 10:10 AM To: Tomcat Users List Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Yes, as I said in the first post, that I have checked through all the code, and I am closing all the connections (in a finally block) after they have been used. final Connection connection = datasource.getConnection(); try { ... .. blah .. blah } finally { connection.close(); } Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 11:02:46 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org At the end of the servlet or JSP or whichever, you need to kill off connections created that you establish. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 9:56 AM To: Tomcat Users List Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing How exaclt do you mean? Anywhere in my code where you have seen that? Thanks! Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Date: Tue, 16 Sep 2008 10:26:03 -0400 From: [EMAIL PROTECTED] To: users@tomcat.apache.org Sounds like you're not explicitly killing off the connections you set in the first place. -Original Message- From: sinoea kaabi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 4:24 AM To: users@tomcat.apache.org Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() -- -- If that is all correct then why do my active connections keep increasing? -- -- Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / [/code] My Host configuration in server.xml [code] appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ mysite.com [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL =
Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
- Original Message - From: Brantley Hobbs [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:27 PM Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing return statements do not prevent the finally block from executing: http://java.sun.com/docs/books/tutorial/essential/exceptions/finally.html I stand corrected... Always understood as during exception handling... but you right it seems I just cant bring myself to write code like that... feels un-natural... I would still put return after the close... apologies... --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
sinoea I dont use the JNDI pools, but I've marked a possible issue below... Dont think its getting to finally guess ;) On the dB pools I use... connections will not increase... unless that many threads are used at same time.. ie the connections represent a max activity level... otherwise it wont increase... ... why it resets at 37 I dont know, but I think you are leaking connections... - Original Message - From: sinoea kaabi [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Tuesday, September 16, 2008 11:23 AM Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() If that is all correct then why do my active connections keep increasing? Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] Context Resource name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / /Context [/code] My Host configuration in server.xml [code] Host name=www.mysite.com deployOnStartup=true debug=0 appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false Valve className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ Aliasmysite.com/Alias /Host [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS = Logger.getLogger(manyconnections); private static BasicDataSource ds = null; public static DataSource getDataSource() throws SQLException { if (ds == null) { DATASOURCE.info(DataSource is NULL ); MANY_CONNECTIONS.info(DataSource is NULL ); try { final Context initContext = new InitialContext(); ds = (BasicDataSource)initContext.lookup(java:/comp/env/jdbc/myDB); initContext.close(); logDataSource(ds); return ds; } catch (final NamingException e) { e.printStackTrace(); throw new RuntimeException(Java naming exception when getting connection from tomcat pool: + e.getMessage()); } }
Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
- Original Message - From: Johnny Kewl [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:17 PM Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing - Original Message - From: sinoea kaabi [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:10 PM Subject: RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Yes, as I said in the first post, that I have checked through all the code, and I am closing all the connections (in a finally block) after they have been used. final Connection connection = datasource.getConnection(); try { BUT you have a return branches; HERE It can never get to HERE Just put the return after the finally blah .. blah } finally { connection.close(); } sinoea in the context of exceptions finally is always run... exception or not... BUT... you still have to let the program get there ... you returning too early the connections are not closing... Have fun... --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Balance and sync data
On Tue, Sep 16, 2008 at 8:17 AM, Martin Spinassi [EMAIL PROTECTED] wrote: Why not have your upload servlet invoke rsync when a new file has been stored? Can you give me some more details or where to get some more info? Runtime.exec(/usr/bin/rsync) -- though you may want to instead invoke a script file containing the appropriate rsync arguments. This works fine. I've even used rsync's dry-run mode to create a list of files that differed between two systems (e.g. staging and production) to generate a form page and allow the user to pick which ones to sync. HTH, -- Hassan Schroeder [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Balance and sync data
On Tue, 2008-09-16 at 08:56 -0700, Hassan Schroeder wrote: On Tue, Sep 16, 2008 at 8:17 AM, Martin Spinassi [EMAIL PROTECTED] wrote: Why not have your upload servlet invoke rsync when a new file has been stored? Can you give me some more details or where to get some more info? Runtime.exec(/usr/bin/rsync) -- though you may want to instead invoke a script file containing the appropriate rsync arguments. This works fine. I've even used rsync's dry-run mode to create a list of files that differed between two systems (e.g. staging and production) to generate a form page and allow the user to pick which ones to sync. HTH, Thanks Hassan! I'll talk to developers to give it a try at our test environment. Martín - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
Yeah, it sounds that wayalmost like passing off one query to another servlet or page, and then the leak occurs. Do you have a monitoring tool that you can see the connections increase? -Original Message- From: Johnny Kewl [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 8:37 AM To: Tomcat Users List Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing sinoea I dont use the JNDI pools, but I've marked a possible issue below... Dont think its getting to finally guess ;) On the dB pools I use... connections will not increase... unless that many threads are used at same time.. ie the connections represent a max activity level... otherwise it wont increase... ... why it resets at 37 I dont know, but I think you are leaking connections... - Original Message - From: sinoea kaabi [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Tuesday, September 16, 2008 11:23 AM Subject: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing Dear all, I seem to have problems with connection pooling. I have tried so many ways, before I use to get the exhausted scenario, where there were no connections left to use, and now I am getting a different problem. I have been digging in this issue for too long, and I am not sure if I understand the depth of the connection pooling concept. I have set the max active connections to 40. My active connections keep increasing, they never seem to return back to the pool, eventhough when no-one is visiting the site. (Well, I have had up to 3 idle connections and that is the most I have ever had) After a few days, the active connections reach to 37, and then afterwards the active connections are reset to 0. It basically starts from 0 to 37 and then again 0 to 37, and so on My understanding is that: 1. An active connection is a connection that is currently used, and not yet returned back to the pool 2. An active connection will be returned back to the pool straight after its usage and become an idle connection The active connection is returned back to the pool as soon as you call the connection.close() method (assuming that you have configured for connection pooling) 3. An idle connection can only be idle for an X amount of time and then it will be removed from the pool and get destroyed 4. An idle connection will become an active connection when it is required and then returned back to the pool as an idle connection when calling connection.close() If that is all correct then why do my active connections keep increasing? Am I closing all the connections? Well, I have checked every single line of code, and yes I am closing result sets, statements and connections in a finally block: [code] } finally { results.close(); } } finally { statement.close(); } } finally { connection.close(); } [/code] Please have a look at my code and configuration below: My environment: JDK 1.5.0_12 Tomcat 5.5.27 MySQL 5 My Web apps context.xml under the META-INF folder: [code] Context Resource name=jdbc/myDB factory=org.apache.commons.dbcp.BasicDataSourceFactory auth=Container type=javax.sql.DataSource maxActive=40 maxIdle=10 maxWait=15000 removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true username=username password=password driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/mydb / /Context [/code] My Host configuration in server.xml [code] Host name=www.mysite.com deployOnStartup=true debug=0 appBase=webapps/mysite unpackWARs=true autoDeploy=false xmlValidation=false xmlNamespaceAware=false Valve className=org.apache.catalina.valves.FastCommonAccessLogValve prefix=mysite_access_log. suffix=.txt pattern=common directory=C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/mysite/logs/ Aliasmysite.com/Alias /Host [/code] Here is the class that I use the get the datasource [code] import... public class Data { private static final Logger SQL = Logger.getLogger(sql); private static final Logger DATASOURCE = Logger.getLogger(datasource); private static final Logger MANY_CONNECTIONS = Logger.getLogger(manyconnections); private static BasicDataSource ds = null; public static DataSource getDataSource() throws SQLException { if (ds == null) { DATASOURCE.info(DataSource is NULL ); MANY_CONNECTIONS.info(DataSource is NULL ); try { final Context
Can I get Millisecond precision in Access Logs?
Is it possible to obtain timestamps with millisecond precision in access logs? I don't see anything about specifying the date-time stamps on AccessLogValve page and was wondering if there wasn't a way to get this data. Tomcat 5.5 Thanks
Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing....
- Original Message - From: Johnny Kewl [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:41 PM Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing - Original Message - From: Brantley Hobbs [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 5:27 PM Subject: Re: Tomcat 5.5, JNDI Connection Pooling, Active connections keep increasing return statements do not prevent the finally block from executing: http://java.sun.com/docs/books/tutorial/essential/exceptions/finally.html I stand corrected... Always understood as during exception handling... but you right it seems I just cant bring myself to write code like that... feels un-natural... I would still put return after the close... apologies... Ok sinoea, what I thought was just s little slip turns out to be right... I actually tested it... that finally does run as the method loses scope... I actually wonder how they do that... I imagine a destructor in a C class underneath Java... its interesting, but I got to tell you, you doing the all the good text bokk stuff, but the code makes me feel uncomfortable... Anyway... I think you got a threading problem... You using static class and servlets are multithreaded Rather do something like this... CollectionBranch branches = new BranchData().loadBranches(Data.getDataSource(), 1); and get rid of the static methods in that BranchData class ie make it thread safe... at the moment you have multiple threads in that static method... and with that finally I really dont know... haha and then... results.close(); statement.close(); connection.close(); return branches; Would make me happy... and handle those exceptions } catch (SQLException e) { branch.setErrorMsg(Dear User, you have run out of connections); }finally{ //absolute critical stuff } But that really is just a style thing from the looks of things... although I do think that with just a finally, you will still get a ungly servlet exception... ie you are definitely cleaning up... but you not telling the user why... its style You doing all the good stuff... but more important even if you forget a final or two... is just a nice clean readable flow... I think ;) We have a style clash ;) Anyway thing your problem may go away once its thread safe ;) Thanks... learnt something ;) Will keep guessing till we get it ;) --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Non-Heap Memory always increasing during deployment for TC 5.5.26/Solaris/JVM 1.5.0_16
I think you need to add one more line to your CATALINA_OPTS statement: -Dcom.sun.management.jmxremote=true If that does not help you, I'd try using port 6969 (the default) instead of . It should not matter, but I would at least give it a try as part of the troubleshooting process. You could also check to make sure you have access to the system on port , and that there are no firewalls (or iptables) in between you and the system preventing access to this port. Brian - Original Message From: emerson cargnin [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, September 16, 2008 8:40:59 AM Subject: Re: Non-Heap Memory always increasing during deployment for TC 5.5.26/Solaris/JVM 1.5.0_16 Correcting, in windows I wasn't actually connected to tomcat. For some reason it wouldn't allow me to choose a port with the following appended to catalina.bat set CATALINA_OPTS=-Dcom.sun.management.jmxremote.port= -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false Anyone knows why? regards emerson 2008/9/16 emerson cargnin [EMAIL PROTECTED]: Hi I tried to find about this in the tomcat faq, google, but still haven't found the reason for this strange behaviour. Every time I hot-deploy an application, the non-heap memory goes up. This ends up breaking the tomcat server with the message: Exception in thread RMI TCP Connection(13)-12.169.193.2 java.lang.OutOfMemoryError: PermGen space I profiled it and got the result in the image: http://home.zenly.co.uk/emerson/Console.png I tested in two different solaris servers witht he same behaviour. Even after I undeployed the application via manager app the memory didn't go down. I know I can get this non-heap memory up using -XX:MaxPermSize but shouldn't the memory go down after the undeployment? My Configuration: JVM: JVM 1.5.0_16 Server: SunOS boxname 5.10 Generic_120011-14 sun4v sparc SUNW,Sun-Fire-T200 Tomcat: 5.5.26 I just did the same test on windows and I couldn't see the non-heap memory going mad. Thanks a lot Emerson - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat 6.0 upgrade details
I am a Tomcat 5.5.x user and I am considering upgrading to Tomcat 6.0. In particular I am interested in knowing more about the details of changes made to Memory usage optimizations and Refactored clustering, two of the changes mentioned in 6.0. Performance and scalability are becoming important on my current project and I would like to know what upgrading will buy me. Does anyone on this list know? Thanks in advance, Dave The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.
Re: Can I get Millisecond precision in Access Logs?
It is. The docs are here: http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/valves/AccessLogValve.html I use Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=unity_access. suffix=.log pattern=%h %v %t %s %b %D %{RUNNING}c %r/ The AccessLogValve must be used and it is the %D spec that show milliseconds. Tomcat 5.5.x Regards, Dave On Sep 16, 2008, at 11:39 AM, Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? I don't see anything about specifying the date-time stamps on AccessLogValve page and was wondering if there wasn't a way to get this data. Tomcat 5.5 Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I get Millisecond precision in Access Logs?
Ah, but %D is the time taken to process the request in ms. It's not the timestamp. On Tue, Sep 16, 2008 at 3:14 PM, David Fisher [EMAIL PROTECTED]wrote: It is. The docs are here: http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/valves/AccessLogValve.html I use Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=unity_access. suffix=.log pattern=%h %v %t %s %b %D %{RUNNING}c %r/ The AccessLogValve must be used and it is the %D spec that show milliseconds. Tomcat 5.5.x Regards, Dave On Sep 16, 2008, at 11:39 AM, Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? I don't see anything about specifying the date-time stamps on AccessLogValve page and was wondering if there wasn't a way to get this data. Tomcat 5.5 Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Tomcat Cluster Deployer
Is there any (complete) documentation on the Cluster Deployer? The official documentation doesn't actually say anything about it (or let alone anything useful at all...): http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html I'm trying to set up an environment that is both clustering sessions (well documented) and also replicating WARs/apps to the cluster, rather than requiring WAR deployment to each server. Any help is appreciated. Paul McGurn | Manager, Customer Support Escalations Operations * ** LogMeIn, Inc. www.LogMeIn.comhttp://www.logmein.com/ | [EMAIL PROTECTED]mailto:[EMAIL PROTECTED] p. +1 781.897.1320 | f. +1 781.897.0632
tomcat versioning
Hi Tomcat gurus, can somebody please explain to me little bit more Tomcat versioning than I can find at following link? http://tomcat.apache.org/whichversion.html I'm interested in compatibility level (binary/source) between various Tomcat Major.Minor.Micro releases. What is intention and what is reality? Is there a plan for other Tomcat version after Tomcat 6.x? 6.1 or 7? Thanks, Petr - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I get Millisecond precision in Access Logs?
Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? One of the nice things about open source is that you can read the source code to see exactly how it does things. In this case you want http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java Look for getDate() Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Cluster Deployer
Paul McGurn wrote: Is there any (complete) documentation on the Cluster Deployer? The official documentation doesn't actually say anything about it (or let alone anything useful at all...): http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html The source code is probably your best bet. See http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java As far as I am aware, it isn't production ready. As always, patches are welcome. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: tomcat versioning
Petr Sumbera wrote: Hi Tomcat gurus, can somebody please explain to me little bit more Tomcat versioning than I can find at following link? http://tomcat.apache.org/whichversion.html I'm interested in compatibility level (binary/source) between various Tomcat Major.Minor.Micro releases. What is intention and what is reality? Compatibility in what sense? Major: The spec changes but spec complaint webapps that work on x.y.x should work on any (x+1).y.z. If it doesn't that is a bug. Internally, could be major API changes, configuration changes, etc. Minor: Usually means internal API change. If you have written custom components then they might need changing. In reality, the changes are usually so deep in the internals that you won't be affected. Micro: No API breakage. Everything should be backwards compatible. Behaviour should also be the same. Where it isn't, options are usually provided to enable the previous behaviour. Is there a plan for other Tomcat version after Tomcat 6.x? 6.1 or 7? http://wiki.apache.org/tomcat/TomcatVersions 6.2.x has been discussed but never happened. It may still happen. 7.0.x will support the 3.0 servlet spec. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Tomcat Cluster Deployer
Thanks Mark. I'll work at actually translating this into real documentation and examples. As far as patching, I'm not qualified to do that, but I'd be willing to take a crack at it if there's a list of bugs/wishlist items for it. Paul McGurn -Original Message- From: Mark Thomas [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 3:50 PM To: Tomcat Users List Subject: Re: Tomcat Cluster Deployer Paul McGurn wrote: Is there any (complete) documentation on the Cluster Deployer? The official documentation doesn't actually say anything about it (or let alone anything useful at all...): http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html The source code is probably your best bet. See http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java As far as I am aware, it isn't production ready. As always, patches are welcome. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I get Millisecond precision in Access Logs?
Correct, I realized after I posted. I guess you'll have to get the source code for AccessLogValve and roll your own override... I found this article via google accesslogvalve tomcat source 4th link: http://www.devx.com/Java/Article/32730/1954 includes a source code archive and the example in the article shows milliseconds on the timestamp. 5th link: http://www.docjar.com/html/api/org/apache/catalina/valves/AccessLogValve.java.html is tomcat 6 source and you quickly see what to look for in the code: 874 timeFormatter = new SimpleDateFormat(HH:mm:ss); HTH Dave On Sep 16, 2008, at 2:27 PM, Jonathan Mast wrote: Ah, but %D is the time taken to process the request in ms. It's not the timestamp. On Tue, Sep 16, 2008 at 3:14 PM, David Fisher [EMAIL PROTECTED]wrote: It is. The docs are here: http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/valves/AccessLogValve.html I use Valve className=org.apache.catalina.valves.AccessLogValve directory=logs prefix=unity_access. suffix=.log pattern=%h %v %t %s %b %D %{RUNNING}c %r/ The AccessLogValve must be used and it is the %D spec that show milliseconds. Tomcat 5.5.x Regards, Dave On Sep 16, 2008, at 11:39 AM, Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? I don't see anything about specifying the date-time stamps on AccessLogValve page and was wondering if there wasn't a way to get this data. Tomcat 5.5 Thanks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat Cluster Deployer
Paul McGurn wrote: Thanks Mark. I'll work at actually translating this into real documentation and examples. As far as patching, I'm not qualified to do that, but I'd be willing to take a crack at it if there's a list of bugs/wishlist items for it. Sounds great. I don't recall any open bugs - check bugzilla. I'm sure you'll find some when you test it. Crate bugzilla entries as you find them and add patches where you can. Also, if you create a bugzilla entry for any doc changes I'll make sure they get applied. Note all the source for the docs is in xml not html. Mark Paul McGurn -Original Message- From: Mark Thomas [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 3:50 PM To: Tomcat Users List Subject: Re: Tomcat Cluster Deployer Paul McGurn wrote: Is there any (complete) documentation on the Cluster Deployer? The official documentation doesn't actually say anything about it (or let alone anything useful at all...): http://tomcat.apache.org/tomcat-6.0-doc/config/cluster-deployer.html The source code is probably your best bet. See http://svn.apache.org/repos/asf/tomcat/trunk/java/org/apache/catalina/ha/deploy/FarmWarDeployer.java As far as I am aware, it isn't production ready. As always, patches are welcome. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Balance and sync data
Martin Spinassi wrote: On Tue, 2008-09-16 at 08:56 -0700, Hassan Schroeder wrote: On Tue, Sep 16, 2008 at 8:17 AM, Martin Spinassi [EMAIL PROTECTED] wrote: Why not have your upload servlet invoke rsync when a new file has been stored? Can you give me some more details or where to get some more info? Runtime.exec(/usr/bin/rsync) -- though you may want to instead invoke a script file containing the appropriate rsync arguments. This works fine. I've even used rsync's dry-run mode to create a list of files that differed between two systems (e.g. staging and production) to generate a form page and allow the user to pick which ones to sync. HTH, Thanks Hassan! I'll talk to developers to give it a try at our test environment. The question I've been holding back since your initial post, is why exactly you do want to load-balance similar requests to 2 Tomcats ? Just an idea : If it is because you have a) image stuff and b) non-image stuff, and they each represent about 50% of the load, then maybe you do not really want to balance (with the problems of sharing and/or duplicating the images), but you could just use a front-end to split the image stuff and send it to Tomcat-1, and the non-image stuff and send it to Tomcat-2. (Apache + mod_rewrite + mod_proxy). This way, only Tomcat-1 would need to handle the images (up and down) and it would always be up-to-date. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [a little OT] Can I get Millisecond precision in Access Logs?
Mark, Interesting but shouldn't the getDate method be slightly different: if ((systime - currentDate.getTime()) 1000) { In this line if currentDate is at millisecond 900 then the next second starts with the millisec and that is 100 ms later. long cachedtime = currentDate.getTime(); if ((systime - cachedtime 999 - cachedtime%1000) { Yes, I know it is a quibble about what is probably fuzzy logic. But I'm just a guy who learned to typeset using integers in ebcdic at 300 dpi in Fortran and IBM Sys 370 Assembler and this is a classic next pixel problem with proportional width characters at a small font size. (A comment for all those US-ASCII-7 haters - look up the EBCDIC code table :-) or better look up Hollerith who invented Punchcards for the 1890 US Census. There is some logic to it that is very similar to QWERTY...) Regards, Dave On Sep 16, 2008, at 2:46 PM, Mark Thomas wrote: Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? One of the nice things about open source is that you can read the source code to see exactly how it does things. In this case you want http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java Look for getDate() Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Can I get Millisecond precision in Access Logs?
Does it have the %D reading? Also, I have seen on Apache web server that %D does not work properly for microseconds windows instead it is 15msec resolution due to windows timers. Basically not very usefull since some code is written correctly and is under 15Msec. I think I saw the same issue with Tomcat logging. Open source can run faster than commercial if you know what you are doing. I got Tomcat requests operating under 1 nanosecond at one point in time at the servlet level. Regards, -Tony Anecito Founder, MyUniPortal http://www.myuniportal.com --- On Tue, 9/16/08, Mark Thomas [EMAIL PROTECTED] wrote: From: Mark Thomas [EMAIL PROTECTED] Subject: Re: Can I get Millisecond precision in Access Logs? To: Tomcat Users List users@tomcat.apache.org Date: Tuesday, September 16, 2008, 1:46 PM Jonathan Mast wrote: Is it possible to obtain timestamps with millisecond precision in access logs? One of the nice things about open source is that you can read the source code to see exactly how it does things. In this case you want http://svn.apache.org/repos/asf/tomcat/container/tc5.5.x/catalina/src/share/org/apache/catalina/valves/AccessLogValve.java Look for getDate() Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [a little OT] Can I get Millisecond precision in Access Logs?
David Fisher wrote: Mark, Interesting but shouldn't the getDate method be slightly different: if ((systime - currentDate.getTime()) 1000) { In this line if currentDate is at millisecond 900 then the next second starts with the millisec and that is 100 ms later. long cachedtime = currentDate.getTime(); if ((systime - cachedtime 999 - cachedtime%1000) { Yes, I know it is a quibble about what is probably fuzzy logic. But I'm just a guy who learned to typeset using integers in ebcdic at 300 dpi in Fortran and IBM Sys 370 Assembler and this is a classic next pixel problem with proportional width characters at a small font size. You are right this isn't perfect. I'd need to do some performance tests so see how much slower the more correct code is. To be perfectly honest, I can live with the current implementation and don't feel the urge to scratch this particular itch. Of course, that shoudn't stop anyone else who fancies taking a look at this. Patches that improve the implementation without adding much (actually any in this case) overhead welcome. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDBCRealm.getRoles causes NullPointerException
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Lloyd, DIGLLOYD INC wrote: I am using Realm className=org.apache.catalina.realm.JDBCRealm ... I don't know what's required to use a DataSourceRealm (yet), but if it's a simple switch I'll try it. Ooh, using DataSourceRealm is much better, because you can share the JDBC Connection objects with the rest of your application. It apparently also doesn't suffer from this bug. If you are already using a DataSource in your application, just switch the className and then remove all the connection information from your Realm and replace it with the required DataSource name (see the docs for specifics). I am not sharing anything; the database is used for authentication only. I've declared the realm, but I don't think there's any pool involved. Right: JDBCRealm does not do any connection pooling AFAIK. I don't know how to set up a validation query or debugging options for leaked connections. I see the problem occur just after restarting tomcat so leaked connections shouldn't be the problem. For the DataSourceRealm, you can simply set these options on your Resource that defines the DataSource. You just set the validationQuery attribute to something that your database is guaranteed to execute successfully. MySQL users often choose SELECT 1 but pretty much anything will work. The odd thing is that it has run for 10 days, then it just fails, and then fails after restarting Tomcat. That makes it really hard to isolate the cause. Agreed: very strange. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQHmEACgkQ9CaO5/Lv0PAHVACbBK8J1sFObfNYKMJmPBCLdnG7 JlYAn1nEp8JRGjSrSZgpFW8t8hw7D8Z4 =I6hD -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDBCRealm.getRoles causes NullPointerException
Christopher Schultz wrote: Lloyd, DIGLLOYD INC wrote: I am using Realm className=org.apache.catalina.realm.JDBCRealm ... I don't know what's required to use a DataSourceRealm (yet), but if it's a simple switch I'll try it. Ooh, using DataSourceRealm is much better, because you can share the JDBC Connection objects with the rest of your application. It apparently also doesn't suffer from this bug. If you are already using a DataSource in your application, just switch the className and then remove all the connection information from your Realm and replace it with the required DataSource name (see the docs for specifics). I am not sharing anything; the database is used for authentication only. I've declared the realm, but I don't think there's any pool involved. Right: JDBCRealm does not do any connection pooling AFAIK. It is better than that. It uses a single connection and lots of syncs :) Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tomcat shutdown event
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 To whom it may concern, Tom Cat wrote: I have a servelet spawn a thread that should run until tomcat is shutdown. The problem is, when Tomcat is shut down, the thread keeps running. You need to define your thread as a daemon thread and it won't stop the JVM from shutting down. Don't worry about all this Tomcat lifecycle and servlet init/destroy stuff from the other responses. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQItIACgkQ9CaO5/Lv0PA2wgCfd7Z/9/pbC/zdb9LmludWZosP LQEAniHg9oFR1KwC11w5w1XcRV2JMs49 =tB3N -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JNDI configuration in webapp/META-INF/context.xml
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Walter, walterw wrote: Here are the exact contents in the file after maven filters it. [code] ?xml version='1.0' encoding='utf-8'? !-- http://tomcat.apache.org/tomcat-6.0-doc/config/context.html Even though this works inside of tomcat/conf/context.xml and the documentation says it should work here, it doesn't -- ?xml version='1.0' encoding='utf-8'? Could the double-XML processing instruction be causing a choke? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQJKUACgkQ9CaO5/Lv0PA/vACdFT/Waez3BWjfotWMjOPXhDeU L2sAnj5zG5J3m2W0KlubKCGtNWua6LrH =y+CP -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: JDBCRealm.getRoles causes NullPointerException
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Mark, Mark Thomas wrote: Christopher Schultz wrote: Right: JDBCRealm does not do any connection pooling AFAIK. It is better than that. It uses a single connection and lots of syncs :) Sweet! Sounds like a heckuva first-term freshman hack-job to me. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQJOIACgkQ9CaO5/Lv0PAqOQCggHTR48qmxyWM2zcNXvRckVXi CboAn0MhjoLCSlxsI0xSBfwglg8rCS6P =eOpr -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Question is answered. See Bill Barker-2 answer (update)
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Kazukin, kazukin6 wrote: And yes, for us it' not possible to give users to change only parts of jsp's and deny execution of these parts based on some credential assessments executed during some if checkAccess tags How do your users submit updated JSP files? Do you have the opportunity to scan them before installation? If so, why not simply reject anything containing [EMAIL PROTECTED]? - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQJV4ACgkQ9CaO5/Lv0PCNOACgu+CaPCGqYX+0t1jhPJhDRZ/K b88An1s5lPVnO1xiU2WiBljlYbTC+tZd =AN9/ -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Byte-serving PDFs unsupported? Or broken?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Fred, Fred Toth wrote: I was in fact able to solve this with a simple filter, though this is not a general solution. In hopes that this helps someone else, the filter is included below. i like what you're done here, but it's odd that the DefaultServlet does not include this header by default -- regardless of the file type (you have selected only PDF in your filter, which is probably a safer implementation). if (uri != null uri.endsWith(pdf)) { res.setHeader(Accept-Ranges, bytes); } Why not simply enable this filter only for *pdf requests using filter-mapping? It will probably run faster and make your code simpler. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQJ6kACgkQ9CaO5/Lv0PBg0gCfdZkbKMUyaRk7aej8+hkDVzRP LCUAnR8H5sYdEdsGfJ00utSLnuEJmsgm =HnHL -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Balance and sync data
On Tue, 2008-09-16 at 22:20 +0200, André Warnier wrote: [...] The question I've been holding back since your initial post, is why exactly you do want to load-balance similar requests to 2 Tomcats ? Just an idea : If it is because you have a) image stuff and b) non-image stuff, and they each represent about 50% of the load, then maybe you do not really want to balance (with the problems of sharing and/or duplicating the images), but you could just use a front-end to split the image stuff and send it to Tomcat-1, and the non-image stuff and send it to Tomcat-2. (Apache + mod_rewrite + mod_proxy). This way, only Tomcat-1 would need to handle the images (up and down) and it would always be up-to-date. They are all image stuff. The idea of duplicate those images are availability, just in case one tomcat goes down. But, in the other hand, images (and resize, thumbnails, etc) consumes resources, and the possibility of using just one server is still around my head. If the images load makes big enough, may be using another server just for that could be a good option. I've to read something more about mod_proxy, and see if I can apply it to resolve some load issues. Thanks for your help André, I'll keep your idea in mind to try it before selecting the right one to production. Cheers. Martín - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: question about non-official Tomcat package
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, André Warnier wrote: Anyway, my question is : In this /etc/init.d/tomcat5.5 file, in the start section, there is a line that looks like this : mkfifo -m700 $CATALINA_BASE/logs/catalina.out I am unfamiliar with the mkfifo command. The man page is no help unless you know what a 'fifo' is. Of course, mkfifo creates a fifo! (duh) This will help: http://en.wikipedia.org/wiki/Named_pipe As Brantley points out, Debian is using a fifo (an object on the filesystem) to subvert Tomcat's usual, non-rotatable catalina.out output file and instead sending all those bytes to some other program for likely depositing onto the filesystem in nice, date-stamped files. Does the fact that the rotatelogs utility is also used some lines further down shed any light onto this ? Probably. I'm not familiar with 'rotatelogs' specifically, but it stands to reason that they'd create a consumer for all those log bytes expected to be streaming out to catalina.out after Tomcat starts. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQKyQACgkQ9CaO5/Lv0PB+HACfYxOO4+3+AZ+1qf5+SADSMXJV c7EAoKKX9kSrCf6+zp5j0Rvdj8oTAQVU =Ua3g -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do you have your dev environment setup?
I've been doing a lot of webapp development on tomcat, but currently my process is all manual. I write the code in Eclipse, and then copy the appropriate files over to tomcat. I'd like to automate and standardize my process. So would y'all mind explaining how your dev environment is configured? I'd appreciate the insight. TIA.
RE: Balance and sync data
If you're expecting the size of your image store to grow, or better yet, grow rapidly, you'd be best served to consider a strategy either with mod_proxy/mod_rewrite, or better yet, looking into a CDN (content delivery network) to host the images themselves. Example, I'm about to launch an offering that will allow for our support team to publish video tutorials on how to use our products. It makes absolutely no sense to have a copy of each video file on each front end webserver (we use tomcat as the web server and application container), and it also isn't responsible to deliver a content offering with no redundancy in case of outage/downtime/disaster. Instead, we're leveraging some clever (but very easy) DNS, and Amazon S3 to host the files. By leveraging Amazon, we can link all our content by using a CNAME DNS record, like content.yourname.com , and automatically deliver that content from Amazon. Of course, there are drawbacks. I don't think this method would work in SSL implementations for instance. This link is to the instructions I followed ot deliver content via S3: http://www.carltonbale.com/2007/09/how-to-alias-a-domain-name-or-sub-domain-to-amazon-s3/ Paul McGurn -Original Message- From: Martin Spinassi [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2008 5:53 PM To: users@tomcat.apache.org Subject: Re: Balance and sync data On Tue, 2008-09-16 at 22:20 +0200, André Warnier wrote: [...] The question I've been holding back since your initial post, is why exactly you do want to load-balance similar requests to 2 Tomcats ? Just an idea : If it is because you have a) image stuff and b) non-image stuff, and they each represent about 50% of the load, then maybe you do not really want to balance (with the problems of sharing and/or duplicating the images), but you could just use a front-end to split the image stuff and send it to Tomcat-1, and the non-image stuff and send it to Tomcat-2. (Apache + mod_rewrite + mod_proxy). This way, only Tomcat-1 would need to handle the images (up and down) and it would always be up-to-date. They are all image stuff. The idea of duplicate those images are availability, just in case one tomcat goes down. But, in the other hand, images (and resize, thumbnails, etc) consumes resources, and the possibility of using just one server is still around my head. If the images load makes big enough, may be using another server just for that could be a good option. I've to read something more about mod_proxy, and see if I can apply it to resolve some load issues. Thanks for your help André, I'll keep your idea in mind to try it before selecting the right one to production. Cheers. Martín - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: transparent junctino w/ Tomcat
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Shane, Shane Abernathy wrote: Right now I'm getting the error saying that nothing is listening on the port 8080 and I have the above setup. What above setup? Tomcat 5.5? How about your platform, where you got Tomcat, how you installed it, and how you are attempting to run it? Are there any parameters I need to set in Tomcat for it to work w/ the transparent junctions? - From reading André's message, transparent junctions appear to be nothing other than allowing the web server to read directly from the file system. If that's the case, then yes, Tomcat does support them. - -chris -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkjQLTMACgkQ9CaO5/Lv0PDS7gCglsXXSbov+AlhbaFsF/QTEy8X 4xwAn3VEr7NRgqu8DeHfFho3icfsSNgg =JFCM -END PGP SIGNATURE- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: transparent junctino w/ Tomcat
On the other hand, I find that transparent junctino sounds really good. If those guys at CERN (which must be using multiple Tomcats) ever need a name for a new particle discovered on their brand new Large Hadron Collider.. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: How do you have your dev environment setup?
I use Eclipse with the Web Standard Tools plug-in. That lets me run and debug the app in Eclipse. When the app is ready to go I export it to a .war file and deploy the .war to the server. -- Len On Tue, Sep 16, 2008 at 17:59, Bai Shen [EMAIL PROTECTED] wrote: I've been doing a lot of webapp development on tomcat, but currently my process is all manual. I write the code in Eclipse, and then copy the appropriate files over to tomcat. I'd like to automate and standardize my process. So would y'all mind explaining how your dev environment is configured? I'd appreciate the insight. TIA. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Interapp Communications
Hi Johnny, Thanks for your responses. I did read them on the day that you posted them but only got a chance now to respond. Needless to say I have gone with a simple HttpURLConnection solution, as my choice out of other suggestions given to me in other threads, of using numerous other solutions including RMI, HttpInvoker, JMS, etc. Eventually, the simple HttpURLConnection is nice and lightweight for my needs right now. And now that the beast that is the Commons HttpClient is out of the mix things are far more efficient. Many thanks, Darryl Pentz P.S. Nice to see Saffers helping other Saffers :-) - Original Message From: Johnny Kewl [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, September 15, 2008 11:15:26 AM Subject: Re: Interapp Communications - Original Message - From: Darryl Pentz [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Monday, September 15, 2008 10:37 AM Subject: Interapp Communications Some time back I needed to communicate between two apps running in the same Tomcat instance. I decided on using a simple HTTP call with Apache Commons HttpClient. For some reason use of this class is causing PermGen errors (I should add that I use a dynamic language in the mix, which might impact that in some way) so I want to abandon that approach anyway, because it just doesn't 'feel right' :-). So I was wondering, is JMS the way to go with something like this? I see Tomcat is able to use JMS via a JNDI read-only lookup. Many thanks, Darryl Pentz Well, the way you doing it is also good for cross machine, cross domain you using simple SOAP... Axis your way... That HTTPd client is quite heavy, maybe Java's URL Connection will do what you need I dont bother too much with the stuff out there... JMS is a way, but you looking for JNDI registries now. Not sure if TC built in JNDI... targeting tomcat... will be enuf? Some very rough code for you to play with... Java really makes http very very easy private byte[] loadURLFileBytes(String urlPlusFile) { byte[] data = new byte[0]; try { URL url = new URL(urlPlusFile); URLConnection connection = url.openConnection(); connection.setDoInput(true);//GET connection.setUseCaches(false); // get fresh from server InputStream in = connection.getInputStream(); BufferedInputStream bis = new BufferedInputStream(in); int length = connection.getContentLength(); int len; byte[] buffer = new byte[512]; while ((len = bis.read(buffer)) != -1) { data = appendBlock(data,buffer,len); } in.close(); bis.close(); } catch(Exception ex) { //JOptionPane.showMessageDialog(null, ex.getMessage() , Error during data download, JOptionPane.WARNING_MESSAGE); return null; } return data; } That all your HTTP is doing for you... Then Tomcat can do cross contexts as well... theres a cross context flag to set and some code that looks like this.. The post also describes the issue... http://forums.java.net/jive/thread.jspa?messageID=215873 One day when your site is huge, you making millions... maybe your cross machine way will sound good again ;) Theres SOA/EJB as well... ;) Have fun... --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: How do you have your dev environment setup?
You could use ant to automate it. I've tried deploying from eclipse to tomcat briefly. It seemed alright as well. Don't know too much about the quirks since I delopy to JBoss primarily. -Original Message- From: Bai Shen Sent: 17/09/2008 05:59:08 To: Tomcat Users List Subject: How do you have your dev environment setup? I've been doing a lot of webapp development on tomcat, but currently my process is all manual. I write the code in Eclipse, and then copy the appropriate files over to tomcat. I'd like to automate and standardize my process. So would y'all mind explaining how your dev environment is configured? I'd appreciate the insight. TIA. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: add memory
From: Alex Mestiashvili [mailto:[EMAIL PROTECTED] Subject: Re: add memory export JAVA_OPTS= -XX:MaxPermSize=256m -Xmx12000m Do you really have enough RAM on your server to make a 12 GB heap viable? - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Non-Heap Memory always increasing during deployment for TC 5.5.26/Solaris/JVM 1.5.0_16
From: Brian Clark [mailto:[EMAIL PROTECTED] Subject: Re: Non-Heap Memory always increasing during deployment for TC 5.5.26/Solaris/JVM 1.5.0_16 I think you need to add one more line to your CATALINA_OPTS statement: -Dcom.sun.management.jmxremote=true The above is not necessary. Any declaration of a system property beginning with com.sun.management.jmxremote enables remote JMX access, including specification of a port; the =true is just noise. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Non-Heap Memory always increasing during deployment for TC 5.5.26/Solaris/JVM 1.5.0_16
From: emerson cargnin [mailto:[EMAIL PROTECTED] Subject: Non-Heap Memory always increasing during deployment for TC 5.5.26/Solaris/JVM 1.5.0_16 Every time I hot-deploy an application, the non-heap memory goes up. Some component in your environment is hanging onto object or class references when it shouldn't. Placing logging libraries in a common location rather than with each webapp is a common - but certainly not only - cause. Read the FAQ again: http://wiki.apache.org/tomcat/FAQ/Memory#Q2 In particular, the FAQ links to this article: http://opensource.atlassian.com/confluence/spring/pages/viewpage.action?pageId=2669 - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]