larryi 01/01/06 17:53:55
Modified: src/facade22/org/apache/tomcat/facade JspInterceptor.java
src/share/org/apache/tomcat/modules/config
LoaderInterceptor11.java LoaderInterceptor12.java
Log:
The URLClassLoader in Sun's JDK1.2.2 for Windows has trouble loading
classes from file URL's that have '\' characters in the file string. Make sure
the file URL's contain only '/' characters so LoaderInterceptor12 will work
with JDK1.2.2 on Windows.
For consistency, updated LoaderInterceptor11 set file URLs the contain
only '/' characters too.
Updated logging in LoaderInterceptor11 and LoaderInterceptor12
to show list of classpath URLs.
Revision Changes Path
1.2 +3 -1
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java
Index: JspInterceptor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JspInterceptor.java 2000/12/27 17:15:03 1.1
+++ JspInterceptor.java 2001/01/07 01:53:55 1.2
@@ -115,8 +115,10 @@
JspFactory.setDefaultFactory(new JspFactoryImpl());
try {
+ // Note: URLClassLoader in JDK1.2.2 doesn't work with file URLs
+ // that contain '\' characters. Insure only '/' is used.
URL url=new URL( "file", null,
- ctx.getWorkDir().getAbsolutePath() + "/");
+ ctx.getWorkDir().getAbsolutePath().replace('\\','/') + "/");
ctx.addClassPath( url );
if( debug > 9 ) log( "Added to classpath: " + url );
} catch( MalformedURLException ex ) {
1.3 +19 -7
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor11.java
Index: LoaderInterceptor11.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor11.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LoaderInterceptor11.java 2001/01/01 02:07:23 1.2
+++ LoaderInterceptor11.java 2001/01/07 01:53:55 1.3
@@ -90,7 +90,10 @@
// Thanks for Kevin Jones for providing the fix.
if( dir.exists() ) {
try {
- URL url=new URL( "file", null, dir.getAbsolutePath() + "/" );
+ // Note: URLClassLoader in JDK1.2.2 doesn't work with file URLs
+ // that contain '\' characters. Insure only '/' is used.
+ URL url=new URL( "file", null,
+ dir.getAbsolutePath().replace('\\','/') + "/" );
context.addClassPath( url );
} catch( MalformedURLException ex ) {
}
@@ -103,7 +106,9 @@
for(int i=0; i < jars.size(); ++i) {
String jarfile = (String) jars.elementAt(i);
File jf=new File(f, jarfile );
- String absPath=jf.getAbsolutePath();
+ // Note: URLClassLoader in JDK1.2.2 doesn't work with file URLs
+ // that contain '\' characters. Insure only '/' is used.
+ String absPath=jf.getAbsolutePath().replace('\\','/');
try {
URL url=new URL( "file", null, absPath );
context.addClassPath( url );
@@ -117,13 +122,15 @@
public void contextInit( Context context)
throws TomcatException
{
+ if( debug>0 ) log( "Init context " + context.getPath());
ContextManager cm = context.getContextManager();
-
URL classP[]=context.getClassPath();
- if( debug > 0 ) {
- for( int i=0; i< classP.length ; i++ )
- log ( "Set classpath " + classP[i] );
+ if( debug>5 ) {
+ log(" Context classpath URLs:");
+ for (int i = 0; i < classP.length; i++)
+ log(" " + classP[i].toString() );
}
+
DependManager dm=context.getDependManager();
if( dm==null ) {
dm=new DependManager();
@@ -140,10 +147,15 @@
}
public void reload( Request req, Context context) throws TomcatException {
- log( "Reload event " );
+ log( "Reload event " + context.getPath() );
ContextManager cm = context.getContextManager();
URL urls[]=context.getClassPath();
+ if( debug>5 ) {
+ log(" Context classpath URLs:");
+ for (int i = 0; i < urls.length; i++)
+ log(" " + urls[i].toString() );
+ }
DependManager dm=new DependManager();
context.setDependManager( dm );
1.3 +18 -3
jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor12.java
Index: LoaderInterceptor12.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/modules/config/LoaderInterceptor12.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- LoaderInterceptor12.java 2001/01/01 02:07:23 1.2
+++ LoaderInterceptor12.java 2001/01/07 01:53:55 1.3
@@ -100,7 +100,10 @@
// Thanks for Kevin Jones for providing the fix.
if( dir.exists() ) {
try {
- URL url=new URL( "file", null, dir.getAbsolutePath() + "/" );
+ // Note: URLClassLoader in JDK1.2.2 doesn't work with file URLs
+ // that contain '\' characters. Insure only '/' is used.
+ URL url=new URL( "file", null,
+ dir.getAbsolutePath().replace('\\','/') + "/" );
context.addClassPath( url );
} catch( MalformedURLException ex ) {
}
@@ -113,7 +116,9 @@
for(int i=0; i < jars.size(); ++i) {
String jarfile = (String) jars.elementAt(i);
File jf=new File(f, jarfile );
- String absPath=jf.getAbsolutePath();
+ // Note: URLClassLoader in JDK1.2.2 doesn't work with file URLs
+ // that contain '\' characters. Insure only '/' is used.
+ String absPath=jf.getAbsolutePath().replace('\\','/');
try {
URL url=new URL( "file", null, absPath );
context.addClassPath( url );
@@ -131,6 +136,11 @@
if( debug>0 ) log( "Init context " + context.getPath());
ContextManager cm = context.getContextManager();
URL urls[]=context.getClassPath();
+ if( debug>5 ) {
+ log(" Context classpath URLs:");
+ for (int i = 0; i < urls.length; i++)
+ log(" " + urls[i].toString() );
+ }
DependManager dm=context.getDependManager();
if( dm==null ) {
@@ -149,10 +159,15 @@
}
public void reload( Request req, Context context) throws TomcatException {
- log( "Reload event " );
+ log( "Reload event " + context.getPath());
ContextManager cm = context.getContextManager();
URL urls[]=context.getClassPath();
+ if( debug>5 ) {
+ log(" Context classpath URLs:");
+ for (int i = 0; i < urls.length; i++)
+ log(" " + urls[i].toString() );
+ }
ClassLoader oldLoader=context.getClassLoader();
int oldLoaderNote=cm.getNoteId( ContextManager.CONTAINER_NOTE,
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]