Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 39098 invoked from network); 4 Oct 2000 01:45:13 -0000 Received: from adsl-63-204-215-252.dsl.snfc21.pacbell.net (HELO mail.telkel.com) (postfix@63.204.215.252) by locus.apache.org with SMTP; 4 Oct 2000 01:45:13 -0000 Received: from m4x.org (adsl-63-204-215-250.dsl.snfc21.pacbell.net [63.204.215.250]) by mail.telkel.com (Postfix) with ESMTP id DF95B8E54A; Tue, 3 Oct 2000 18:33:37 -0700 (PDT) Sender: alborini@telkel.com Message-ID: <39DA8D26.C9F101D2@m4x.org> Date: Tue, 03 Oct 2000 18:51:34 -0700 From: Sebastien Alborini X-Mailer: Mozilla 4.72 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 To: "tomcat-dev@jakarta.apache.org" Cc: jBoss Developer Subject: Tomcat + jBoss class loader integration Content-Type: multipart/mixed; boundary="------------FC1B74F3E98712904BFE6A2E" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N --------------FC1B74F3E98712904BFE6A2E Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, Following Aaron Mulder's post on the subject, I've finally managed - to make tomcat and jboss live in the same VM (using the org.apache.tomcat.startup.EmbededTomcat launcher) - to make a jboss container and a tomcat context share the same classloader. This means that they can exchange objects without relying on RMI, and without the odd behavior Aaron described (same class + different classloader = different class). With this, they can communicate *MUCH* faster. The idea was to use the context classloader as a parent in both tomcat and jboss. The deployer tool can then feed this context classloader before calling jboss.deploy and EmbededTomcat.addContext. It requires a one-line change in tomcat's code (see patch) : setting the AdaptiveServletLoader's parent to the contextClassLoader instead of this.getClass().getClassLoader(). This change does not seem to affect tomcat otherwise, since the default ContextClassLoader always contains tomcat's classes. This has been tested with tomcat 3.2b4 / 3.2b5 Thanks, Sebastien --------------FC1B74F3E98712904BFE6A2E Content-Type: text/plain; charset=us-ascii; name="patch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="patch.txt" --- jakarta-tomcat/src/share/org/apache/tomcat/context/LoaderInterceptor.java.orig Tue Oct 3 18:13:53 2000 +++ jakarta-tomcat/src/share/org/apache/tomcat/context/LoaderInterceptor.java Tue Oct 3 18:14:19 2000 @@ -91,7 +91,7 @@ { ContextManager cm = context.getContextManager(); AdaptiveServletLoader loader=new AdaptiveServletLoader(); - loader.setParentLoader(this.getClass().getClassLoader()); + loader.setParentLoader(Thread.currentThread().getContextClassLoader()); context.setServletLoader( loader ); String base = context.getDocBase(); --------------FC1B74F3E98712904BFE6A2E--