Debugging with Arquillian in IntelliJ - Managed Co

2020-06-06 04:44发布

I've tried many times to debug a Test in managed container enviroment.

I get errors like JDWP Transport Error, socket failed to initialize. Means I can not initialize arquillian with the below property tag.

My arquillian.xml file looks like this:

<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<engine>
<property name="deploymentExportPath">target/arq.deployments</property>
</engine>

<container qualifier="jboss" default="true">
<protocol type="jmx-as7">
<property name="executionType">MANAGED</property>
</protocol>
<configuration>
<property name="javaVmArguments">-Xrunjdwp:transport=dt_socket,address=55407,server=y,suspend=y -Xmx512m -XX:MaxPermSize=128m</property>
</configuration>
</container>
</arquillian>

Am I missing something?

Screenshot

1条回答
我命由我不由天
2楼-- · 2020-06-06 05:12

There are 3 JVM running in this case. So this is a special debug case.

  1. 1st JVM-> Started by Arquillian/Junit to perform the tests.
  2. 2nd JVM-> Started by Arquillian to run managed Jboss.
  3. 3rd JVM-> It's a remote debugging configuration that must be ported to JVM number 2 in order to debug 2nd JVM. Check out this blog

So this is the idea, Run test (2nd JVM will be suspended until a JVM is attached to it), then run a new remote configuration, as soon as this starts, the past JVM will run.

It's a bit confusing but works.

Note that if you only have 2 JVM in simple debug mode, you will be debugging arquillian/junit JVM, which is not the one you are interested.

enter image description here

查看更多
登录 后发表回答