DO NOT REPLY [Bug 49234] JMX Descriptor Modifications

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=49234

--- Comment #6 from chamith buddhika chamibuddh...@gmail.com 2010-05-06 
04:25:25 EDT ---
Created an attachment (id=25405)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25405)
o.a.Catalina.Core Descriptor Attributes

Package: org.apache.Catalina.Core

This patch deals with attributes of above package descriptor. Changes are
mainly

 1. Addition of missing attributes
 2. Ordering of attributes according to their alphabetical order

Required changes (if any) to descriptor operations will be attached in a
separate patch.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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: org.apache.catalina JMX descriptor modification

2010-05-06 Thread Mark Thomas

On 06/05/2010 03:45, buddhika chamith wrote:

Hi All,

Please refer to https://issues.apache.org/bugzilla/show_bug.cgi?id=49234 for
a longer description about the descriptor issue in above package. The main
issue is the descriptor for Connector MBean tries to describe different
connectors with same set of attributes. So some attributes in the descriptor
doesn't make sense in one connector or the other (Http and Ajp). Connector
differences arise from attributes of ProtocolHandler class associated with
the connector and not the connector class it self.

Currently there are seperate MBeans describing different protocol handler
attributes as well. This is in addition to some of their attributes being
partially exposed via associated Connector MBean. As far as I understood
following are the possibilities for improvements.

1. Remove descriptions of ProtocolHandler attributes from Connector MBeans
since they are described in related ProtocolHandler MBeans as well. We can
have a attribute reference to the ProtocolHandler objectname in the
Connector MBean to associate ProtocolHandler to the Connector so that they
can be retrieved by going through Connnector.

2. Extract out common attributes in both ProtocolHandlers and include them
in Connector MBean attributes. This way it can expose some ProtocolHandler
attributes directly while refering to the associated ProtocolHandler MBean
for other attributes.


There are currently 5 different ProtocolHandlers in trunk:
org.apache.coyote.http11.Http11Protocol
org.apache.coyote.http11.Http11NioProtocol
org.apache.coyote.http11.Http11AprProtocol
org.apache.coyote.ajp.AjpProtocol
org.apache.coyote.ajp.AjpAprProtocol

I think I am leaning towards option 2. Have the Connector attributes in 
the connector MBean along with any common ProtocolHandler attributes and 
have separate ProtocolHandler MBeans that have all the attributes for 
the ProtocolHandler. The common attributes would then be accessible via 
the Connector MBean and the ProtocolHandler MBean.


It would be worth adding some comments to the MBean descriptors so folks 
who come along later can figure out what is meant to be where.


Mark

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



svn commit: r941684 - /tomcat/trunk/java/org/apache/catalina/mbeans-descriptors.xml

2010-05-06 Thread markt
Author: markt
Date: Thu May  6 11:57:14 2010
New Revision: 941684

URL: http://svn.apache.org/viewvc?rev=941684view=rev
Log:
GSoC 2010: Make some JMX attributes read-only
Based on a patch provided by Chamith Buddhika

Modified:
tomcat/trunk/java/org/apache/catalina/mbeans-descriptors.xml

Modified: tomcat/trunk/java/org/apache/catalina/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/mbeans-descriptors.xml?rev=941684r1=941683r2=941684view=diff
==
--- tomcat/trunk/java/org/apache/catalina/mbeans-descriptors.xml (original)
+++ tomcat/trunk/java/org/apache/catalina/mbeans-descriptors.xml Thu May  6 
11:57:14 2010
@@ -81,7 +81,8 @@
 
 attribute   name=rolename
   description=Role name of this role
- type=java.lang.String/
+ type=java.lang.String
+writeable=false/
 
   /mbean
 
@@ -98,7 +99,8 @@
 
 attribute   name=groups
   description=MBean Names of groups this user is a member of
