문제

We have a huge EAR application with about 20 ejb-jar and war modules.

For each war module that Mojarra starts, it seems it is trying to scan annotation on every other war. Other wars are unavailable to the classloader, so I get lot of exceptions. It eventually starts anyway, but it clutters my logs with warnings, and I guess application startup time could be much less without this (+100 seconds).

To make it clear, I have following structure:

EAR
+- ejb1
+- ejb2
+- war1
+- war2

When Mojarra starts war1, it complains about missing classes from war2 (ClassNotFoundException).

I saw this when upgrading to Glassfish 3.1 (and thus, Mojarra 2.1).

도움이 되었습니까?

해결책

I found the reason, and some workaround.

On Glassfish 3.1, which ships with Mojarra 2.1, classpath scanning is delegated to Glassfish. Now, Glassfish seems to give all classes of ear file instead of war. I opened http://java.net/jira/browse/JAVASERVERFACES-1995 for that (but it really seems to be a Glassfish bug, not JSF/Mojarra).

While waiting for a fix, I patched Mojarra like this : in com.sun.faces.config.ConfigManager.java, around line 834, I commented out some lines:

//            if (provider instanceof DelegatingAnnotationProvider &&
//                null != annotationScanner) {
//                // This InjectionProvider is capable of annotation scanning *and*
//                // injection.
//                ((DelegatingAnnotationProvider)provider).setAnnotationScanner(annotationScanner,
//                        metadataGetter.getJarNames());
//                scanUris = Collections.emptySet();
//            } else {
                // This InjectionProvider is capable of annotation scanning only
                scanUris = metadataGetter.getAnnotationScanURIs();
//            }

The logs are now much less verbose. It seems Glassfish is still scanning every classes, so I still get warnings like this:

[#|2011-03-18T13:47:05.019+0100|WARNING|oracle-glassfish3.1|javax.enterprise.system.container.web.org.glassfish.web.loader|_ThreadID=57;_ThreadName=Thread-1;|WEB9052: Unable to load class org.apache.myfaces.custom.inputTextHelp.HtmlTextHelpRenderer, reason: java.lang.ClassNotFoundException: org.apache.myfaces.custom.inputTextHelp.HtmlTextHelpRenderer|#]

But no stacktrace from Mojarra, which is already quite less verbose.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top