Migrating from EAP 4.3 to 5 causes slowness of Facelets class loading.
Issue
-
Migrating all our apps from JBoss Enterprise Application Platform (EAP) 4.3.0 to EAP 5.1.0.
-
Placed the facelets jar version 1.1.15.B1 shipped by JBoss under the JBoss built-in classpath
$EAP_HOME/server/$PROFILE/lib
.
- Access to a page in a Seam applicaiton takes a much longer time in EAP 5 than in EAP 4.3.
- The server.log shows that it takes about 34 secs render the facelets page:
08:01:32,632 FINE [viewhandler] Initialization Successful 08:01:32,632 FINE [viewhandler] Rendering View: /page0.xhtml 08:01:32,633 FINE [viewhandler] ActionId -> ViewId: /page0.xhtml -> /page0.xhtml 08:01:32,633 FINE [viewhandler] Building View: /page0.xhtml 08:01:32,634 FINE [factory] Resource-Url from external context: jndi:/localhost/myapp/page0.xhtml 08:01:32,634 FINE [factory] Creating Facelet for: jndi:/localhost/myapp/page0.xhtml 08:02:08,002 FINE [composition] /page0.xhtml @11,38 <ui:composition> found Define[body]
- Further investigation shows that the culprit lies in the following method which is triggered from within the facelet compiler initialization in
com.sun.facelets.util.Classpath
public static URL[] search(ClassLoader cl, String prefix, String suffix) throws IOException { Enumeration[] e = new Enumeration[] { cl.getResources(prefix), cl.getResources(prefix + "MANIFEST.MF") }; Set all = new LinkedHashSet(); URL url; URLConnection conn; JarFile jarFile; for (int i = 0, s = e.length; i < s; ++i) { while (e[i].hasMoreElements()) { url = (URL) e[i].nextElement(); conn = url.openConnection(); conn.setUseCaches(false); conn.setDefaultUseCaches(false); if (conn instanceof JarURLConnection) { jarFile = ((JarURLConnection) conn).getJarFile(); } else { jarFile = getAlternativeJarFile(url); } if (jarFile != null) { searchJar(cl, all, jarFile, prefix, suffix); } else { boolean searchDone = searchDir(all, new File(URLDecoder.decode(url.getFile(), "UTF-8")), suffix); if (!searchDone) { searchFromURL(all, prefix, suffix, url); } } } } URL[] urlArray = (URL[]) all.toArray(new URL[all.size()]); return urlArray; }
Classpath.search()
is called from com.sun.facelets.compiler.TagLibraryConfig.loadImplicit() with the following statement:
ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL[] urls = Classpath.search(cl, "META-INF/", SUFFIX); //SUFFIX is ".taglib.xml"
The execution time for the above method takes about 15 secs in EAP 5 whereas about 2 secs in EAP 4.3.
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 5.x
- Facelets****
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.