2012-12-03 63 views
0

我正在爲JMeter開發插件,我想在運行時從Intellij IDEA連接到jmeter-server。 我已經加入到jmeter.bat以下字符串:如何使用JPDA調試jmeter-server?

set JVM_ARGS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=1099, suspend=n 

但是,當我嘗試連接,我收到以下錯誤:

Listening for transport dt_socket at address: 1099 
java.lang.NoClassDefFoundError: suspend=n 
Caused by: java.lang.ClassNotFoundException: suspend=n 
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202) 
    at java.security.AccessController.doPrivileged(Native Method) 
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306) 
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) 
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247) 
Could not find the main class: suspend=n. Program will exit. 
Exception in thread "main" errorlevel=1 

我JMeter的開始和JMeter的服務器同一臺機器,但爲jmeter-server指定端口。 你能解釋我,我做錯了什麼?

我試圖在JVM_ARGS刪除多餘的空間,因爲我被告知,但還是有錯誤:

Found ApacheJMeter_core.jar 
Listening for transport dt_socket at address: 1099 
Created remote object: UnicastServerRef [liveRef: [endpoint:[192.168.56.1:50900](local),objID:[-6928e8c:13b637ed53e:-7fff, 6493737834091623438]]] 
Problem creating registry: java.rmi.server.ExportException: Port already in use: 1099; nested exception is: 
    java.net.BindException: Address already in use: JVM_Bind 
Continuing... 
Server failed to start: java.rmi.RemoteException: Cannot start. See server log file.; nested exception is: 
    java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
    java.io.EOFException 
An error occurred: Cannot start. See server log file.; nested exception is: 
    java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: 
    java.io.EOFException 
Debugger failed to attach: timeout during handshake 

我缺少的東西?

回答

2

參數suspend之前有一個額外的空間,導致JVM將其解釋爲第一個非選項參數(即主類名稱)。

嘗試更換上面的一行:

set JVM_ARGS=-Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=1099,suspend=n 
+0

謝謝你,努諾,它的工作原理。請問您能否解釋下(如果可以的話)下一個參數的含義:服務器,傳輸,掛起? –

+0

您可以從JPDA的最新文檔[此處](http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/conninv.html)中找到所有這些參數的說明。 –

+0

謝謝,清楚。但是我仍然有一些連接問題,請問,請看看? –