- type=[Ljava.lang.String;/
+ type=[Ljava.lang.String;
+writeable=false/
 
 attribute   name=password
   description=Password of this user



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



DO NOT REPLY [Bug 49234] JMX Descriptor Modifications

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=49234

--- Comment #7 from Mark Thomas ma...@apache.org 2010-05-06 07:58:47 EDT ---
(In reply to comment #5)
 Created an attachment (id=25404)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25404) [details]
 o.a.Catalina-Final-patch

There are still a lot of unnecessary white-space changes in that patch. I have
applied the patch, less the whitespace changes.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



svn commit: r941686 - /tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml

2010-05-06 Thread markt
Author: markt
Date: Thu May  6 12:07:20 2010
New Revision: 941686

URL: http://svn.apache.org/viewvc?rev=941686view=rev
Log:
GSoC 2010: Add missing attributes, use alphabetical ordering
Patch provided by Chamith Buddhika

Modified:
tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml?rev=941686r1=941685r2=941686view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml Thu May  
6 12:07:20 2010
@@ -50,7 +50,12 @@
description=Fully qualified class name of the managed object
type=java.lang.String
writeable=false/
-  
+
+attribute name=name
+   description=Name of the associated naming context
+   type=java.lang.String
+   writeable=false/ 
+   
   /mbean
 
   mbean name=StandardContext
@@ -64,13 +69,13 @@
is=true
type=boolean/
   
-attribute name=instanceManager
-description=Object that creates and destroys servlets, 
filters, and listeners. Include dependency injection and 
postConstruct/preDestory handling
-type=org.apache.catalina.instanceManagement.InstanceManager 
/
-
 attribute name=aliases
description=List of resource aliases
type=java.lang.String /
+  
+attribute name=altDDName
+   description=The alternate deployment descriptor name.
+   type=java.lang.String / 
 
 attribute name=antiJARLocking
description=Take care to not lock jar files
@@ -101,10 +106,29 @@
description=Object names of all children
type=[Ljavax.management.ObjectName;/

-attribute name=configFile
+attribute name=clearReferenceStatic
+   description=Should Tomcat attempt to null out any static or 
final fields from loaded classes when a web application is stopped as a work 
around 
+   for apparent garbage collection 
bugs and application coding errors?
+   type=boolean/
+   
+attribute name=clearReferenceStopThreads
+   description=Should Tomcat attempt to terminate threads that 
have been started by the web application? Advisable to be used only in a 
development
+   environment.
+   type=boolean/
+   
+attribute name=clearReferenceStopThreadLocals
+   description=Should Tomcat attempt to clear any ThreadLocal 
objects that are instances of classes loaded by this class loader. 
+   type=boolean/
+   
+attribute name=configFilePath
description=Location of the context.xml resource or file
type=java.lang.String/

+attribute name=configured
+   description=The correctly configured flag for this Context.
+   type=boolean
+  writeable=false /
+   
 attribute   name=cookies
description=Should we attempt to use cookies for session id
communication?
@@ -132,11 +156,25 @@

 attribute name=deploymentDescriptor
description=String deployment descriptor 
+   type=java.lang.String
+  writeable=false /
+  
+attribute name=displayName
+   description=The display name of this web application
+   type=java.lang.String/
+   
+attribute name=distributable
+   description=The distributable flag for this web application.
type=java.lang.String/
  
 attribute name=docBase
description=The document root for this web application
type=java.lang.String/
+   
+attribute name=encodedPath
+   description=The encoded path
+   type=java.lang.String
+  writeable=false /
   
 attribute name=engineName
description=Name of the engine domain, if different from the 
context domain
@@ -145,7 +183,21 @@
 attribute name=eventProvider
description=Event provider support for this managed object
is=true
-   type=boolean/
+   type=boolean
+  writeable=false /
+  
+attribute name=hostName
+   description=The host name.
+   type=java.lang.String
+  writeable=false /
+  
+attribute name=ignoreAnnotations
+   description=Ignore annotations flag.
+   

svn commit: r941687 - /tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml

2010-05-06 Thread markt
Author: markt
Date: Thu May  6 12:13:20 2010
New Revision: 941687

URL: http://svn.apache.org/viewvc?rev=941687view=rev
Log:
Descriptions need to be on a single line
Fix attribute alignment so file is consistent

Modified:
tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml

Modified: tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml?rev=941687r1=941686r2=941687view=diff
==
--- tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml (original)
+++ tomcat/trunk/java/org/apache/catalina/core/mbeans-descriptors.xml Thu May  
6 12:13:20 2010
@@ -107,13 +107,11 @@
type=[Ljavax.management.ObjectName;/

 attribute name=clearReferenceStatic
-   description=Should Tomcat attempt to null out any static or 
final fields from loaded classes when a web application is stopped as a work 
around 
-   for apparent garbage collection 
bugs and application coding errors?
+   description=Should Tomcat attempt to null out any static or 
final fields from loaded classes when a web application is stopped as a work 
around for apparent garbage collection bugs and application coding errors?
type=boolean/

 attribute name=clearReferenceStopThreads
-   description=Should Tomcat attempt to terminate threads that 
have been started by the web application? Advisable to be used only in a 
development
-   environment.
+   description=Should Tomcat attempt to terminate threads that 
have been started by the web application? Advisable to be used only in a 
development environment.
type=boolean/

 attribute name=clearReferenceStopThreadLocals
@@ -127,11 +125,10 @@
 attribute name=configured
description=The correctly configured flag for this Context.
type=boolean
-  writeable=false /
+   writeable=false /

-attribute   name=cookies
-   description=Should we attempt to use cookies for session id
-   communication?
+attribute name=cookies
+   description=Should we attempt to use cookies for session id 
communication?
type=boolean/
   
 attribute name=compilerClasspath
@@ -157,7 +154,7 @@
 attribute name=deploymentDescriptor
description=String deployment descriptor 
type=java.lang.String
-  writeable=false /
+   writeable=false /
   
 attribute name=displayName
description=The display name of this web application
@@ -174,7 +171,7 @@
 attribute name=encodedPath
description=The encoded path
type=java.lang.String
-  writeable=false /
+   writeable=false /
   
 attribute name=engineName
description=Name of the engine domain, if different from the 
context domain
@@ -184,20 +181,20 @@
description=Event provider support for this managed object
is=true
type=boolean
-  writeable=false /
+   writeable=false /
   
 attribute name=hostName
description=The host name.
type=java.lang.String
-  writeable=false /
+   writeable=false /
   
 attribute name=ignoreAnnotations
description=Ignore annotations flag.
type=boolean /

 attribute name=instanceManager
-description=Object that creates and destroys servlets, 
filters, and listeners. Include dependency injection and 
postConstruct/preDestory handling
-type=org.apache.catalina.instanceManagement.InstanceManager 
/
+   description=Object that creates and destroys servlets, 
filters, and listeners. Include dependency injection and 
postConstruct/preDestory handling
+   type=org.apache.catalina.instanceManagement.InstanceManager /
   
 attribute name=javaVMs
description=The Java virtual machines on which this module is 
running
@@ -234,7 +231,7 @@
 attribute name=objectName
description=Name of the object
type=java.lang.String
-  writeable=false /
+   writeable=false /
   
 attribute name=originalDocBase
description=The original document root for this web 
application
@@ -255,7 +252,7 @@
 attribute name=paused
description=The request processing pause flag (while reloading 
occurs)
type=boolean
-  writeable=false /
+   

DO NOT REPLY [Bug 49234] JMX Descriptor Modifications

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=49234

--- Comment #8 from Mark Thomas ma...@apache.org 2010-05-06 08:14:47 EDT ---
(In reply to comment #6)
 Created an attachment (id=25405)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25405) [details]
 o.a.Catalina.Core Descriptor Attributes

Patch applied. Many thanks.

For future reference:
- The description needs to be on a single line. Line breaks look odd in
JConsole.
- Try and keep the alignment consistent throughout the file

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



svn commit: r941722 - /tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java

2010-05-06 Thread jfclere
Author: jfclere
Date: Thu May  6 13:44:15 2010
New Revision: 941722

URL: http://svn.apache.org/viewvc?rev=941722view=rev
Log:
make sure the entropy can be converted to a String.

Modified:
tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java

Modified: tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java?rev=941722r1=941721r2=941722view=diff
==
--- tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java (original)
+++ tomcat/trunk/java/org/apache/catalina/session/ManagerBase.java Thu May  6 
13:44:15 2010
@@ -47,6 +47,7 @@ import org.apache.catalina.Manager;
 import org.apache.catalina.Session;
 import org.apache.catalina.mbeans.MBeanUtils;
 import org.apache.catalina.util.LifecycleMBeanBase;
+import org.apache.catalina.util.Base64;
 import org.apache.tomcat.util.ExceptionUtils;
 import org.apache.tomcat.util.res.StringManager;
 import org.apache.juli.logging.Log;
@@ -399,7 +400,7 @@ public abstract class ManagerBase extend
 ExceptionUtils.handleThrowable(t);
 }
 if (apr) {
-setEntropy(new String(result));
+setEntropy(new String(Base64.encode(result)));
 } else {
 setEntropy(this.toString());
 }



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



DO NOT REPLY [Bug 48903] ClassLoader deadlock when compiling JSP pages in 6.0.26

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48903

--- Comment #9 from aullr...@blackducksoftware.com 2010-05-06 14:37:06 EDT ---
We are running hudson 1.356, java.exe from jdk1.6.0_14 and tomcat 6.0.26 and
get deadlocks
Excerpts below - going to attach full log.

Found one Java-level deadlock:
=
Handling GET /job/Project1Trunk/ : http-8080-40:
  waiting to lock monitor 0x5b013e50 (object 0x2aaac2cc9b58, a
java.net.URLClassLoader),
  which is held by Handling GET /job/Project2Trunk/disk-usage/graph :
http-8080-22
Handling GET /job/Project2Trunk/disk-usage/graph : http-8080-22:
  waiting to lock monitor 0x5b986958 (object 0x2aaab4465798, a
java.lang.String),
  which is held by Handling GET /job/Project2Trunk/emma/graph : http-8080-14
Handling GET /job/Project2Trunk/emma/graph : http-8080-14:
  waiting to lock monitor 0x5b0169a0 (object 0x2aaac266fc30, a
org.apache.catalina.loader.WebappClassLoader),
  which is held by Handling GET /job/Project2Trunk/test/trend : http-8080-15
Handling GET /job/Project2Trunk/test/trend : http-8080-15:
  waiting to lock monitor 0x5b986958 (object 0x2aaab4465798, a
java.lang.String),
  which is held by Handling GET /job/Project2Trunk/emma/graph : http-8080-14

Java stack information for the threads listed above:
===
Handling GET /job/Project1Trunk/ : http-8080-40:
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
at
sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
...

Handling GET /job/Project2Trunk/disk-usage/graph : http-8080-22:
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1394)
- waiting to lock 0x2aaab4465798 (a java.lang.String)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
- locked 0x2aaac2c3ed48 (a
hudson.ClassicPluginStrategy$DependencyClassLoader)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
- locked 0x2aaac2cc9b58 (a java.net.URLClassLoader)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
- locked 0x2aaac2cc9b58 (a java.net.URLClassLoader)
at
hudson.plugins.disk_usage.ProjectDiskUsageAction.doGraph(ProjectDiskUsageAction.java:106)
...

Handling GET /job/Project2Trunk/emma/graph : http-8080-14:
at java.lang.ClassLoader.checkCerts(ClassLoader.java:752)
- waiting to lock 0x2aaac266fc30 (a
org.apache.catalina.loader.WebappClassLoader)
at java.lang.ClassLoader.preDefineClass(ClassLoader.java:488)
at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2527)
- locked 0x2aaab4465798 (a java.lang.String)
at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1010)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1483)
- locked 0x2aaab4465798 (a java.lang.String)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
- locked 0x2aaac2ce9f90 (a
hudson.ClassicPluginStrategy$DependencyClassLoader)
at java.lang.ClassLoader.loadClass(ClassLoader.java:300)
- locked 0x2aaac2ce9f08 (a java.net.URLClassLoader)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
- locked 0x2aaac2ce9f08 (a java.net.URLClassLoader)
at hudson.plugins.emma.CoverageObject.doGraph(CoverageObject.java:156)
at
hudson.plugins.emma.EmmaProjectAction.doGraph(EmmaProjectAction.java:52)


