cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config AutoSetup.java

2001-02-01 Thread costin

costin  01/01/31 21:18:00

  Modified:src/share/org/apache/tomcat/modules/config AutoSetup.java
  Log:
  Contexts will be added at contextInit stage, not engineStart -
  when engine is starting all config must be set in.
  
  Revision  ChangesPath
  1.5   +1 -1  
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java
  
  Index: AutoSetup.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AutoSetup.java2001/01/23 13:17:07 1.4
  +++ AutoSetup.java2001/02/01 05:17:59 1.5
  @@ -84,7 +84,7 @@
*   We need a mechanism ( or convention ) to configure
*  virtual hosts too
*/
  -public void engineStart(ContextManager cm) throws TomcatException {
  +public void engineInit(ContextManager cm) throws TomcatException {
String home=cm.getHome();
File webappD=new File(home + "/webapps");
if (! webappD.exists() || ! webappD.isDirectory()) {
  
  
  

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




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config AutoSetup.java

2001-01-31 Thread costin

costin  01/01/31 23:09:24

  Modified:src/share/org/apache/tomcat/modules/config AutoSetup.java
  Log:
  - removed Larry's patch ( the context shouldn't be initialized when
  AutoSetup.engineInit is called - expanding the wars and adding webapps
  is part of the server configuration, and before we have a fully configured
  server we can't proceed with context initialization )
  
  - don't call context.init in AutoSetup - it's not going to be executed
  anyway ( since the server is not yet fully configured )
  
  Revision  ChangesPath
  1.6   +14 -14
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java
  
  Index: AutoSetup.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AutoSetup.java2001/02/01 05:17:59 1.5
  +++ AutoSetup.java2001/02/01 07:09:23 1.6
  @@ -121,7 +121,7 @@
// Expand war file
try {
FileUtil.expand(home + "/webapps/" + name,
  -home + "/webapps/" + fname);
  + home + "/webapps/" + fname);
   expanded=true;
} catch( IOException ex) {
log("expanding webapp " + name, ex);
  @@ -131,12 +131,7 @@
// we will add the directory to the path
name=fname;
}
  -
  - // XXX XXX Add a .xml case
  - // If a "path.xml" file is found in webapps/, it will be loaded
  - // as a  fragment ( what will allow setting options
  - // for contexts or automatic config for contexts with different base)
  -
  + 
// Decode path
   
// Path will be based on the War name
  @@ -149,6 +144,9 @@
   
Context ctx = (Context)definedContexts.get(path);
// if context is defined and was expanded
  + /* Not needed any more - the context are expanded and added
  +during server configuration, init and context config is done later,
  +after the server is stable
if( ctx != null && expanded ) {
// we need to reload the context since it was initialized
// before its directories existed. At minimum, its classloader
  @@ -166,7 +164,8 @@
ctx=null;
}
}
  -
  + */
  + 
   // if context not defined
if( ctx  == null ) {
// if no explicit set up and is a directory
  @@ -184,13 +183,14 @@
if( debug > 0 )
log("automatic add " + ctx.toString() + " " + path);
cm.addContext(ctx);
  - ctx.init();
  - } else {
  - if( debug>0)
  - log("Already set up: " + path + " "
  - + definedContexts.get(path));
  + // no init -  the manager is not initailized itself
  + // ctx.init();
}
  -}
  + } else {
  + if( debug>0)
  + log("Already set up: " + path + " "
  + + definedContexts.get(path));
  + }
}
   }
   }
  
  
  

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




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config AutoSetup.java

2001-01-23 Thread larryi

larryi  01/01/23 05:17:07

  Modified:src/share/org/apache/tomcat/modules/config AutoSetup.java
  Log:
  If an expanded context is already defined, try to reload the context instead
  of recreate it.  This has a better chance of preserving the context settings. :-)
  
  Note: Context reloading is not currently successful at completely avoiding
  the bug.  If you try to execute the admin/test/test.jsp when the admin.war
  wasn't already expaned, the request will result in a 500 error. The
  ServletContext for the JspServlet is still carrying a reference to the
  old context and its old classloader.  This old classloader doesn't have
  WEB-INF/classes in its urls[] array. If this problem occurs, restart Tomcat.
  Since the admin.war is already expanded, the problem is avoided.
  
  Revision  ChangesPath
  1.4   +21 -6 
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java
  
  Index: AutoSetup.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AutoSetup.java2001/01/22 21:37:29 1.3
  +++ AutoSetup.java2001/01/23 13:17:07 1.4
  @@ -148,15 +148,30 @@
path="";
   
