tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Mazzocchi <stef...@apache.org>
Subject Re: WEB-INF classloading and on the fly compilation
Date Thu, 14 Sep 2000 17:40:10 GMT
cmanolache@yahoo.com wrote:
> 
> :-)
> 
> > Just imagine that this thing we have to compile DEPENDS on another JAR
> > included in our little web-app (maybe a set of utility classes, maybe
> > whatever, I have the classes somewhere in the WEB-APP).
> 
> AFAIK jasper is passing CLASSPATH explicitely ( using -classpath
> parameter). I don't know what's wrong with javac ( or if something is
> wrong at all - after all we are doing a hack to load javac, I don't think
> there is any documentation saying that calling sun.tools.javac.Main is
> supposed to work ). Same for Ant - it creates a -classpath argument.
> 
> Since you may want to support jikes and out-of-process compilation (with
> exec ) I think you'll have to pass the class path explicitely.
> 
> Of course, it is not possible from a "standard" servlet to do that - since
> the classpath is not available in any standard way. Tomcat provides an
> attribute for that in order to hack jasper in.
> 
> You could also find the webapp root ( getRealPath("/") ) and compute the
> classpath yourself - but I would say this is worse, since you'll rely on a
> run-time directory structure that may not exist ( again, war file format
> is a deployment format, not a run-time format ).

This works _ONLY_ if classloading is performed thru files... what
happens if I have a NetworkClassLoader a JDBCClassLoader or a
OnTheFlyAssembledClassLoader? no compiler existing today (I just checked
ALL the existing java compiler I could find!) would be able to compile
against classes loaded thru a classloader.

And I think that considering classloading equivalent to classpath is THE
major usability problem that Java faces today.

Pier and I are working on providing a big Cocoon.war file that includes
everything, ranging from a database to a compiler... so you don't go
shopping for tons of jar, but you just drop  the WAR on the webapp
folder and you're done. Period.

The WAR packages were created for that right? Good, but this idea is
broken by the fact that all existing java compilers assume that classes
are loaded from disk.

Damn, now I need to write a java compiler :(

-- 
Stefano Mazzocchi      One must still have chaos in oneself to be
                          able to give birth to a dancing star.
<stefano@apache.org>                             Friedrich Nietzsche
--------------------------------------------------------------------
 Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------



Mime
View raw message