Handling GET /job/Project2Trunk/test/trend : http-8080-15:
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1394)
- waiting to lock 0x2aaab4465798 (a java.lang.String)
at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1361)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
- locked 0x2aaac266fc30 (a
org.apache.catalina.loader.WebappClassLoader)
at
hudson.tasks.test.AbstractTestResultAction.buildDataSet(AbstractTestResultAction.java:244)
at
hudson.tasks.test.AbstractTestResultAction.doGraph(AbstractTestResultAction.java:208)
at
hudson.tasks.test.TestResultProjectAction.doTrend(TestResultProjectAction.java:97)

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- You are receiving this mail because: ---
You are the assignee for the bug.

-
To 

DO NOT REPLY [Bug 48903] ClassLoader deadlock when compiling JSP pages in 6.0.26

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48903

--- Comment #10 from aullr...@blackducksoftware.com 2010-05-06 14:39:15 EDT ---
Created an attachment (id=25409)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25409)
thread dump - hudson

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



svn commit: r941853 - /tomcat/tc6.0.x/trunk/STATUS.txt

2010-05-06 Thread rjung
Author: rjung
Date: Thu May  6 19:00:54 2010
New Revision: 941853

URL: http://svn.apache.org/viewvc?rev=941853view=rev
Log:
Add comment. Will vote on that one pretty soon now ...

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=941853r1=941852r2=941853view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May  6 19:00:54 2010
@@ -147,8 +147,9 @@ PATCHES PROPOSED TO BACKPORT:
   Fix deadlock /sync issues in WebappClassLoader. Revert to using
   synchronized(this) as analysis and experience shows anything else will just
   cause problems
-  The patch looks bug but it just removes the sync block and sync's the method
+  The patch looks huge but it just removes the sync block and sync's the method
   http://svn.apache.org/viewvc?rev=927565view=rev
