1 2 Previous Next 25 Replies Latest reply on Sep 22, 2010 3:05 PM by heiko.braun Go to original post
      • 15. Re: Guice provisioning error on JBoss 6 M4
        cbrock

        Well, I certainly can't reproduce it locally.  But it definitely looks like it's some sort of problem with the Reflections library.  The root of the failure is a NullPointerException at ServiceProcessor.java:64

         

         

                final Set<Class<?>> services = reflections.getTypesAnnotatedWithExcluding(Service.class, MetaDataScanner.CLIENT_PKG_REGEX);
                for (Class<?> loadClass : services) {
                    Object svc = null;
                    String svcName = loadClass.getAnnotation(Service.class).value(); // NPE HERE!
        
        
        

         

        Would you be able to get the sources and wire up your debugger to break on that line?

         

        Surely loadClass can't be null, unless there's a serious bug in the reflections library.  So I'm thinking that getAnnotation(Service.class) is returning null in your case, which equally doesn't make sense, unless there's a classloading problem between the version of the Service class loaded by reflections and the one being used in the servlet container at that point.

         

        You should be able to use the debuggers expression entry to test that theory, though.

        • 16. Re: Guice provisioning error on JBoss 6 M4
          heiko.braun

          The services Set is actually an ImmutableSet that doesn't allow null values. I have to agree with Mike, it doesn't make much sense.

          But if you debug that piece of code, we'll find out what's going on. Unfortunately, neither me nor Mike can reproduce it locally.

          • 17. Re: Guice provisioning error on JBoss 6 M4
            heiko.braun

            I did just check, the MetaDataScanner uses the ThreadContextClassloader to load the classes.

            • 18. Re: Guice provisioning error on JBoss 6 M4
              heiko.braun

              Mike said:

               

               

              unless there's a classloading problem between the version of the Service class loaded by reflections and the one being used in the servlet container at that point.

               

               

              The reflection library doesn't hold a reference to the classes. It merely stores the classnames (string literals). The call to

               

              'reflections.getTypesAnnotatedWithExcluding(Service.class, MetaDataScanner.CLIENT_PKG_REGEX);' 

               

              actually loads the classes the first time.

              So there cannot be a mismatch between classloaders.

              • 19. Re: Guice provisioning error on JBoss 6 M4
                jhutton

                Alright, I don't know what the problem was, but it seems to be working after some fiddling. I ran an archetype app with the NetBeans debugger and deploying to Glassfish with a breakpoint on String svcName = loadClass.getAnnotation(Service.class).value(). It said the value for the annotations member of loadClass was null; I ran it a couple times. Then I added some logging and changed the code slightly to be able to break on both methods in the line, I rebuild errai, started the app with the debugger again, and presto! It showed a 1 element set on annotations. So I ran the app again in normal mode, deploying to Glassfish and no problems. Then I tried in JBoss 6M4 and it worked there as well.

                 

                I guess it could have been stale libs in my local mvn repo? I'll try later tonight at home with the other system I tested on and see if it's working there as well.

                 

                Jesse

                • 20. Re: Guice provisioning error on JBoss 6 M4
                  jhutton

                  Just did a little bit more testing. CR2 is working for me in my app as well as my quick start archetype test (both JBoss 6 M4 and Glassfish). I tested the quickstart archetype against CR1 and I do still see a provisioning error there. However it's not caused by the aformentioned NPE, but by "java.lang.IllegalStateException: can not modify the task manager once it's been initialized"...

                  • 21. Re: Guice provisioning error on JBoss 6 M4
                    jhutton

                    Heiko,

                     

                    Strangely enough, on the F13 system I'm testing on at home (64bit, Sun JDK 1.6.0_21), I'm still unable to resolve that NPE. I did 'rm -rf ~/.m2/repository/', rebuilt errai and the quicktype archetype multiple times, and the problem is still there. I didn't try hooking a debugger up to it. Maybe I'll try that tonight...

                     

                    Jesse

                     

                    Edit: corrected jdk version

                    • 22. Re: Guice provisioning error on JBoss 6 M4
                      heiko.braun

                      The task manager init problem has been fixed in CR2. Not the NPE. I still don't know what's causing it, but if you say it's only happening now on F13 (64bit, Sun JDK 1.6.0_21) then we are one step closer.

                      • 23. Re: Guice provisioning error on JBoss 6 M4
                        heiko.braun

                        I see that NPE now as well on my mac. Still no idea how this happens. Are you still suffering from it Jesse?

                        • 24. Re: Guice provisioning error on JBoss 6 M4
                          jhutton

                          I've been using Glassfish lately, and I haven't seen the problem on F12 or F13. I haven't tested with JBoss since my last post.

                          • 25. Re: Guice provisioning error on JBoss 6 M4
                            heiko.braun

                            What a nasty little bug. I finally figured it out: https://jira.jboss.org/browse/ERRAI-111

                             

                            We use javassist to scan the annotations in the first run, but then rely on the reflection API to read the annotation.

                            The second step silently returns null on that annotation query, if the annotation cannot be loaded. So it's actually a classloading issue.

                            See the JIRA for further details.

                            1 2 Previous Next