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?
# 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]