Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 92877 invoked from network); 5 Sep 2005 22:56:37 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 5 Sep 2005 22:56:37 -0000 Received: (qmail 86791 invoked by uid 500); 5 Sep 2005 22:56:34 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 85873 invoked by uid 500); 5 Sep 2005 22:56:32 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 85860 invoked by uid 99); 5 Sep 2005 22:56:32 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2005 15:56:32 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [212.27.42.28] (HELO smtp2-g19.free.fr) (212.27.42.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 Sep 2005 15:56:43 -0700 Received: from [192.168.0.2] (fny94-2-81-56-42-18.fbx.proxad.net [81.56.42.18]) by smtp2-g19.free.fr (Postfix) with ESMTP id 148258B22 for ; Tue, 6 Sep 2005 00:56:28 +0200 (CEST) Message-ID: <431CCD03.4080504@free.fr> Date: Tue, 06 Sep 2005 00:56:03 +0200 From: Gilles Dodinet User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: commons-user@jakarta.apache.org Subject: [jasper] compiling jsp in osgi context Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N hi- i'm trying to execute jsp in an osgi context with no luck as of today. i've embedded jetty as an osgi bundle and registered a BundleListener which registers installed bundles as webapp if they contain a web descriptor file. so far so good. it plays nice with simple html files. however i'm encountering troubles when it comes to jsp. generated servlets don't compile anything because javax.servlet.* classes are not found (please note that the transformation process is successfull). in the manifest i declare javax.servlet as Import-Package (most prolly this seems to cause the issue) and jetty, jasper and related dependencies as bundled libs. Also as jasper seems to require an urlclassloader i've come up with a (pretty simple) custom urlclassloader which delegates all calls to either the target bundle (i.e. the installed bundle which wraps the webapp) or the current bundle. jasper classes are succesfully loaded, but not the javax.servlet.* classes. googling about this using various criteria gives me in only three relevant results : 1/ embedded pagebox whose earlier version (2001) targets the same problematic as me. since it is released under lgpl i've tried to use it to match my specific needs, however it pretty quick became total hackery - 2000 lines src files not maintained since 2001 or so and they duplicate lot of services already provided by containers. 2/ a thread on oscar user list with no anwer 3/ a wiki page (entitled 'Tomcat as osgi bundles' and hosted on safehaus - with just a listing of bundles i'm unable to find) so i thought i could ask here if someone came to a solution to this problem. Has it already be done yet ? below are the relevant manifest entries and webapp registration code. the target bundle as no Import-Package and no classes (just the simplest hello world). webapp registration [1] assigns the currentThead contextClassLoader to the simple delegating classloader discussed above - needed to start the webapp, and [2] sets the WebApplicationContext ClassLoader to the exact same ClassLoader - which i thought would have provided javax.servlet.* classes. this may not be the best list for this question (should i rather ask on jetty or triplesec user lists ?), anyway thanks for any input. Import-Package: org.osgi.service.http,javax.servlet, javax.servlet.http,org.osgi.framework,net.joss.utils Bundle-Classpath: ., org.mortbay.jetty-5.1.4.jar, commons-logging-1.0.4.jar, servlet-api-2.4.jar, xerces-2.4.0.jar, xmlParserAPIs-2.6.2.jar, xml-apis-2.0.2.jar, jsp-api-2.0.jar, jasper-compiler-5.5.9.jar, jasper-runtime-5.5.9.jar, commons-el-1.0.jar, ant-1.6.2.jar class JettyWrapper { public void createApplication(final String appName, final File app, final Bundle fromBundle) { Thread thread = new Thread() { public void run() { try { ClassLoader loader = new DelegatingClassLoader( fromBundle, this.getClass().getClassLoader()); Thread.currentThread().setContextClassLoader(loader); [1] String location = app.getAbsolutePath(); WebApplicationContext context = jetty.addWebApplication("/" + appName, location); context.setClassLoader(loader); [2] ... context.start(); } catch (Exception e) { LOG.error("Unable to start '" + appName + "' context", e); } } }; thread.start(); } } -- gd --------------------------------------------------------------------- To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org