trimSpaces

2010-01-19 Thread Kevin Jackson
Hi,

https://issues.apache.org/bugzilla/show_bug.cgi?id=45931

This fix would be very beneficial for us, although I'm aware that the
addition of this would make an application deployed in tomcat emit
different output than an app deployed on say jetty.

I'm willing to merge this with the trunk (for tomcat7) if people's
time is a factor and to test it.

Thanks,
Kev

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



tomcat-jdbc pool interceptor

2009-12-02 Thread Kevin Jackson
Hi,

We have a situation with a clustered SQL Server database and tomcat-jdbc.

When the cluster fails over and the active node switches to the
passive node, all the open connections in the tomcat-jdbc pool become
invalid, but SQL Server doesn't report this and the connection remains
'ESTABLISHED' [see http://support.microsoft.com/kb/273673/]

The stack trace we commonly see is:

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor52.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at 
org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:78)
... 43 more
Caused by: java.sql.SQLException: Invalid state, the Connection object
is closed.
at 
net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1634)
at 
net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDBC2.java:2328)
... 47 more

Currently we have set the following params:
removeAbandoned=true
logAbandoned=true
maxActive=100
maxIdle=30
minIdle=20
initialSize=20
maxWait=1
validationQuery=SELECT count(1) from xyz

Although it's traditional to simply use 'select 1' as the
validationQuery for SQL Server, we want to ensure that the query isn't
actually optimized out at some point in the driver.

To avoid the problem with failovers, I think we have a couple of options:
#1 add the following config:
testWhileIdle=true
timeBetweenEvictionRunsMillis=3
This should evict any stale connections every 5 mins (if the idleness
test is valid and it appears to be so having read the src for
PooledConnection and ConnectionPool)

#2 write a very simple JdbcInterceptor which checks the connection on reset:
package org.apache.tomcat.jdbc.pool.interceptor;

import java.sql.Statement;

import org.apache.tomcat.jdbc.pool.ConnectionPool;
import org.apache.tomcat.jdbc.pool.JdbcInterceptor;
import org.apache.tomcat.jdbc.pool.PoolConfiguration;
import org.apache.tomcat.jdbc.pool.PooledConnection;

/**
 * If the underlying database has failed over (in active-passive configuration)
 * the connections need to be closed
 * @author k...@apache.org
 */
public class FailoverHandler extends JdbcInterceptor {

@Override
public void reset(ConnectionPool parent, PooledConnection con) {
if(null == parent || null == con) return; //nothing to do
PoolConfiguration config = parent.getPoolProperties();
Statement stmt = null;
try {
stmt = con.getConnection().createStatement();
stmt.execute(config.getValidationQuery());
stmt.close();
} catch (Exception e) {
//on any exception, assume that the connection is stale
//and completely remove it from pool, also force a 
check of all
idle connections
con.release();
parent.testAllIdle();
}

}
}

With this approach we are trading a significant amount of performance
for some reliability of the connection not being stale.  I'm happy
with this trade-off if the interceptor is correct (I know it's not
bomb-proof as I really should have null guards around everything)

Would anyone who has knowledge of this particular code-base be able to
tell me if release() + testAllIdle() will give me the kind of
guarantee I'm after or if the configuration of testWhileIdle +
timeBetweenEvictionRunsMillis is just as valid?

Thanks,
Kev

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



tomcat-jdbc issue

2008-12-15 Thread Kevin Jackson
Hi,

I'm using the new tomcat-jdbc connection pool with tomcat-6.0.18 on
windows server 2003 and SQL Server 2000 with the jtds driver

Sometimes when the db server is under heavy load, the following
exception is thrown:

root cause

java.lang.reflect.InvocationTargetException
sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:78)
$Proxy1.prepareStatement(Unknown Source)

This seems to be intermittent and I think it may be related to the
load on the db server (which we have problems with all the time).

Given that this is using reflection, I know it won't be as easy to add
logging etc to determine the cause, but is there a suggested tweak to
either this class or another class in the package that could aid in
confirming my suspicions that this is related to db load/network
timeouts etc.

Apart from this issue, this pool is as good as commons-dbcp and is a
great drop-in replacement

Thanks,
Kev

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: tomcat-jdbc issue

2008-12-15 Thread Kevin Jackson
Hi Filip,

 Are you sure that is all you see in your logs. We try to not swallow any
 error, and there should be more information.

Yes you were correct,

root cause