+  svn diff -x -w -r927564:927565 http://svn.apache.org/repos/asf/tomcat/trunk
   +1: markt, kkolinko
   -1: 
 



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



svn commit: r941862 - /tomcat/tc6.0.x/trunk/STATUS.txt

2010-05-06 Thread rjung
Author: rjung
Date: Thu May  6 19:06:41 2010
New Revision: 941862

URL: http://svn.apache.org/viewvc?rev=941862view=rev
Log:
Let's get rid of this nasty bug.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=941862r1=941861r2=941862view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May  6 19:06:41 2010
@@ -150,7 +150,7 @@ PATCHES PROPOSED TO BACKPORT:
   The patch looks huge but it just removes the sync block and sync's the method
   http://svn.apache.org/viewvc?rev=927565view=rev
   svn diff -x -w -r927564:927565 http://svn.apache.org/repos/asf/tomcat/trunk
-  +1: markt, kkolinko
+  +1: markt, kkolinko, rjung
   -1: 
 
   Additional patch:



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



svn commit: r941864 - /tomcat/tc6.0.x/trunk/STATUS.txt

2010-05-06 Thread rjung
Author: rjung
Date: Thu May  6 19:09:39 2010
New Revision: 941864

URL: http://svn.apache.org/viewvc?rev=941864view=rev
Log:
Vote for the second part of the deadlock fix.
Will commit next.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=941864r1=941863r2=941864view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May  6 19:09:39 2010
@@ -156,7 +156,7 @@ PATCHES PROPOSED TO BACKPORT:
   Additional patch:
   Mark ResourceEntry.loadedClass as volatile.
   http://svn.apache.org/viewvc?rev=927877view=rev
-  +1: kkolinko, markt
+  +1: kkolinko, markt, rjung
   -1:
 
   Note: (kkolinko): Applied to 5.5.x in r935947. The above patches address



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



svn commit: r941868 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/loader/ResourceEntry.java java/org/apache/catalina/loader/WebappClassLoader.java java/org/apache/jasper/servlet/Jasp

2010-05-06 Thread rjung
Author: rjung
Date: Thu May  6 19:17:49 2010
New Revision: 941868

URL: http://svn.apache.org/viewvc?rev=941868view=rev
Log:
BZ48903: Fix deadlock in webapp class loader.
Backport of r927565 and r927877 from trunk.
Already applied to TC 5.5 as r935947.

Modified:
tomcat/tc6.0.x/trunk/STATUS.txt
tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/ResourceEntry.java
tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
tomcat/tc6.0.x/trunk/java/org/apache/jasper/servlet/JasperLoader.java
tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=941868r1=941867r2=941868view=diff
==
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Thu May  6 19:17:49 2010
@@ -142,28 +142,6 @@ PATCHES PROPOSED TO BACKPORT:
 
   kkolinko: We have to mention the new parameter in 
