[Tomcat Wiki] Update of "FAQ/Logging" by ChristopherSchultz
Dear Wiki user, You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change notification. The "FAQ/Logging" page has been changed by ChristopherSchultz: https://wiki.apache.org/tomcat/FAQ/Logging?action=diff=25=26 Comment: Fix name/link for cronolog. 1. If you are using jsvc 1.0.4 or later (from [[http://commons.apache.org/daemon/|Apache Commons Daemon]] project) to launch Tomcat, you can send SIGUSR1 signal to jsvc to get it to re-open its log files ([[https://issues.apache.org/jira/browse/DAEMON-95|Jira Ticket]]). You can couple this with 'logrotate' or your favorite log-rotation utility (including good-old 'mv') to re-name catalina.out at intervals and then get jsvc to re-open the original (catalina.out) file and continue writing to it. 1. Use 'logrotate' with the 'copytruncate' option. This allows you to externally rotate catalina.out without changing anything within Tomcat. - 1. Modify bin/catalina.sh (or bin/catalina.bat) to pipe output from the JVM into a piped-logger such as [[http://www.cronolog.org/|chronolog]] or Apache httpd's [[http://httpd.apache.org/docs/2.2/logs.html#piped|rotatelogs]] (note that the previous reference is for Apache httpd documentation and *is not applicable to Tomcat* -- it merely illustrates the concept).<>See also the patch in [[https://bz.apache.org/bugzilla/show_bug.cgi?id=53930|Bug 53930, "Allow capture of catalina stdout/stderr to a command instead of just a file"]]. + 1. Modify bin/catalina.sh (or bin/catalina.bat) to pipe output from the JVM into a piped-logger such as [[http://linux.die.net/man/1/cronolog|cronolog]] or Apache httpd's [[http://httpd.apache.org/docs/2.2/logs.html#piped|rotatelogs]] (note that the previous reference is for Apache httpd documentation and *is not applicable to Tomcat* -- it merely illustrates the concept).<>See also the patch in [[https://bz.apache.org/bugzilla/show_bug.cgi?id=53930|Bug 53930, "Allow capture of catalina stdout/stderr to a command instead of just a file"]]. References to mailing list discussions: * [[http://marc.info/?t=10554447261=1=2a|tomcat-users thread from 2003]] - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 60099] New: StatementCache does not check the scrollable type of result set when searching for a cached statement
https://bz.apache.org/bugzilla/show_bug.cgi?id=60099 Bug ID: 60099 Summary: StatementCache does not check the scrollable type of result set when searching for a cached statement Product: Tomcat Modules Version: unspecified Hardware: PC Status: NEW Severity: major Priority: P2 Component: jdbc-pool Assignee: dev@tomcat.apache.org Reporter: mabba...@gmail.com Created attachment 34224 --> https://bz.apache.org/bugzilla/attachment.cgi?id=34224=edit Test class When the StatementCache is searching for a matching PreparedStatement, the matching criteria do not take into account the scrollable type of result set, but only the sql query. If we create a PreparedStatement with a FORWARD_ONLY result set type, and then we try to create another PreparedStatement with a SCROLL_INSENSITIVE type with the same query, then the cache will return the PreparedStatement created first(a FORWARD_ONLY statement), and any attempt to call the absolute method will throw a java.sql.SQLException: The 'absolute()' method is only allowed on scroll cursors. Please find attached a Test Class that can help to reproduce the problem. To run this class you need to add derby-10.11, tomcat-jdbc-8.0.37 and tomcat-juli-8.0.37 to classpath. I am using jdk1.8.0_92 to compile and execute this test. P.S. The error only appears when creating a PreparedStatement instead of a Statement (by calling createStatement()). Please tell me, if you need more informations. Thanks for your help! Full StackTrace: Exception in thread "main" java.sql.SQLException: The 'absolute()' method is only allowed on scroll cursors. at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source) at org.apache.derby.impl.jdbc.EmbedResultSet.checkScrollCursor(Unknown Source) at org.apache.derby.impl.jdbc.EmbedResultSet.absolute(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.apache.tomcat.jdbc.pool.interceptor.StatementDecoratorInterceptor$ResultSetProxy.invoke(StatementDecoratorInterceptor.java:307) at com.sun.proxy.$Proxy4.absolute(Unknown Source) at test.Test.testWithInsensitiveResultSet(Test.java:75) at test.Test.main(Test.java:18) Caused by: ERROR XJ061: The 'absolute()' method is only allowed on scroll cursors. at org.apache.derby.iapi.error.StandardException.newException(Unknown Source) at org.apache.derby.impl.jdbc.SQLExceptionFactory.wrapArgsForTransportAcrossDRDA(Unknown Source) ... 14 more -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
Re: [VOTE] Release Apache Tomcat 7.0.71
2016-09-07 14:00 GMT+03:00 Violeta Georgieva: > > The proposed Apache Tomcat 7.0.71 release is now available for voting. > > It can be obtained from: > https://dist.apache.org/repos/dist/dev/tomcat/tomcat-7/v7.0.71/ > The Maven staging repo is: > https://repository.apache.org/content/repositories/orgapachetomcat-1094/ > The svn tag is: > http://svn.apache.org/repos/asf/tomcat/tc7.0.x/tags/TOMCAT_7_0_71/ > > The proposed 7.0.71 release is: > [ ] Broken - do not release > [X] Stable - go ahead and release as 7.0.71 Stable +1 my tests passed > Regards, > Violeta
[Bug 60013] Non-ASCII characters in querystring get mangled after URL Rewrite using RewriteValve
https://bz.apache.org/bugzilla/show_bug.cgi?id=60013 --- Comment #28 from Santhana Preethi--- I think the rewritten URL should be encoded(similar to mod_rewrite approach). In the fix provided in 8.0.37 release, the request-uri and querystring are encoded after rewrite. Handling redirect in a similar fashion will solve this problem. Please update any progress in the RewriteValve. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot success in on tomcat-trunk
The Buildbot has detected a restored build on builder tomcat-trunk while building . Full details are available at: https://ci.apache.org/builders/tomcat-trunk/builds/1669 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: silvanus_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' triggered this build Build Source Stamp: [branch tomcat/trunk] 1759790 Blamelist: violetagg Build succeeded! Sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1759790 - in /tomcat/trunk/java/org/apache/catalina/connector: CoyoteInputStream.java InputBuffer.java
Author: violetagg Date: Thu Sep 8 12:01:44 2016 New Revision: 1759790 URL: http://svn.apache.org/viewvc?rev=1759790=rev Log: Fix javadoc Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java?rev=1759790=1759789=1759790=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Thu Sep 8 12:01:44 2016 @@ -191,7 +191,7 @@ public class CoyoteInputStream extends S * before the operation, the limit will be the position incremented by * the number of the transfered bytes. * - * @param to the ByteBuffer into which bytes are to be written. + * @param b the ByteBuffer into which bytes are to be written. * @return an integer specifying the actual number of bytes read, or -1 if * the end of the stream is reached * @throws IOException if an input or output exception has occurred Modified: tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java?rev=1759790=1759789=1759790=diff == --- tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Thu Sep 8 12:01:44 2016 @@ -344,7 +344,7 @@ public class InputBuffer extends Reader * before the operation, the limit will be the position incremented by * the number of the transfered bytes. * - * @param to the ByteBuffer into which bytes are to be written. + * @param b the ByteBuffer into which bytes are to be written. * @return an integer specifying the actual number of bytes read, or -1 if * the end of the stream is reached * @throws IOException if an input or output exception has occurred - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot failure in on tomcat-trunk
The Buildbot has detected a new failure on builder tomcat-trunk while building . Full details are available at: https://ci.apache.org/builders/tomcat-trunk/builds/1668 Buildbot URL: https://ci.apache.org/ Buildslave for this Build: silvanus_ubuntu Build Reason: The AnyBranchScheduler scheduler named 'on-tomcat-commit' triggered this build Build Source Stamp: [branch tomcat/trunk] 1759785 Blamelist: violetagg BUILD FAILED: failed compile Sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1759785 - in /tomcat/trunk: java/org/apache/catalina/connector/ java/org/apache/tomcat/util/buf/ test/org/apache/catalina/connector/
Author: violetagg Date: Thu Sep 8 11:43:32 2016 New Revision: 1759785 URL: http://svn.apache.org/viewvc?rev=1759785=rev Log: Introduce a new method CoyoteInputStream.read(ByteBuffer). Added: tomcat/trunk/test/org/apache/catalina/connector/TestCoyoteInputStream.java (with props) Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java?rev=1759785=1759784=1759785=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Thu Sep 8 11:43:32 2016 @@ -17,6 +17,7 @@ package org.apache.catalina.connector; import java.io.IOException; +import java.nio.ByteBuffer; import java.security.AccessController; import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; @@ -183,6 +184,47 @@ public class CoyoteInputStream extends S } } + +/** + * Transfers bytes from the buffer to the specified ByteBuffer. After the + * operation the position of the ByteBuffer will be returned to the one + * before the operation, the limit will be the position incremented by + * the number of the transfered bytes. + * + * @param to the ByteBuffer into which bytes are to be written. + * @return an integer specifying the actual number of bytes read, or -1 if + * the end of the stream is reached + * @throws IOException if an input or output exception has occurred + */ +public int read(final ByteBuffer b) throws IOException { +checkNonBlockingRead(); + +if (SecurityUtil.isPackageProtectionEnabled()) { +try { +Integer result = AccessController +.doPrivileged(new PrivilegedExceptionAction() { + +@Override +public Integer run() throws IOException { +Integer integer = Integer.valueOf(ib.read(b)); +return integer; +} + +}); +return result.intValue(); +} catch (PrivilegedActionException pae) { +Exception e = pae.getException(); +if (e instanceof IOException) { +throw (IOException) e; +} else { +throw new RuntimeException(e.getMessage(), e); +} +} +} else { +return ib.read(b); +} +} + @Override public int readLine(byte[] b, int off, int len) throws IOException { Modified: tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java?rev=1759785=1759784=1759785=diff == --- tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Thu Sep 8 11:43:32 2016 @@ -18,6 +18,7 @@ package org.apache.catalina.connector; import java.io.IOException; import java.io.Reader; +import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.security.AccessController; import java.security.PrivilegedActionException; @@ -337,6 +338,26 @@ public class InputBuffer extends Reader } +/** + * Transfers bytes from the buffer to the specified ByteBuffer. After the + * operation the position of the ByteBuffer will be returned to the one + * before the operation, the limit will be the position incremented by + * the number of the transfered bytes. + * + * @param to the ByteBuffer into which bytes are to be written. + * @return an integer specifying the actual number of bytes read, or -1 if + * the end of the stream is reached + * @throws IOException if an input or output exception has occurred + */ +public int read(ByteBuffer b) throws IOException { +if (closed) { +throw new IOException(sm.getString("inputBuffer.streamClosed")); +} + +return bb.substract(b); +} + + // - Chars Handling Methods Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/ByteChunk.java?rev=1759785=1759784=1759785=diff == ---
svn commit: r1759757 - in /tomcat/trunk/java/org/apache/catalina/connector: CoyoteInputStream.java InputBuffer.java
Author: violetagg Date: Thu Sep 8 08:23:13 2016 New Revision: 1759757 URL: http://svn.apache.org/viewvc?rev=1759757=rev Log: Format the code. No functional changes. Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java tomcat/trunk/java/org/apache/catalina/connector/InputBuffer.java Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java?rev=1759757=1759756=1759757=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteInputStream.java Thu Sep 8 08:23:13 2016 @@ -66,25 +66,24 @@ public class CoyoteInputStream extends S public int read() throws IOException { checkNonBlockingRead(); -if (SecurityUtil.isPackageProtectionEnabled()){ +if (SecurityUtil.isPackageProtectionEnabled()) { -try{ -Integer result = -AccessController.doPrivileged( -new PrivilegedExceptionAction(){ +try { +Integer result = AccessController +.doPrivileged(new PrivilegedExceptionAction() { @Override -public Integer run() throws IOException{ +public Integer run() throws IOException { Integer integer = Integer.valueOf(ib.readByte()); return integer; } -}); +}); return result.intValue(); -} catch(PrivilegedActionException pae){ +} catch (PrivilegedActionException pae) { Exception e = pae.getException(); -if (e instanceof IOException){ -throw (IOException)e; +if (e instanceof IOException) { +throw (IOException) e; } else { throw new RuntimeException(e.getMessage(), e); } @@ -97,30 +96,29 @@ public class CoyoteInputStream extends S @Override public int available() throws IOException { -if (SecurityUtil.isPackageProtectionEnabled()){ -try{ -Integer result = -AccessController.doPrivileged( -new PrivilegedExceptionAction(){ +if (SecurityUtil.isPackageProtectionEnabled()) { +try { +Integer result = AccessController +.doPrivileged(new PrivilegedExceptionAction() { @Override -public Integer run() throws IOException{ +public Integer run() throws IOException { Integer integer = Integer.valueOf(ib.available()); return integer; } -}); +}); return result.intValue(); -} catch(PrivilegedActionException pae){ +} catch (PrivilegedActionException pae) { Exception e = pae.getException(); -if (e instanceof IOException){ -throw (IOException)e; +if (e instanceof IOException) { +throw (IOException) e; } else { throw new RuntimeException(e.getMessage(), e); } } } else { - return ib.available(); +return ib.available(); } } @@ -128,59 +126,54 @@ public class CoyoteInputStream extends S public int read(final byte[] b) throws IOException { checkNonBlockingRead(); -if (SecurityUtil.isPackageProtectionEnabled()){ -try{ -Integer result = -AccessController.doPrivileged( -new PrivilegedExceptionAction(){ +if (SecurityUtil.isPackageProtectionEnabled()) { +try { +Integer result = AccessController +.doPrivileged(new PrivilegedExceptionAction() { @Override -public Integer run() throws IOException{ -Integer integer = -Integer.valueOf(ib.read(b, 0, b.length)); +public Integer run() throws IOException { +Integer integer = Integer.valueOf(ib.read(b, 0, b.length)); return integer; } -}); +}); return result.intValue();