java.sql.SQLException: Invalid state, the Connection object is closed.
net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1634)
net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDBC2.java:2328)
sun.reflect.GeneratedMethodAccessor91.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:585)
org.apache.tomcat.jdbc.pool.ProxyConnection.invoke(ProxyConnection.java:78)
$Proxy1.prepareStatement(Unknown Source)
com.thehut.tabernus.service.SiteService.postPopulateBean(SiteService.java:75)

So it seems that the connection has been closed before the method is invoked

Kev

-
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org



Re: [VOTE/SENSUS] connection pool

2008-10-22 Thread Kevin Jackson
Hi,
 c. [X ] Bring it here, we'll make it an independent module with its own
 release cycle

As an interested observer with no karma here :)

Kev

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Webdav servlet

2007-10-28 Thread Kevin Jackson
Hi,

I need to extend the webdav servlet so that I can store files outside
of the application context.

Looking at the source for the servlet I think getRelativePath and
(perhaps normalize) need to be changed.

Does anyone who has more knowledge of the src know exactly how I'd achieve this?

Thanks,
Kev

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



JSP pre-compilation problem

2007-06-21 Thread Kevin Jackson

Hi all,

I'm working with mvn and the jetty jspc plugin for pre-compiling jsps
and I've come across this error:

[INFO] [jetty-jspc:jspc {execution: jspc}]
2007-06-21 11:15:18.969::INFO:  Logging to STDERR via org.mortbay.log.StdErrLog
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to
[Lorg.apache.jasper.compiler.JavacErrorDetail;
   at 
org.apache.jasper.compiler.JDTJavaCompiler.compile(JDTJavaCompiler.java:466)
   at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:317)
   at org.apache.jasper.compiler.Compiler.compile(Compiler.java:364)
   at org.apache.jasper.JspC.processFile(JspC.java:1137)
   at org.apache.jasper.JspC.execute(JspC.java:1306)
   at org.mortbay.jetty.jspc.plugin.JspcMojo.compile(JspcMojo.java:284)
   at org.mortbay.jetty.jspc.plugin.JspcMojo.execute(JspcMojo.java:213)

I've looked online (and to be honest I cannot find the JDTJavaCompiler
src, but I did find the JDTCompiler src @
http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/java/org/apache/jasper/compiler/JDTCompiler.java)
which had the following:

if (!problemList.isEmpty()) {
   JavacErrorDetail[] jeds =
   (JavacErrorDetail[]) problemList.toArray(new
JavacErrorDetail[0]);
   errDispatcher.javacError(jeds);
   }


From my limited knowledge of the codebase, this looks like a likely

candidate for the cause of the error message I'm seeing.  I'm going to
swap the jspc plugin to (a slightly modified version of) the standard
mvn jspc plugin to see if the same error occurs.

I also checked the tomcat bugzilla and didn't find anything that looked similar.

env info:
-tomcat version 6.0.13
-mvn version 2.0.7
-jetty jspc plugin version 6.1.0
-jdk6

Thanks,
Kev

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [TC6] Minimum coding style

2006-12-04 Thread Kevin Jackson


AS FOR STYLE, I THINK ALL UNNECESSARY
WHITESPACE SHOULD BE BANNED AND TABS
MADE ILLEGAL, THEY JUST INCREASE
FILE SIZE TOO MUCH AND MY COMMODORE
64 JUST CAN'T HANDLE SOME OF THOSE
LARGE SOURCE FILES ALL IN ONE GO.

PLEASE WRITE YOUR JAVA LIKE THIS:

public class Foobar{private String
NAME;public void Foobar(){}public
String getName(){return this.NAME;
public void setName(String NAME){
this.NAME=NAME;}


Although meant in jest, I'm stuck on a relatively slow link and
anything that reduces the amount of needless code downloaded the
better in my opinion.  I know most people have uber-fast DSL
connections etc, but many people in the developing world don't, and
having 400K of extraneous whitespace that must be downloaded to check
out the source to a project is annoying :)

I have no problem with whitespace that is used to make code readable,
I do have a problem with needless newlines tacked on the end of every
single damn source file, and trailing spaces at the end of every if ()
{ block because it was cut'n'pasted from somewhere.

Anyway
my 2c
Kev

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Quick question - JSP2.1/Servlet2.5 support in tomcat?

2006-09-29 Thread Kevin Jackson

Hi all,

Sorry to just drop in with this question, but I couldn't find anything
related @ MARC so I thought the dev list would be the place to ask

What is the current status of tomcat with respect to JSP2.1 spec
(specifically the unified expression language feature)?

Also any area of the code a n00b could get involved in/help out with?

Kev
([EMAIL PROTECTED] - yeah I'm a n00b here, but I'm involved in other
apache stuff, so don't worry about the contributor license requirement
;) )

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]