Andrea Aime ha scritto:
Justin Deoliveira ha scritto:
Ok, I've done some extensive testing me too, and confirmed that indeed
Jetty classloading is broken, what's worse, it's broken by design.
They decided to do their own stuff and not to call the parent classloader before loading with their own (classloading protocol violation).
Luckily, they left a variable you can set to get back the standard classloading behaviour, and it must be set in etc/jetty.xml:
<Call class="org.mortbay.jetty.webapp.WebAppContext" name="addWebApplications">
<Arg><Ref id="contexts"/></Arg>
<Arg><SystemProperty name="jetty.home" default="."/>/webapps</Arg>
<Arg><SystemProperty name="jetty.home" default="."/>/etc/webdefault.xml</Arg>
<Arg type="boolean">True</Arg> <!-- extract -->
<Arg type="boolean">True</Arg> <!-- parent priority class loading -->
</Call>
The latter "boolean" argument is false by default.
Unfortunately, it seems we're screwed anyways under jdk 1.4.2_12, and native jai components won't work anyways. There is a way to disable them using -Dcom.sun.media.imageio.disableCodecLib=true
when launching jetty.
I'll refer to this setting as DCL in the following.
Leaving out the case were you don't have native jai installed (this won't break anyways afaik), here is a brief summary:
+ tomcat 5.0.30 + j2sdk1.4.2_12 + native jai: works
+ tomcat 5.5.28 + j2sdk1.5.0_09 + native jai: works
* jetty 6.0.1 + j2sdk1.5.0_09 + native jai: sealing violation!
+ jetty 6.0.1 + cl fix + j2sdk1.5.0_09 + native jai: works
* jetty 6.0.1 + cl fix + j2sdk1.4.2_12 + native jai: codelib error!
+ jetty 6.0.1 + cl fix + DCL + j2sdk1.4.2_12 + native jai: works
* jboss 3.2.8 + j2sdk1.4.2_12 + native jai: codelib errror!
+ jboss 3.2.8 + DCL + j2sdk1.4.2_12 + native jai: works
+ jboss 3.2.8 + j2sdk1.5.0_09 + native jai: works
* jboss 4.0.5GA + j2sdk1.4.2_12 + native jai: codelib errror!
+ jboss 4.0.5GA + DCL + j2sdk1.4.2_12 + native jai: works
+ jboss 4.0.5GA + j2sdk1.5.0_09 + native jai: works
That is, 1.4.2 + codelib + webapp classloaders other than tomcat one -> boom!
I also tried out with jdk 1.4.2_13 but it does not make a difference.
I tried to test with resin too, but there are too many issues.
First the xml parsers, since they do impose their own, and our
xml config reader breaks, once that is fixed by changing our
web.xml, struts will break. I've opened GEOS-984 to track this.
So, in the end it seems we can solve the issue by either telling
people not to use jdk 1.4.2 or, if they have to, not to install
java image i/o native componentes (jai itself seems to be fine),
or to avoid playing with png images, or finally to set the -Dcom.sun.media.imageio.disableCodecLib=true property.
If we want to go an extra mile, we can check if jdk is 1.4,
if so, disable the codec lib by default unless people enabled
it explicitly (which people running tomcat will want to do).
Another minor issue is that even with DCL, the first time
we serve the mosaic the image is distorted, whilst subsequent requests
do work fine. This does not happen with jdk 1.5.
The story does not end here thought. Our binary release is still
broken, even when forcing jetty to behave, because doing so
trigger other problems, and struts ui won't start up.
Well, turns out most of these problems are there because we
have a ton of needless libraries in the main /lib, such as
spring, the db2 jdbc driver, jta and whatnot.
Everything works fine if the /lib is purged to have just the
jars a standard jetty distribution has:
23/03/2007 08.47 1.033.875 ant-1.6.4.jar
23/03/2007 08.47 112.341 commons-el-1.0.jar
23/03/2007 08.47 407.502 jasper-compiler-5.5.15.jar
23/03/2007 08.47 1.209.873 jasper-compiler-jdt-5.5.15.jar
23/03/2007 08.47 77.056 jasper-runtime-5.5.15.jar
23/03/2007 08.47 6.340 jcl104-over-slf4j-1.0.1.jar
23/03/2007 08.47 429.619 jetty-6.0.1.jar
23/03/2007 08.47 107.342 jetty-util-6.0.1.jar
23/03/2007 08.47 50.493 jsp-api-2.0.jar
23/03/2007 08.47 136.279 servlet-api-2.5-6.0.1.jar
23/03/2007 08.47 13.873 slf4j-simple-1.0.1.jar
23/03/2007 08.47 1.010.675 xercesImpl-2.6.2.jar
23/03/2007 08.47 124.724 xmlParserAPIs-2.6.2.jar
Well, this is it. We just have to decide how to deal with the
jdk 1.4.2 issues, and then we should be good to release.
Cheers
Andrea