Context ctx = (Context)definedContexts.get(path);
  -// if context not defined or was expanded
  - if( ctx  == null || expanded ) {
  + // if context is defined and was expanded
  + if( ctx != null && expanded ) {
  + // we need to reload the context since it was initialized
  + // before its directories existed. At minimum, its classloader
  + // needs updating.
  + if ( ctx.getReloadable() ) {
  + ctx.setReload( true );
  + if( debug > 0 )
  + log("setting context " + ctx.toString() + "to reload");
  + } else {
  + log("Warning: predefined context " + ctx.toString() +
  + " is not reloadable, recreating instead. Some settings may be lost!");
  + cm.removeContext(ctx);
  + // XXX Make sure ctx is destroyed - we may have
  + // undetected leaks 
  + ctx=null;
  + }
  + }
  +
  +// if context not defined
  + if( ctx  == null ) {
// if no explicit set up and is a directory
File f=new File( webappD, name);
if (f.isDirectory()) {
  - // If the context is already defined and was expanded,
  - // we need to remove it since it was initialized before
  - // its directories existed. At minimum, its classloader
  - // needs updating.
if ( ctx != null )
cm.removeContext(ctx);
ctx=new Context();
  
  
  

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




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config AutoSetup.java

2001-01-22 Thread larryi

larryi  01/01/22 13:37:31

  Modified:src/share/org/apache/tomcat/modules/config AutoSetup.java
  Log:
  Fix classloader problem which occurs when a war file gets expanded for
  a context that is already listed in the server.xml.
  
  The classloader gets created by server.xml processing before the war file
  is expanded.  When SimpleClassLoader is used, it will lack the WEB-INF
  directories in its urls[] array.  Make AutoSetup remove and add the context
  so the classloader gets updated.
  
  Fixed the indentation to make it more readable, though it somewhat hides
  the actual changes.
  
  Revision  ChangesPath
  1.3   +30 -20
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java
  
  Index: AutoSetup.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AutoSetup.java2001/01/01 03:42:58 1.2
  +++ AutoSetup.java2001/01/22 21:37:29 1.3
  @@ -110,6 +110,7 @@
}
for (int i = 0; i < list.length; i++) {
String name = list[i];
  +boolean expanded = false;
if( name.endsWith(".war") ) {
String fname=name.substring(0, name.length()-4);
File appDir=new File( home + "/webapps/" + fname);
  @@ -121,6 +122,7 @@
try {
FileUtil.expand(home + "/webapps/" + name,
   home + "/webapps/" + fname);
  +expanded=true;
} catch( IOException ex) {
log("expanding webapp " + name, ex);
// do what ?
  @@ -145,26 +147,34 @@
if( path.equals("/ROOT") )
path="";
   
  - if(  definedContexts.get(path) == null ) {
  - // if no explicit set up and is a directory
  -File f=new File( webappD, name);
  -if (f.isDirectory()) {
  -Context ctx=new Context();
  -ctx.setContextManager( cm );
  -ctx.setPath(path);
  -definedContexts.put( path, ctx );
  -// use absolute filename based on CM home instead of relative
  -// don't assume HOME==TOMCAT_HOME
  -ctx.setDocBase( f.getAbsolutePath() );
  -if( debug > 0 )
  -log("automatic add " + ctx.toString() + " " + path);
  -cm.addContext(ctx);
  - ctx.init();
  -} else {
  -if( debug>0)
  -log("Already set up: " + path + " "
  -+ definedContexts.get(path));
  -}
  + Context ctx = (Context)definedContexts.get(path);
  +// if context not defined or was expanded
  + if( ctx  == null || expanded ) {
  + // if no explicit set up and is a directory
  + File f=new File( webappD, name);
  + if (f.isDirectory()) {
  + // If the context is already defined and was expanded,
  + // we need to remove it since it was initialized before
  + // its directories existed. At minimum, its classloader
  + // needs updating.
  + if ( ctx != null )
  + cm.removeContext(ctx);
  + ctx=new Context();
  + ctx.setContextManager( cm );
  + ctx.setPath(path);
  + definedContexts.put( path, ctx );
  + // use absolute filename based on CM home instead of relative
  + // don't assume HOME==TOMCAT_HOME
  + ctx.setDocBase( f.getAbsolutePath() );
  + if( debug > 0 )
  + log("automatic add " + ctx.toString() + " " + path);
  + cm.addContext(ctx);
  + ctx.init();
  + } else {
  + if( debug>0)
  + log("Already set up: " + path + " "
  + + definedContexts.get(path));
  + }
   }
}
   }
  
  
  

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




cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/modules/config AutoSetup.java DefaultCMSetter.java

2000-12-31 Thread costin

costin  00/12/31 19:42:59

  Modified:src/share/org/apache/tomcat/modules/config AutoSetup.java
DefaultCMSetter.java
  Log:
  Fix missing package names.
  
  Revision  ChangesPath
  1.2   +1 -2  
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java
  
  Index: AutoSetup.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/AutoSetup.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AutoSetup.java2001/01/01 01:58:38 1.1
  +++ AutoSetup.java2001/01/01 03:42:58 1.2
  @@ -57,8 +57,7 @@
*
*/ 
   
  -
  -package org.apache.tomcat.context;
  +package org.apache.tomcat.modules.config;
   
   import org.apache.tomcat.core.*;
   import org.apache.tomcat.util.*;
  
  
  
  1.3   +1 -1  
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/DefaultCMSetter.java
  
  Index: DefaultCMSetter.java
  ===
  RCS file: 
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/DefaultCMSetter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultCMSetter.java  2001/01/01 02:07:23 1.2
  +++ DefaultCMSetter.java  2001/01/01 03:42:58 1.3
  @@ -57,7 +57,7 @@
*
*/
   
  -package org.apache.tomcat.modules.aaa;
  +package org.apache.tomcat.modules.config;
   
   import org.apache.tomcat.core.*;
   import java.io.*;
  
  
  

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