This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 122631 - Nullpointer Exception
Summary: Nullpointer Exception
Status: RESOLVED DUPLICATE of bug 125645
Alias: None
Product: profiler
Classification: Unclassified
Component: Base (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@profiler
URL:
Keywords:
Depends on:
Blocks: 129874
  Show dependency tree
 
Reported: 2007-11-23 12:59 UTC by stefag
Modified: 2008-03-12 11:07 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description stefag 2007-11-23 12:59:03 UTC
Problem handling Proxy classes when using Annotations.
JBoss 4.2.1 and Sring

In ClassBytesLoader
Caused by: java.lang.NullPointerException
       at org.netbeans.lib.profiler.server.ClassBytesLoader.getClassFileBytes(ClassBytesLoader.java:72)
       at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:860)
       at java.lang.Class.getDeclaredConstructors0(Native Method)
       at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
       at java.lang.Class.getConstructor0(Class.java:2671)
       at java.lang.Class.getConstructor(Class.java:1629)
       at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:587)
       at sun.reflect.annotation.AnnotationParser.annotationForMap(AnnotationParser.java:239)
       at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:229)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
       at java.lang.Class.initAnnotationsIfNecessary(Class.java:3031)
       at java.lang.Class.getAnnotation(Class.java:2989)
       at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:112)
       at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
       at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
       at java.lang.Class.initAnnotationsIfNecessary(Class.java:3031)
       at java.lang.Class.getAnnotation(Class.java:2989)
       at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:112)
       at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
       at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
       at java.lang.Class.initAnnotationsIfNecessary(Class.java:3031)
       at java.lang.Class.getAnnotation(Class.java:2989)
       at sun.reflect.annotation.AnnotationType.<init>(AnnotationType.java:112)
       at sun.reflect.annotation.AnnotationType.getInstance(AnnotationType.java:66)
       at sun.reflect.annotation.AnnotationParser.parseAnnotation(AnnotationParser.java:202)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:69)
       at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:52)
       at java.lang.Class.initAnnotationsIfNecessary(Class.java:3031)
       at java.lang.Class.getAnnotation(Class.java:2989)
       at java.lang.Class.isAnnotationPresent(Class.java:3001)
       at org.hibernate.reflection.java.JavaAnnotationReader.isAnnotationPresent(JavaAnnotationReader.java:25)
       at org.hibernate.reflection.java.JavaXAnnotatedElement.isAnnotationPresent(JavaXAnnotatedElement.java:43)
       at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:240)
       at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1115)
       at org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:1233)
       at org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:154)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:869)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:183)
       at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:240)
       ... 159 more


I did a workaround by:
public static byte[] getClassFileBytes(String className)
   {
       URL classUrl;
       String proto;
       String resourceName = className.replace('.', '/') + ".class";
       classUrl = ClassLoader.getSystemResource(resourceName);
       if (classUrl == null) {
         System.err.println("***Profiler agent critical error: could not get .class file for class " + className + " 
in ClassBytesLoader.getClassFileBytes");
       return null;
       }
       proto = classUrl.getProtocol();
       if(proto == null)
       {
           System.err.println("***Profiler agent critical error: could not get .class file for class " + className + " 
in ClassBytesLoader.getClassFileBytes");
           return null;
       }
Comment 1 J Bachorik 2008-03-12 11:07:43 UTC

*** This issue has been marked as a duplicate of 125645 ***