Replacing WebappClassLoader

2002-04-24 Thread Volker Leidl

Hi!

I tried to configure tomcat 4.0.2 to use my own class loader implementation
for web-app class loading. The documentation implies that this can be done
by secifying a loaderClass attribute in my Context/Loader element in
server.xml.
This does not work.
Stepping through the code of org.apache.catalina.loader.WebappLoader (which
i still want to use) I found out that the loaderClass Property does get set,
but it seems to be ignored since
org.apache.catalina.loader.WebappClassLoader gets instantiated explicitly
(line 615-, cvs revision 1.12.2.5).
Is this intended? Perhaps I missed something in the code.

Best regards,

Volker.


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




Re: Replacing WebappClassLoader

2002-04-24 Thread Christopher K. St. John

Volker Leidl wrote:
 
 I tried to configure tomcat 4.0.2 to use my own class loader implementation
 for web-app class loading. The documentation implies that this can be done
 by secifying a loaderClass attribute in my Context/Loader element in
 server.xml.


 Loader specifies an org.apache.catalina.Loader object, not an
java.lang.ClassLoader. You'd need to do something like this:

package com.distributopia.mtc;

import java.io.*;
import org.apache.catalina.*;
import org.apache.catalina.loader.*;

public class TestLoader extends WebappLoader {
  public TestLoader(ClassLoader parent) {
super(parent);
System.out.println(TestLoader.TestLoader(+parent+));
  }
  public void setDebug(int debug) {
System.out.println(TestLoader.setDebug(+debug+));
super.setDebug(debug);
  }
  public void start() throws LifecycleException {
System.out.println(TestLoader.start());
// instead of super.start(), do your own thing here
super.start();
  }
}

 Compile it, jar it up, copy it over to $TOMCAT_HOME/server/lib,
and you're set. Sort of.


 Stepping through the code of org.apache.catalina.loader.WebappLoader (which
 i still want to use) I found out that the loaderClass Property does get set,
 but it seems to be ignored since
 org.apache.catalina.loader.WebappClassLoader gets instantiated explicitly
 (line 615-, cvs revision 1.12.2.5).
 Is this intended? Perhaps I missed something in the code.
 

 What the example above does is override the start() method. It
just re-dispatches it to the original, but what you'd need to do
is reimplement it to use your classloader, instead of the one
WebAppClassLoader uses.


 This does not work.


 Actually, neither does my suggestion, at leat not on HEAD. I
could have sworn it used to work, but maybe I just wasn't paying
enough attention to the log messages. Anyway, running the above
I get this:

ServerLifecycleListener: createMBeans: MBeanException
java.lang.Exception: ManagedBean is not found with TestLoader
at org.apache.catalina.mbeans.MBeanUtils.createMBean(MBeanUtils.java:374)

 I'll test further, but first I wanted to get some feedback on
whether I've made some stupid mistake. I kinda sorta half
suspect this is related to the way Tomcat hardcodes all the
MBeans  instead of generating them dynamically using reflection,
but I'm very unsure about it.


-- 
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

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




Re: Replacing WebappClassLoader

2002-04-24 Thread hung

Dear Tomcat Dev,
  Is there a website that have the instruction on how to connection Tomcat 4
with Apache 2?  Please help.  Made me running tomcat as module of apache.
thanks

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




Re: Replacing WebappClassLoader

2002-04-24 Thread Christopher K. St. John

Christopher K. St. John wrote:
 
  Loader specifies an org.apache.catalina.Loader object, not an
 java.lang.ClassLoader. You'd need to do something like this:
 

 Ack. You were talking about the loaderClass attribute, not the
className attribute. I wasn't paying close enough attention,
sorry. But what I suggested is probably still your best bet if
you need to get this done without fixing WebappLoader to properly
use the classLoader attribute.


-- 
Christopher St. John [EMAIL PROTECTED]
DistribuTopia http://www.distributopia.com

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




Re: Replacing WebappClassLoader

2002-04-24 Thread Daniel Rall

hung [EMAIL PROTECTED] writes:

 Dear Tomcat Dev,
   Is there a website that have the instruction on how to connection Tomcat 4
 with Apache 2?  Please help.  Made me running tomcat as module of apache.

This sort of question is most appropriate on the Tomcat User list.

The documentation for what you're asking about is located under the
Connectors section of the left nav in the following links:

http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/index.html
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/index.html

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