WS 7.0 seemingly not honoring <class-loader delegate="false">

I have a JSF web application that I ship with MyFaces jars.

I have added a sun-web.xml file in WEB-INF telling the server not to delegate class loading to its parent classloader.

However, it seems that the server chooses to use the JSF implementation that comes with the server (lib/jsf-api.jar and lib/jsf-impl.jar).

Of course, the exact same application worked perfectly with WS 6.1 (but JSF was not included in the server distribution).

Is there something I am missing?

[503 byte] By [laurent.vauchera] at [2007-11-27 5:48:27]
# 1

[nobr]Here is a sample index.jsp I use to determine where my classes come from.

When I type something like "javax.faces.FactoryFinder" it finds the class in

Classloader: sun.misc.Launcher$AppClassLoader@1ba34f2

URL=jar:file:/C:/soft/SunWebServer7/lib/jsf-api.jar!/javax/faces/FactoryFinder. class

This is not what I expected, since I embedded an alternate JSF implementation in my web application.

Strangely enough, when I embed, say, ant in my webapp, it's the right class that is found, not the one in the lib/ directory on the server.

Does JSF have a special status?

<%@page contentType="text/html; charset=ISO-8859-1"%>

<%@page import="java.net.URL"%>

<%@page import="java.io.ByteArrayOutputStream"%>

<%@page import="java.io.PrintStream"%>

<html>

<head>

<title>Test Sun Server 7.0</title>

</head>

<body>

Only a static text.

<br>

<form>Resource:<input type="text" name="classname"></input><br>

<input type="submit"></input><br>

</form>

<%

String us = "<null>";

String c = "<null>";

try {

c = request.getParameter("classname");

Class cl = Class.forName(c);

out.println("Classloader: " + cl.getClassLoader() + "<br>");

String[] parts = c.split("\\.");

String small = parts[parts.length - 1];

URL u = cl.getResource(small + ".class");

us = u.toString();

} catch (Throwable t) {

ByteArrayOutputStream baos = new ByteArrayOutputStream(4096);

PrintStream o = new PrintStream(baos);

t.printStackTrace(o);

o.flush();

o.close();

us = baos.toString();

us = us.replaceAll("\\n", "<br>");

}

%>

<br>

<br>

CLASS=<%=c%><br>

URL=<%=us%><br>

</body>

</html>

[/nobr]

laurent.vauchera at 2007-7-12 15:33:57 > top of Java-index,Web & Directory Servers,Web Servers...
# 2
Yes. Regardless of the value of the delegate flag, JSF classes are always loaded from the server class path. This is true for all classes that are part of Java EE platform.
usabadaa at 2007-7-12 15:33:57 > top of Java-index,Web & Directory Servers,Web Servers...
# 3
Ouch! That's bad (for me)!Is it a requirement for compliant J2EE servers?It means that I can no longer develop an application compatible with a large selection of application servers, because they might not have JSF, or, worse, force me to use an implementation I don't
laurent.vauchera at 2007-7-12 15:33:57 > top of Java-index,Web & Directory Servers,Web Servers...