【问题标题】:Arquillian WildFly 9 remote debuggerArquillian WildFly 9 远程调试器
【发布时间】:2023-03-14 17:14:01
【问题描述】:

我想针对 Java EE 7 组件运行一些测试。我读了一些关于 Arquillian 的文章,它似乎非常适合这类问题。不过我的配置有问题。我设法让它在嵌入式 GlassFish、托管 WildFly 和远程 WildFly 上运行。理想情况下,我想使用后一个选项进行测试,因为 WildFly 是我为应用程序选择的应用服务器,远程模式将使用正在运行的服务器,而不是每次我想运行测试时都启动它。不过,我很难将调试器附加到 WildFly 9。

我取消了standalone.conf.bat 中的注释:

set "JAVA_OPTS=%JAVA_OPTS% -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n"

并将以下部分添加到 arquillian.xml:

<engine>
    <property name="deploymentExportPath">target/</property>
</engine>
<container qualifier="wildfly" default="true">
    <protocol type="jmx-as7">
        <property name="executionType">REMOTE</property>
    </protocol>
    <configuration>
        <property name="javaVmArguments">-Xmx512m -XX:MaxPermSize=128m -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8787</property>
    </configuration>
</container>

测试本身执行正确(我可以看到正确的测试结果,WildFly 控制台按预期显示部署和控制台输出)。但是调试器仍然不会在断点处停止。我从 Intellij Idea 开始,将其作为常规的 JUnit 测试。这是我在每次测试开始时收到的警告:

WARNING: Configuration contain properties not supported by the backing object org.jboss.as.arquillian.container.remote.RemoteContainerConfiguration
Unused property entries: {javaVmArguments=-Xmx512m -XX:MaxPermSize=128m -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8787}
Supported property names: [managementAddress, password, managementPort, managementProtocol, username]
    enter code here

我在这里做错了什么?

【问题讨论】:

    标签: debugging intellij-idea wildfly jboss-arquillian wildfly-9


    【解决方案1】:

    您需要连接到 wildfly 作为远程服务来执行调试器。调试测试选项将仅调试测试的客户端,而不是服务器端执行。

    这些说明应该可以帮助您建立联系。 https://www.jetbrains.com/idea/help/run-debug-configuration-remote.html

    我发现在此设置中最好使用远程服务器,因为您可以在启动时连接调试器,而不必将其作为测试执行的一部分进行计时。

    【讨论】:

    • 谢谢你的作品。我进行了远程配置以首先连接到调试器,然后当我在调试模式下运行测试时,调试器在断点处停止。非常感谢
    猜你喜欢
    • 1970-01-01
    • 2014-11-12
    • 2016-03-17
    • 2014-07-25
    • 2023-04-06
    • 2016-09-27
    • 2018-04-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多