2015-05-28 38 views
0

我正在嘗試使用JProfiler的離線配置API將Jprofiler 8.1.4與jenkins集成。 以下是寫入調用JProfiler時UnsatisfiedLinkError

  • 的程序啓動JProfiler錄製。
  • 保存快照。
  • 停止JProfiler錄製。

    import java.io.File; import java.io.IOException;

    public class TestJenJPIntegration {public static Connection connObj = null; 公共靜態無效recordCPUdata()產生java.io.IOException,InterruptedException的{

    File fileObj; 
        fileObj = new File("C:\\Perl\\firstSnap.jps"); 
        Controller.startCPURecording(true); 
          System.out.println("CPU recording started.."); 
    
           Controller.saveSnapshot(fileObj); 
        System.out.println("Saved snapshot"); 
    
           Controller.stopCPURecording(); 
        System.out.println("CPU recording stopped..");  
    
    } 
    
    public static void main(String[] args) throws IOException, InterruptedException { 
         try { 
    
         recordCPUdata(); 
        } catch (IOException e) { 
         e.printStackTrace(); 
        } 
    
    } 
    

    }

的JProfiler的工具的工作原理手動精細開始錄製,保存快照和停止錄製。但是當我執行程序時,出現以下錯誤消息UnsatisfiedLinkError:

  • 我使用了JProfiler本身提供的Demo Server Profiling。我在演示應用程序運行的同一個系統中進行性能分析。
  • 注意:服務器和客戶端使用相同的JProfilerTI.dll將這是一個問題。

java.lang.UnsatisfiedLinkError中:com.jprofiler.agent.InterceptionCallee.registerI nterceptions0(Z [LCOM/JProfiler的/劑/ util的/小時; Ljava /郎/反映/場; Ljava /郎/ Ljava/lang/reflect/Field; Ljava/lang/reflect/Field; Ljava/lang/refle ct/Field; Ljava/lang/reflect/Field; Ljava/lang/reflect/Field; Ljava/lang/reflect/Ljava/lang/reflect/Method; Ljava/la ng/reflect/Method;)V at com.jprofiler.agent.InterceptionCallee。 registerInterceptions0(Native Method) at com.jprofiler.agent.In terceptionCallee.registerInterceptions(EJT:152)

 at com.jprofiler.agent.probe.y.a(ejt:181) 
     at com.jprofiler.agent.probe.y.a(ejt:37) 
     at com.jprofiler.agent.Agent.initStatic(ejt:320) 
     at com.jprofiler.agent.Agent.<clinit>(ejt:98) 
     at com.jprofiler.agent.ControllerImpl.startCPURecording(ejt:53) 
     at com.jprofiler.api.agent.Controller.startCPURecording(ejt:108) 
     at TestJenJPIntegration.recordCPUdata(TestJenJPIntegration.java:24) 
     at TestJenJPIntegration.main(TestJenJPIntegration.java:45) 
JProfiler> Native library not found. Ignoring controller call. 

/用戶印結/

CPU recording started.. 

Exception in thread "_jprofiler_offline_comm" java.lang.UnsatisfiedLinkError: co 
m.jprofiler.agent.ControllerImpl.saveSnapshot0([BLjava/lang/Object;)V 
     at com.jprofiler.agent.ControllerImpl.saveSnapshot0(Native Method) 
     at com.jprofiler.agent.ControllerImpl.access$100(ejt:18) 
     at com.jprofiler.agent.h.run(ejt:186) 

/用戶印結/Saved snapshot

JProfiler> Native library not found. Ignoring controller call. 

/用戶印結/CPU recording stopped..

回答

0

com.jprofiler.api.platform不適用於離線分析,而是用於編寫直接分析分析數據的程序。您應該只使用Controller類,並通過與離線開關-agentpath VM參數通過集成嚮導

會話級>集成嚮導 - >新建遠程集成給出

+0

我的問題是我unble開始錄製使用Jprofiler的上述程序。 現在我試着在我的程序中加載System.loadLibrary,JVM崩潰了。在PC = 0x00000001800719bd,PID = 3844,T ID = 5352 # #JRE版本 #EXCEPTION_ACCESS_VIOLATION(0000005):Java(註冊商標)SE運行時環境 #已經由Java運行時環境中檢測到嚴重錯誤(7.0_60-b19)(build 1.7.0_60-b19) #無法寫入核心轉儲。在Windows的客戶端上,默認情況下未啓用小型轉儲程序。 任何解決方案? –

+0

您是否嘗試過集成嚮導?您不能使用loadLibrary,您必須傳遞集成嚮導 –

+0

給出的-agentpath VM參數否,Controller代碼必須在您的代碼中運行,而您無需手動加載JProfiler庫。沒有單獨的JProfiler進程,除非您的意思是JProfiler GUI與離線性能分析無關。 –