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 231027

Summary: profiler fails to profile oc4j.jar: 'Error: Agent JAR loaded but agent failed to initialize'
Product: profiler Reporter: Tomas Hurka <thurka>
Component: BaseAssignee: Tomas Hurka <thurka>
Status: RESOLVED FIXED    
Severity: normal Keywords: VISUALVM
Priority: P3    
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Tomas Hurka 2013-06-10 11:41:54 UTC
Trying to profile oc4j.jar with profiler gives the following error dialog: 

Error 
Agent JAR loaded but agent failed to initiali... 
OK 

The behaviour is identical, regardless if the 'CPU' or the 'Memory' profiling.
Profiler prints out the following exception message on the shell window: 

% /data/jdk1.8.0/bin/jvisualvm 
Exception in thread "Attach Listener" 12/10/11 13:23:39 java.lang.reflect.InvocationTargetException 
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
at java.lang.reflect.Method.invoke(Method.java:474) 
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:382) 
at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:407) 
Caused by: java.lang.NullPointerException 
at org.netbeans.lib.profiler.server.ProfilerActivate15.getArchiveFile(ProfilerActivate15.java:40) 
at org.netbeans.lib.profiler.server.ProfilerActivate15.activate(ProfilerActivate15.java:61) 
at org.netbeans.lib.profiler.server.ProfilerActivate15.agentmain(ProfilerActivate15.java:26) 
... 6 more 
Agent failed to start!
Comment 1 Tomas Hurka 2013-06-10 12:03:31 UTC
See also bugs reported against VisualVM: http://bugs.sun.com/view_bug.do?bug_id=8000752 and https://java.net/jira/browse/VISUALVM-545
Comment 2 Tomas Hurka 2013-06-11 13:04:35 UTC
Fixed in profiler-main

changeset:   255536:dab860cc8e66
user:        Tomas Hurka <thurka@netbeans.org>
date:        Tue Jun 11 15:01:23 2013 +0200
summary:     bugfix #231027, ugly workaround for OC4J - try to use context class loader if system class loader did not work
Comment 3 Quality Engineering 2013-06-12 02:04:15 UTC
Integrated into 'main-golden', will be available in build *201306112301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/dab860cc8e66
User: Tomas Hurka <thurka@netbeans.org>
Log: bugfix #231027, ugly workaround for OC4J - try to use context class loader if system class loader did not work