2012-12-03 34 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

谢谢,清楚。但是我仍然有一些连接问题,请问,请看看? –