dev@glassfish.java.net

Re: pom.xml review request: integrate JSF 2.1.0-b10

From: Ed Burns <edward.burns_at_oracle.com>
Date: Thu, 6 Jan 2011 15:24:56 -0800

>>>>> On Thu, 6 Jan 2011 13:12:33 -0800, Ed Burns <edward.burns_at_oracle.com> said:

>>>>> On Thu, 06 Jan 2011 12:29:04 +0530, Sahoo <sanjeeb.sahoo_at_oracle.com> said:
SS> Ed,
SS> Have you also tested the hybrid (OSGi + JSF) apps with the new
SS> implementation?

EB> AHH! I just tried that and found a problem. Investigating now. I will
EB> likely have to compose a mail to the change control board.

Turns out it's not even that simple. I don't know how to fix the
problem, but I have traced it to a regression in our fix for
<http://java.net/jira/browse/GLASSFISH-11636>.

I re-opened the issue, attached an updated reproducer, and share this
analysis, included here for your convenience.

It is possible that either my fix for JAVASERVERFACES-1835 or
GLASSFISH-14430 is the related to this regression.

SECTION: steps to reproduce

I built GlassFish 3.1 from trunk source.

I replaced the jsf-api and jsf-impl jars with the 2.1.0-b10 versions
from <http://download.java.net/maven/2/com/sun/faces/>. This is the
very latest Mojarra, but it hasn't yet been integrated into GlassFish.

SECTION: Source Level Debugging Output

When I copy the attached war to autodeploy/bundles, like this,

cp maven-module-that-makes-wab/target/Test1-0.0.2.war /Users/edburns/Documents/JavaEE/workareas/glassfish31-1HEAD/distributions/glassfish/target-20110104-2228/stage/glassfish3/glassfish/domains/domain1/autodeploy/bundles

I see that this conditional

                    if (t.wasDefinedIn(uris)) {

never evaluates to true in the following method.

    static Map<Class<? extends Annotation>, Set<Class<? extends Object>>> scan(Collection<URI> uris, Types types, ClassLoader cl) {
        // can't use ServletContext here, because it is not yet available as this method is called
        // from WebModuleDecorator which is called when WebModule is being created.
        // hence this is a static method.
        Map<Class<? extends Annotation>, Set<Class<? extends Object>>> result =
                new HashMap<Class<? extends Annotation>, Set<Class<? extends Object>>>();
        Class<? extends Annotation>[] annotations = getAnnotationTypes();
        if (annotations == null) return result;
        int total = 0;
        for (Class<? extends Annotation> annotationType : annotations) {
            Type type = types.getBy(annotationType.getName());
            if (type instanceof AnnotationType) {
                Collection<AnnotatedElement> elements = ((AnnotationType) type).allAnnotatedTypes();
                for (AnnotatedElement element : elements) {
                    Type t = (element instanceof Member ? ((Member) element).getDeclaringType() : (Type) element);
                    if (t.wasDefinedIn(uris)) {
                        Set<Class<? extends Object>> classes = result.get(annotationType);
                        if (classes == null) {
                            classes = new HashSet<Class<? extends Object>>();
                            result.put(annotationType, classes);
                        }
                        try {
                            final Class<?> aClass = cl.loadClass(t.getName());
                            logger.info(aClass + " contains " + annotationType);
                            total++;
                            classes.add(aClass);
                        } catch (ClassNotFoundException e) {
                            logger.log(Level.WARNING, "Not able to load " + t.getName(), e);
                        }
                    }
                }
            }
        }
        logger.info("total number of classes with faces annotation = " + total); // TODO(Sahoo): change to finer
        return result;
    }

Here is the callstack when this method is called:

org.glassfish.osgiweb.OSGiFacesAnnotationScanner.scan(OSGiFacesAnnotationScanner.java:105)
org.glassfish.osgiweb.OSGiWebModuleDecorator.scanFacesAnnotations(OSGiWebModuleDecorator.java:182)
org.glassfish.osgiweb.OSGiWebModuleDecorator.populateFacesInformation(OSGiWebModuleDecorator.java:118)
org.glassfish.osgiweb.OSGiWebModuleDecorator.decorate(OSGiWebModuleDecorator.java:96)
com.sun.enterprise.web.EmbeddedWebContainer.createContext(EmbeddedWebContainer.java:237)
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1793)
com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1630)
com.sun.enterprise.web.WebApplication.start(WebApplication.java:100)
org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:147)
org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:109)
org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:63)
org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.run(JavaEEExtender.java:148)
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:680)

The value of the uris argument to scan() is:

"file:/private/var/folders/fd/fdBu1IQlHx4mfVLx-JeCoE%2B5mEs/-Tmp-/osgiapp3338035220037966483/WEB-INF/classes/"
"file:/private/var/folders/fd/fdBu1IQlHx4mfVLx-JeCoE%2B5mEs/-Tmp-/osgiapp3338035220037966483/WEB-INF/lib/Bundle267.jar"
"file:/private/var/folders/fd/fdBu1IQlHx4mfVLx-JeCoE%2B5mEs/-Tmp-/osgiapp3338035220037966483/WEB-INF/lib/bean-1.0.jar"
"file:/private/var/folders/fd/fdBu1IQlHx4mfVLx-JeCoE%2B5mEs/-Tmp-/osgiapp3338035220037966483/WEB-INF/lib/Bundle267.jar"
"file:/private/var/folders/fd/fdBu1IQlHx4mfVLx-JeCoE%2B5mEs/-Tmp-/osgiapp3338035220037966483/WEB-INF/lib/bean-1.0.jar"

Sahoo, can you please help me understand the problem? I am about to
attach the reproducer source maven project.

-- 
| edward.burns_at_oracle.com | office: +1 407 458 0017
| homepage:               | http://ridingthecrest.com/