jasper-howto.html#Configuration
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48903
-  and https://issues.apache.org/bugzilla/show_bug.cgi?id=48694#c8
-  Fix deadlock /sync issues in WebappClassLoader. Revert to using
-  synchronized(this) as analysis and experience shows anything else will just
-  cause problems
-  The patch looks huge but it just removes the sync block and sync's the method
-  http://svn.apache.org/viewvc?rev=927565view=rev
-  svn diff -x -w -r927564:927565 http://svn.apache.org/repos/asf/tomcat/trunk
-  +1: markt, kkolinko, rjung
-  -1: 
-
-  Additional patch:
-  Mark ResourceEntry.loadedClass as volatile.
-  http://svn.apache.org/viewvc?rev=927877view=rev
-  +1: kkolinko, markt, rjung
-  -1:
-
-  Note: (kkolinko): Applied to 5.5.x in r935947. The above patches address
-  BZ 44041, BZ 48903, BZ 48694. Those three issues are to be marked as 
RESOLVED,
-  when these patches are applied.
-
-
 * Correct SSL session timeout attribute name
   http://people.apache.org/~markt/patches/2010-04-07-SslSessionTimeout.patch
   +1: markt

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/ResourceEntry.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/ResourceEntry.java?rev=941868r1=941867r2=941868view=diff
==
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/ResourceEntry.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/ResourceEntry.java Thu 
May  6 19:17:49 2010
@@ -47,7 +47,7 @@ public class ResourceEntry {
 /**
  * Loaded class.
  */
-public Class loadedClass = null;
+public volatile Class loadedClass = null;
 
 
 /**

Modified: 
tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java?rev=941868r1=941867r2=941868view=diff
==
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
(original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/loader/WebappClassLoader.java 
Thu May  6 19:17:49 2010
@@ -1432,102 +1432,121 @@ public class WebappClassLoader
  *
  * @exception ClassNotFoundException if the class was not found
  */
-public Class loadClass(String name, boolean resolve)
+public synchronized Class loadClass(String name, boolean resolve)
 throws ClassNotFoundException {
 
-synchronized (name.intern()) {
-if (log.isDebugEnabled())
-log.debug(loadClass( + name + ,  + resolve + ));
-Class clazz = null;
-
-// Log access to stopped classloader
-if (!started) {
-try {
-throw new IllegalStateException();
-} catch (IllegalStateException e) {
-log.info(sm.getString(webappClassLoader.stopped, name), 
e);
-}
+if (log.isDebugEnabled())
+log.debug(loadClass( + name + ,  + resolve + ));
+Class clazz = null;
+
+// Log access to stopped classloader
+if (!started) {
+try {
+throw new IllegalStateException();
+} catch (IllegalStateException e) {
+log.info(sm.getString(webappClassLoader.stopped, name), e);
 }
-
-// (0) Check our previously loaded local class cache
-clazz = findLoadedClass0(name);
+}
+
+// (0) Check our previously loaded local class cache
+clazz = findLoadedClass0(name);
+if (clazz != null) {
+if (log.isDebugEnabled())
+log.debug(  Returning class from cache);
+if (resolve)
+resolveClass(clazz);
+return (clazz);
+}
+
+// 

DO NOT REPLY [Bug 48903] ClassLoader deadlock when compiling JSP pages in 6.0.26

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48903

Rainer Jung rainer.j...@kippdata.de changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution||FIXED

--- Comment #11 from Rainer Jung rainer.j...@kippdata.de 2010-05-06 15:20:20 
EDT ---
Fixed in TC 6.0.x by r941868. Will be part of 6.0.27.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



DO NOT REPLY [Bug 44041] WebappClassLoader duplicate class definition under high Load if hasExternalRepositories is true

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=44041

Rainer Jung rainer.j...@kippdata.de changed:

   What|Removed |Added

 Status|REOPENED|RESOLVED
 Resolution||FIXED

--- Comment #17 from Rainer Jung rainer.j...@kippdata.de 2010-05-06 15:21:03 
EDT ---
Fixed in TC 6 by r941868. Will be part of 6.0.27.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



DO NOT REPLY [Bug 49159] Improve ThreadLocal memory leak clean-up

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=49159

--- Comment #3 from sylvain.laur...@gmail.com 2010-05-06 17:15:35 EDT ---
Created an attachment (id=25411)
 -- (https://issues.apache.org/bugzilla/attachment.cgi?id=25411)
Patch for tomcat 7 to renew threads

Here is finally my proposition of patch for tomcat 7 to recreate the
ThreadPoolExecutor of each Executor when a Context is stopped.

I also removed the clearReferencesThreadLocals property on WebApp[Class]Loader
since my patch makes it useless and I think this feature is too unsafe.

I'm working on another patch for tomcat 6. There's a little more work to do
because of the old WorkerThread stuff that has been replace by
ThreadPoolExecutor in trunk.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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



DO NOT REPLY [Bug 48971] memory leak protection : stopping TimeThreads should be optional and disabled by default

2010-05-06 Thread bugzilla
https://issues.apache.org/bugzilla/show_bug.cgi?id=48971

--- Comment #6 from sylvain.laur...@gmail.com 2010-05-06 17:18:59 EDT ---
Mark, could you consider fixing this issue for 6.0.27 ? there's my (now old)
patch for trunk attached, do you need a more recent one and one for tomcat 6 as
well ?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
--- 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: Need advice to notify StandardExecutor when a webapp is stopped

2010-05-06 Thread Sylvain Laurent
I finally proposed a patch for trunk in 
https://issues.apache.org/bugzilla/show_bug.cgi?id=49159 for this. Thanks for 
reviewing it...

Sylvain

On 30 avr. 2010, at 18:27, Sylvain Laurent wrote:

 
 On 30 avr. 2010, at 00:01, Pid wrote:
 
 Are you saying that you want to stop processing requests each time a
 webapp gets restarted, or that the thread pool is refreshed by
 sequentially killing each thread and recreating it?
 
 Something in between : I create a new pool with the same characteristics as 
 the current one, make it the current pool so that new requests are served by 
 the new pool, then cleanly shut the old pool down. When calling 
 ThreadPoolExecutor.shutdown(), it gracefully terminates all threads in the 
 pool after its associated TaskQueue is empty : Idle threads stop immediately 
 (and not sequentially), busy threads continue processing their current 
 request. If the TaskQueue is not empty, it means that there are no idle 
 threads, and so busy threads will continue processing tasks in the queue 
 until it becomes empty.
 
 The renewThreads looks like (in StandardThreadExecutor) :
 
   public void renewThreads() {
   ThreadPoolExecutor oldExecutor;
   synchronized (executorLock) { // to avoid renewing threads 
 concurrently
   oldExecutor = executor;
   ThreadPoolExecutor newExecutor=new 
 ThreadPoolExecutor(getMinSpareThreads(),
   getMaxThreads(), maxIdleTime, 
 TimeUnit.MILLISECONDS,
   taskqueue, 
 oldExecutor.getThreadFactory());
   
   executor = newExecutor;
   taskqueue.setParent(executor);
   }
 
   oldExecutor.shutdown();
   //we don't wait for termination of the old pool, threads will 
 terminate when their work is done
   }
 
 I marked StandardThreadExecutor.executor and TaskQueue.parent as volatile to 
 propagate the change of executor instance to other threads without 
 synchronizing threads.
 
 An improvement I can do is to pre-start some core threads in the new pool 
 before making it active. It would reduce the performance impact on the next 
 few requests.
 
 Sylvain
 
 


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



Re: clearReferencesThreads, Poller SunPKCS11-Solaris and strange context class loader

2010-05-06 Thread Sylvain Laurent
When you analyzed the heap dump, what path to GC roots was retaining the 
classloader in memory ?


On 6 mai 2010, at 20:51, Rainer Jung wrote:

 While doing some testing with 6.0.26 I noticed, that when shutting it down it 
 logs an error about thread Poller SunPKCS11-Solaris not being stopped. When 
 I add the more explicit logging from tc6 trunk, it says the thread was 
 started by /manager.
 
 The thread sits in
 
 java.lang.Thread.State: TIMED_WAITING (sleeping)
 at java.lang.Thread.sleep(Native Method)
 at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:681)
 at java.lang.Thread.run(Thread.java:619)
 
 and is started for some version of the JDK (noted on Solaris for e.g. 
 1.5.0_22 and 1.6.0_3, not for 1.6.0_17) even without having anything related 
 to keystores, https or similar configured in Tomcat (default config). The 
 only non-default is using Log4J instead of Juli.
 
 What is strange, is that the check whether the context class loader of the 
 thread is equal to the WebappClassLoader of the context to unload passes. I 
 added an additional output by explicitely printing the contextName of the two 
 loaders and in fact both print /manager.
 
 When deploying two instances of the manager and reloading the original 
 instance with the additional one, I get the same warning.
 
 In a heap dump, it seems the context class loader of the thread is the system 
 class loader and not of type WebappClassLoader. Any idea, why the context 
 class loader test fails? Is there any reason why the context class loader of 
 the thread might change when doing the manager reload or shutdown?
 
 Regards,
 
 Rainer
 
 
 -
 To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
 For additional commands, e-mail: dev-h...@tomcat.apache.org
 


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



RE: Need advice to notify StandardExecutor when a webapp is stopped

2010-05-06 Thread Caldarale, Charles R
 From: Sylvain Laurent [mailto:sylvain.laur...@gmail.com]
 On Behalf Of Sylvain Laurent
 Subject: Re: Need advice to notify StandardExecutor when a 
 webapp is stopped
 
 An improvement I can do is to pre-start some core threads in the
 new pool before making it active. It would reduce the performance
 impact on the next few requests.

Or have another Executor sitting around with some threads already active, so 
all you have to do is set the reference to the pending Executor, then create 
another backup Executor outside of the synchronized block for the next time.  
Could also make the behavior configurable, in case the purists complain about 
having extra, idle threads taking up heap space.

 - Chuck


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



svn commit: r941955 - in /tomcat/trunk: ./ java/org/apache/tomcat/util/bcel/classfile/ res/META-INF/

2010-05-06 Thread markt
Author: markt
Date: Thu May  6 22:19:17 2010
New Revision: 941955

URL: http://svn.apache.org/viewvc?rev=941955view=rev
Log:
IBM has agreed to re-license the affected files.
A patch was provided by an IBM employee with a CLA on file under 
https://issues.apache.org/bugzilla/show_bug.cgi?id=49259
The files can now therefore be treated the same way as the other BCEL files.
The updated files have been applied to BCEL and I have copied them across to 
Tomcat 7 and made the same set of changes as I made previously.
The various LICENSE and NOTICE changes made in r934220 have been reverted.
Thanks to Kevan Miller and his IBM colleagues for working to resolve this so 
quickly.

Removed:
tomcat/trunk/res/META-INF/tomcat-coyote.jar.license
tomcat/trunk/res/META-INF/tomcat-coyote.jar.notice
tomcat/trunk/res/META-INF/tomcat-embed-core.jar.license
tomcat/trunk/res/META-INF/tomcat-embed-core.jar.notice
Modified:
tomcat/trunk/LICENSE
tomcat/trunk/NOTICE
tomcat/trunk/build.xml
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java

tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/LocalVariableTypeTable.java

Modified: tomcat/trunk/LICENSE
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/LICENSE?rev=941955r1=941954r2=941955view=diff
==
--- tomcat/trunk/LICENSE (original)
+++ tomcat/trunk/LICENSE Thu May  6 22:19:17 2010
@@ -210,9 +210,7 @@ and license terms. Your use of these sub
 conditions of the following licenses. 
 
 
-For the ecj-x.x.x.jar component and the EnclosingMethod and
-LocalVariableTypeTable classes in the org.apache.tomcat.util.bcel.classfile
-package:
+For the ecj-x.x.x.jar component:
 
 Eclipse Public License - v 1.0
 

Modified: tomcat/trunk/NOTICE
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/NOTICE?rev=941955r1=941954r2=941955view=diff
==
--- tomcat/trunk/NOTICE (original)
+++ tomcat/trunk/NOTICE Thu May  6 22:19:17 2010
@@ -33,7 +33,4 @@ The original XML Schemas for Java EE Dep
  - web-common_3_0.xsd
  - web-fragment_3_0.xsd
  - jsp_2_2.xsd
-may be obtained from http://java.sun.com/xml/ns/javaee/
-
-Annotation scanning is provide by Apache Jakarta BCEL which includes open 
source
-software developed by IBM.
\ No newline at end of file
+may be obtained from http://java.sun.com/xml/ns/javaee/
\ No newline at end of file

Modified: tomcat/trunk/build.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=941955r1=941954r2=941955view=diff
==
--- tomcat/trunk/build.xml (original)
+++ tomcat/trunk/build.xml Thu May  6 22:19:17 2010
@@ -535,9 +535,7 @@
 !-- Protocol handlers - Coyote --
 jarIt jarfile=${tomcat-coyote.jar}
   filesDir=${tomcat.classes}
-  filesId=files.tomcat-coyote
-  notice=${tomcat.manifests}/tomcat-coyote.jar.notice
-  license=${tomcat.manifests}/tomcat-coyote.license /
+  filesId=files.tomcat-coyote /
 
 !-- Jasper Implementation JAR File --
 jarIt jarfile=${jasper.jar}
@@ -856,9 +854,7 @@
 
 jarIt jarfile=${tomcat-embed-core.jar}
filesDir=${tomcat.classes}
-   filesId=files.tomcat-embed-core
-   notice=${tomcat.manifests}/tomcat-embed-core.jar.notice
-   license=${tomcat.manifests}/tomcat-embed-core.jar.license/
+   filesId=files.tomcat-embed-core/
 jarIt jarfile=${tomcat-embed-jasper.jar}
filesDir=${tomcat.classes}
filesId=files.tomcat-embed-jasper/

Modified: 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java?rev=941955r1=941954r2=941955view=diff
==
--- 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java 
(original)
+++ 
tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/EnclosingMethod.java 
Thu May  6 22:19:17 2010
@@ -1,25 +1,22 @@
-/* ***
- * Copyright (c) 2004 IBM Corporation
- * 
- * All rights reserved. 
- * This program and the accompanying materials are made available 
- * under the terms of the Common Public License v1.0 
- * which accompanies this distribution and is available at 
- * http://www.eclipse.org/legal/cpl-v10.html 
- * 
- * Contributors: 
- *Andy Clement initial implementation 
- * **/
-
-/*
- * Under the terms of the CPL v1.0, the ASF has elected to distribute this
- * file under the Eclipse Public License (EPL) 1.0 which has been designated
- * as the follow-on version of the CPL by the Agreement Steward.
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or 

[Tomcat Wiki] Update of HowTo by MarkEggers

2010-05-06 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The HowTo page has been changed by MarkEggers.
http://wiki.apache.org/tomcat/HowTo?action=diffrev1=87rev2=88

--

  
  This will produce a thread dump on standard output, but may not be possible 
to capture to a file.
  
+ == How do I use Hibernate and database connection pooling with Tomcat? ==
+ See [[TomcatHibernate]]
+ 
+ == How do I set up Tomcat virtual hosts in a development environment? ==
+ See [[TomcatDevelopmentVirtualHosts]]
  
- [[CategoryFAQ|CategoryFAQ]]
+ [[CategoryFAQ]]
  

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



[Tomcat Wiki] Update of TomcatHibernate by MarkEggers

2010-05-06 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The TomcatHibernate page has been changed by MarkEggers.
http://wiki.apache.org/tomcat/TomcatHibernate

--

New page:
= Tomcat, Hibernate, and Database Connection Pooling =
== Introduction ==
This is my understanding concerning how the Tomcat / Hibernate / database 
environment works. This is based on a post I made to the Tomcat Users mailing 
list. In this wiki article, I'll work through both Tomcat - managed database 
connection pooling and Hibernate - managed database connection pooling.

== Environments ==
I use primarily the following two environments when developing concepts and 
testing ideas.
||tablewidth=400px tableheight=365pxstyle=font-weight: bold;Component 
||style=font-weight: bold;Version ||
||OS ||Fedora 11 32 bit ||
||JDK/JRE ||1.6.0_20 ||
||Tomcat ||6.0.26 ||
||MySQL ||5.1.41-2 ||
||IDE ||!NetBeans 6.8 ||
||Hibernate ||3.2.5 ga ||
|| || ||
||OS ||Windows/XP Professional SP 4 32 bit ||
||JDK/JRE ||1.6.0_20 ||
||Tomcat ||6.0.26 ||
||MySQL ||5.1.31 ||
||IDE ||!NetBeans 6.8 ||
||Hibernate ||3.2.5 ga ||




In order to work through the two configurations, I've chosen to use the 
[[http://netbeans.org/kb/docs/web/hibernate-webapp.html|NetBeans Hibernate 
Tutorial]]. The original tutorial does not make any use of database pooling. 
Modifications to the tutorial will be shown below to use either Tomcat's 
database pooling via JNDI or Hibernate's provided CP30 database pooling.

== Preliminaries ==
Before proceeding, either work through or download the 
[[http://netbeans.org/kb/docs/web/hibernate-webapp.html|Netbeans Hibernate 
Tutorial]]. This will ensure that the project is set up properly so that 
modifications can be easily made.

== Tomcat JNDI Database Pooling Basics ==
=== Tomcat Preparation ===
Per Tomcat documentation, I've placed mysql-connector-java-5.1.11-bin.jar in 
Tomcat's lib directory. This makes the JDBC driver  available to Tomcat in 
order to set up database pooling. No Hibernate jars should be placed in 
Tomcat's lib directory.

=== Web Application ===
All Hibernate jars are located in WEB-INF/lib. !NetBeans  builds the war file 
correctly, so no jar files have to be copied.

Per Tomcat documentation, a context.xml file in META-INF is created.

{{{
?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true 
path=/DVDStore
  Resource auth=Container
  driverClassName=com.mysql.jdbc.Driver maxActive=30 maxIdle=10 
maxWait=1 name=jdbc/sakila password=*
  type=javax.sql.DataSource url=jdbc:mysql://localhost/sakila 
username=*/
/Context
}}}
Obviously, replace the asterisks with the appropriate username and password. 
Replace the database url with your appropriate database.

In WEB-INF/web.xml you'll need to add the following lines.

{{{
resource-ref
  descriptionThis is a MySQL database connection/description
  res-ref-namejdbc/sakila/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref
}}}
Again, this is all boilerplate configuration and is documented on the Tomcat 
documentation web site. In particular, please note that the '''res-ref-name''' 
in web.xml '''must match''' the '''name''' attribute of the resource node in 
the context.xml file.

=== Hibernate Configuration ===
So far, this has all been more or less boilerplate Tomcat configuration. The 
next step is to get Hibernate to talk to Tomcat's database connection pool as 
opposed to its own connection pool or a direct connection.

After searching a bit on the Internet, I found that the following connection 
information works.

In hibernate.cfg.xml located in WEB-INF/, put the following.

{{{
!-- using container-managed JNDI --
propertyname=hibernate.connection.datasource
   java:comp/env/jdbc/sakila
/property
}}}
Note that jdbc/sakila matches the web.xml resource-ref-name, which matches the 
name attribute in context.xml. java:comp/env/ is the namespace to look up the 
jdbc reference.

No other connection or pooling information should be present in your 
hibernate.cfg.xml file.

If you are using Netbeans as your IDE, the hibernate.cfg.xml file will be found 
in project-name/src/java by default.

=== Application Code ===
One of the nice things about Hibernate is that it shields your application code 
from database connection particulars. You can change from Tomcat JNDI pooling 
to Hibernate pooling, to a direct connection all without changing the 
underlying application code. In particular:

Creating the !SessionFactory

{{{
// SessionFactory from standard hibernate.cfg.xml file
try {
sessionFactory = new 
AnnotationConfiguration().configure().buildSessionFactory();
} catch (Throwable ex) {
// Log the exception.
log.fatal(Initial SessionFactory creation failed., ex); throw new 
ExceptionInInitializerError(ex);
}
}}}
and getting the !SessionFactory

{{{
public static SessionFactory getSessionFactory() 

[Tomcat Wiki] Update of TomcatDevelopmentVirtualHosts by MarkEggers

2010-05-06 Thread Apache Wiki
Dear Wiki user,

You have subscribed to a wiki page or wiki category on Tomcat Wiki for change 
notification.

The TomcatDevelopmentVirtualHosts page has been changed by MarkEggers.
http://wiki.apache.org/tomcat/TomcatDevelopmentVirtualHosts

--

New page:
= Tomcat Virtual Hosts Development Environment =
== Introduction ==
This document describes a clean way to create Tomcat virtual hosts in a 
development environment. This setup will not work as is for a production 
environment, since the Tomcat virtual hosts described by this document will not 
be visible except on the local host. However, this document can be used as a 
basis for creating a production Tomcat virtual host environment.

This document is based on a response I originally wrote concerning logging 
issues and Tomcat virtual hosts.

== Environments ==
I use primarily the following two environments when developing concepts and 
testing ideas.
||tablewidth=400px tableheight=365pxstyle=font-weight: bold;Component 
||style=font-weight: bold;Version ||
||OS ||Fedora 11 32 bit ||
||JDK/JRE ||1.6.0_20 ||
||Tomcat ||6.0.26 ||
||IDE ||!NetBeans 6.8 ||
||Spring ||2.5 (provided with !NetBeans) ||
|| || ||
||OS ||Windows/XP Professional SP 4 32 bit ||
||JDK/JRE ||1.6.0_20 ||
||Tomcat ||6.0.26 ||
||IDE ||!NetBeans 6.8 ||
||Spring ||2.5 (provided with !NetBeans) ||




I am reworking the Spring Developer's Notebook bike store example so I can 
understand Spring testing and the use of mock objects. I've also added logging 
to this application. Logging is provided by Apache's commons-logging, since 
Spring ships with the commons-logging package. The back end logging provider is 
Apache's log4j.

I've run into a lot of interesting issues, mostly having to do with Spring 
test libraries versus JUnit versus mock objects. However, that's a topic for 
another discussion.

== Directory Structure ==
In order to create virtual hosts, do the following:

 1. Create a separate directory for each host '''outside of 
$CATALINA_HOME/webapps'''
 1. Underneath each directory, create a webapps directory.

For example, here is a sample directory structure for hosts foo and bar.

=== Windows Environment ===
Tomcat is located in C:\Apache\apache-tomcat-6.0.26. While recent versions of 
Tomcat and Apache HTTPD manage spaces in directory names, I prefer to have my 
services live outside of C:\Program Files.
||tablewidth=425pxstyle=font-weight: bold;Hostname ||Location ||
||localhost ||C:\Apache\apache-tomcat-6.0.26\webapps ||
||foo ||C:\Apache\hosts\foo-host\webapps ||
||bar ||C:\Apache\hosts\bar-host\webapps ||




=== Linux Environment ===
Tomcat is located in ~/Apache/apache-tomcat-6.0.26. This is a development copy 
and lives in my home directory. I can easily start, stop, deploy, undeploy, and 
make changes to this Tomcat server both from the command line and from within 
my development environment.
||tablewidth=425pxstyle=font-weight: bold;Hostname ||Location ||
||localhost ||~/Apache/apache-tomcat-6.0.26/webapps ||
||foo ||~Apache/hosts/foo-host/webapps ||
||bar ||~Apache/hosts/bar-host/webapps ||




=== Environment Notes ===
Putting the virtual host directory structure outside of the Tomcat installation 
provides the following advantages..

 * When Tomcat is upgraded, virtual hosts are not a concern
 * A pristine Tomcat environment is preserved, which can be useful for debugging
 * Creating new virtual hosts is easy, and does not disturb a running Tomcat

Creating a hosts/host-name/webapps structure provides several advantages as 
well.

 * All the hosts are located in one directory, making it easy to move, change 
permissions, or otherwise manage a collection of virtual hosts
 * Provides a consistent and easily understood naming convention
 * the hosts/host-name location provides a good place to locate cross-context 
web applications such as [[http://lucene.apache.org/solr/|Solr]]

== Tomcat Configuration ==
=== Server.xml ===
To create virtual hosts, I just copied the original locahost entry for the foo 
and bar hosts. I changed the name and appBase values to fit the targeted hosts. 
The resulting files (Windows and Linux) are shown below. Adjust those locations 
to reflect your directory structure.

 Server.xml fragment for Windows 
{{{
Host name=localhost  appBase=webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false
/Host

Host name=foo  appBase=C:/Apache/hosts/foo-host/webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false
/Host

Host name=bar  appBase=C:/Apache/hosts/bar-host/webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false
/Host
}}}
 Server.xml fragment for Linux 
{{{
Host name=localhost  appBase=webapps
  unpackWARs=true autoDeploy=true
  xmlValidation=false xmlNamespaceAware=false
/Host

Host name=foo  appBase=/home/mdeggers/Apache/hosts/foo-host/webapps
  unpackWARs=true autoDeploy=true
  

Re: clearReferencesThreads, Poller SunPKCS11-Solaris and strange context class loader

2010-05-06 Thread Rainer Jung

On 06.05.2010 23:24, Sylvain Laurent wrote:

When you analyzed the heap dump, what path to GC roots was retaining the 
classloader in memory ?


I did the heap dump before the context restart.

Note: I don't want to debug a memory leak. I'm wondering why the PCKS 
Token Poller thread was captured by the leak prevention. Since we know 
the code, it was because its context class loader was equal to the 
WebappClassLoader of /manager. That's what I don't understand. See my 
original post.


Regards,

Rainer


On 6 mai 2010, at 20:51, Rainer Jung wrote:


While doing some testing with 6.0.26 I noticed, that when shutting it down it logs an 
error about thread Poller SunPKCS11-Solaris not being stopped. When I add the 
more explicit logging from tc6 trunk, it says the thread was started by /manager.

The thread sits in

java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at sun.security.pkcs11.SunPKCS11$TokenPoller.run(SunPKCS11.java:681)
at java.lang.Thread.run(Thread.java:619)

and is started for some version of the JDK (noted on Solaris for e.g. 1.5.0_22 
and 1.6.0_3, not for 1.6.0_17) even without having anything related to 
keystores, https or similar configured in Tomcat (default config). The only 
non-default is using Log4J instead of Juli.

What is strange, is that the check whether the context class loader of the thread is 
equal to the WebappClassLoader of the context to unload passes. I added an additional 
output by explicitely printing the contextName of the two loaders and in fact both print 
/manager.

When deploying two instances of the manager and reloading the original instance 
with the additional one, I get the same warning.

In a heap dump, it seems the context class loader of the thread is the system 
class loader and not of type WebappClassLoader. Any idea, why the context class 
loader test fails? Is there any reason why the context class loader of the 
thread might change when doing the manager reload or shutdown?

Regards,

Rainer




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