commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Cooper <mfncoo...@gmail.com>
Subject Re: [jasper] compiling jsp in osgi context
Date Mon, 05 Sep 2005 23:14:51 GMT
I'm not sure I understand what the relationship is between what you're doing 
and Jakarta Commons, if there is one. Note that Jasper is part of the Tomcat 
project, so I would suggest asking over there.

--
Martin Cooper


On 9/5/05, Gilles Dodinet <rhill2@free.fr> wrote:
> 
> 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
> 
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message