简体   繁体   English

在 Intellij IDEA 中调试 jboss 应用程序

[英]Debug jboss app in Intellij idea

I am using intellij idea and jboss server .我正在使用intellij idea 和jboss server

When I run it it works fine but when I debug it it gives me:当我运行它时它工作正常但是当我调试它时它给了我:

ERROR: transport error 202: connect failed: Connection refused
ERROR: JDWP Transport dt_socket failed to initialize, TRANSPORT_INIT(510)
JDWP exit error AGENT_ERROR_TRANSPORT_INIT(197): No transports initialized [../../../src/share/back/debugInit.c:690]
FATAL ERROR in native method: JDWP No transports initialized, jvmtiError=AGENT_ERROR_TRANSPORT_INIT(197)
Disconnected from server

What is the problem?问题是什么?

If you're running on OS X Mountain Lion you could try popping -d64 into the VM options, that seemed to work for me.如果您在 OS X Mountain Lion 上运行,您可以尝试将 -d64 弹出到 VM 选项中,这似乎对我有用。 Not passing the variables, I think, will just prevent you from debugging.我认为,不传递变量只会阻止您进行调试。

For more information check here .欲了解更多信息,请查看此处

Make sure the jboss vm is running with the parameters Idea shows in Debug dialog - specifically the port number seems incorrect to me.确保 jboss vm 使用 Idea 在调试对话框中显示的参数运行 - 特别是端口号对我来说似乎不正确。

Unchecking the pass variables didn't work for me.取消选中传递变量对我不起作用。 What I ended up doing running the jBOSS separately and using 'Remote jBOSS' configuration in intelliJ.我最终分别运行 jBOSS 并在 intelliJ 中使用“远程 jBOSS”配置。

To make debugging work I ened up adding the following lines to the "standalone.sh"为了使调试工作,我最终在“standalone.sh”中添加了以下几行

DEBUG_JAVA_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,address=localhost:62307,suspend=n,server=y "
JAVA_OPTS="${DEBUG_JAVA_OPTS} $JAVA_OPTS"

The value of DEBUG_JAVA_OPTS has to be copy and pasted from IntelliJ dialog box. DEBUG_JAVA_OPTS 的值必须从 IntelliJ 对话框中复制和粘贴。 These lines have to be inserted into the script right after the place where script sets up "JAVA_OPTS"这些行必须在脚本设置“JAVA_OPTS”的位置之后插入到脚本中

Update:更新:

Looks like IDE generates a new port number for each project.看起来 IDE 为每个项目生成一个新的端口号。 So you have to edit the standalone.sh file every time you switch project.所以每次切换项目时都必须编辑standalone.sh 文件。 Hopefully somebody can suggest a fix for it.希望有人可以建议修复它。

Another option might be to comment out the 'if' statement in standalone.conf as below.另一种选择可能是注释掉standalone.conf 中的'if' 语句,如下所示。 Note the first $JAVA_OPTS is added (it is the one passed in from IntelliJ).请注意,添加了第一个 $JAVA_OPTS(它是从 IntelliJ 传入的)。 This way there is no need to remember to change the port number for every project.这样就无需记住为每个项目更改端口号。

#Specify options to pass to the Java VM.
#
#if [ "x$JAVA_OPTS" = "x" ]; then
   JAVA_OPTS="$JAVA_OPTS -Xms64m -Xmx512m -XX:MaxPermSize=256m -    Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000"
   JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
   JAVA_OPTS="$JAVA_OPTS -Djboss.server.default.config=standalone.xml"
#else
#echo "JAVA_OPTS already set in environment; overriding default settings with val ues: $JAVA_OPTS"
#fi

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM