3 Replies Latest reply on Jun 23, 2010 8:17 AM by cayhorstmann

    Absent Code attribute in method

    cayhorstmann
      I am trying to put together a lab for a summer class where I foolishly
      agreed to use NetBeans 6.9, Glassfish 3.0.1 and CDI. I am getting the
      following error:
      java.lang.ClassFormatError: Absent Code attribute in method that is
      not native or abstract in class file com/horstmann/qq/beans/<error>
             at java.lang.ClassLoader.defineClass1(Native Method)
             at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
             at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
             at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
             at org.glassfish.web.loader.WebappClassLoader.findClass(WebappClassLoader.java:920)
             at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1430)
             at org.glassfish.weld.BeanDeploymentArchiveImpl.populate(BeanDeploymentArchiveImpl.java:192)
             at org.glassfish.weld.BeanDeploymentArchiveImpl.<init>(BeanDeploymentArchiveImpl.java:102)
             at org.glassfish.weld.DeploymentImpl.<init>(DeploymentImpl.java:118)
             at org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:315)
             at org.glassfish.weld.WeldDeployer.load(WeldDeployer.java:99)
             at org.glassfish.internal.data.ModuleInfo.load(ModuleInfo.java:175)
             at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:216)
             ...

      No, I have no idea what makes Weld unhappy. I did a bit of
      refactoring, and now I am hosed.

      This is with hot deployment inside NetBeans. When I deploy the WAR
      manually, the problem doesn't arise. Unfortunately, that's not an
      option for my lab.

      Did anyone run into this?

      Thanks,

      Cay
        • 1. Re: Absent Code attribute in method
          nickarls

          My un-educated guess is that you are including the EE-APIs and then NB is trying to run the application against them and not the actual implementations in the server. At least that is what some quick googling might suggest.

          • 2. Re: Absent Code attribute in method
            cayhorstmann

            I don't think it's that simple. NetBeans works fine for SOME CDI configurations, and what is failing now isn't very different from what was working a few hours earlier. So I don't think it's a general configuration issue.


            That crummy error message is very infuriating. Is there some way of cranking up the log level to find out in more detail what Weld is trying to achieve?

            • 3. Re: Absent Code attribute in method
              cayhorstmann
              It wasn't Weld's fault in the end. NetBeans sometimes generates files <error>.class, and naturally Weld isn't prepared for that kind of nonsense. I'll have to find out why NetBeans does this.