在托管模式下调试时,Eclipse无法启动/停止jboss eap

时间:2014-03-14 07:59:19

标签: jboss-arquillian

我能够调试jboss-eap 6.2,但我必须启动和停止服务器。 在eclipse下使用Kepler SR2(使用JBosstools)当我在调试模式下启动时,Junit测试会冻结显示控制台:

mars 14, 2014 8:45:15 AM org.jboss.as.arquillian.container.managed.ManagedDeployableContainer startInternal
INFO: Starting container with: ["C:\Program Files\Java\jdk1.7.0_25\bin\java", -Xdebug, -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y, -ea, -Djboss.home.dir=C:\_server\jboss-eap-6.2, -Dorg.jboss.boot.log.file=C:\_server\jboss-eap-6.2\standalone\log\boot.log, -Dlogging.configuration=file:/C:/_server/jboss-eap-6.2/standalone/configuration/logging.properties, -Djboss.bundles.dir=C:\_server\jboss-eap-6.2\bundles, -jar, C:\_server\jboss-eap-6.2\jboss-modules.jar, -mp, C:\_server\jboss-eap-6.2\modules, -jaxpmodule, javax.xml.jaxp-provider, org.jboss.as.standalone, -server-config, standalone.xml]
Listening for transport dt_socket at address: 8787

然后,如果我在eclispe下启动JBOss-eap,测试运行正常,并启用断点。 最后服务器没有停止,我必须手动停止

我做错了什么?

这是我的Aquillian conf(在windows7上工作):

<container qualifier="jboss" default="true">
        <configuration>
            <property name="jbossHome">C:\_server\jboss-eap-6.2</property>
            <property name="javaVmArguments">-Xdebug -agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y</property>
            <property name="javaHome">C:\Program Files\Java\jdk1.7.0_25</property>
        </configuration>
    </container>

这里是pom.xml,然后是paretn pom

<project>
<modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>ee6-parent-root</artifactId>
    <groupId>sopra.academy.jee6</groupId>
    <version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>ee6-parent-ejb-junit</artifactId>
<packaging>pom</packaging>

<repositories>
    <repository>
        <id>thirdparty-releases</id>
        <name>JBoss Thirdparty Releases</name>
        <url>https://repository.jboss.org/nexus/content/repositories/thirdparty-releases</url>
    </repository>
</repositories>


<dependencies>
    <dependency>
        <groupId>org.jboss.spec.javax.ejb</groupId>
        <artifactId>jboss-ejb-api_3.1_spec</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.enterprise</groupId>
        <artifactId>cdi-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate.javax.persistence</groupId>
        <artifactId>hibernate-jpa-2.0-api</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-validator</artifactId>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.junit</groupId>
        <artifactId>arquillian-junit-container</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.arquillian.protocol</groupId>
        <artifactId>arquillian-protocol-servlet</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.3-1100-jdbc4</version>
    </dependency>
    <dependency>
        <groupId>org.jboss.as</groupId>
        <artifactId>jboss-as-arquillian-container-managed</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.jboss.spec</groupId>
        <artifactId>jboss-javaee-6.0</artifactId>
        <version>1.0.0.Final</version>
        <type>pom</type>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>apache-xalan</groupId>
        <artifactId>serializer</artifactId>
        <version>j_2.7.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>

</project>

和父pom

<project >

<modelVersion>4.0.0</modelVersion>

<artifactId>ee6-parent-root</artifactId>
<groupId>sopra.academy.jee6</groupId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>


<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <version.jboss.maven.plugin>7.5.Final</version.jboss.maven.plugin>
    <version.jboss.bom>1.0.7.Final</version.jboss.bom>
    <version.jboss.as>7.2.0.Final</version.jboss.as>
    <version.ear.plugin>2.6</version.ear.plugin>
    <version.ejb.plugin>2.3</version.ejb.plugin>
    <version.surefire.plugin>2.10</version.surefire.plugin>
    <version.war.plugin>2.1.1</version.war.plugin>
    <maven.compiler.target>1.6</maven.compiler.target>
    <maven.compiler.source>1.6</maven.compiler.source>
</properties>

<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.jboss.bom</groupId>
            <artifactId>jboss-javaee-6.0-with-tools</artifactId>
            <version>${version.jboss.bom}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        <dependency>
            <groupId>org.jboss.bom</groupId>
            <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
            <version>${version.jboss.bom}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>${version.jboss.maven.plugin}</version>
                <inherited>true</inherited>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-ejb-plugin</artifactId>
                <version>${version.ejb.plugin}</version>
                <configuration>
                    <!-- Tell Maven we are using EJB 3.1 -->
                    <ejbVersion>3.1</ejbVersion>
                    <generateClient>true</generateClient>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
</project>

1 个答案:

答案 0 :(得分:5)

在调试模式下运行JUnit时,您正在有效地调试Arquillian的客户端代码。请记住,Arquillian在一个单独的JVM中启动容器(JBoss),因此要调试它,您需要使用Eclipse的远程Java应用程序调试工具将其附加到它。

您的arquillian.xml看起来不错,所以您需要做的就是:

转到调试配置,然后创建远程Java应用程序配置,选择相应的项目,选择标准(套接字连接)连接类型并使用端口 8787 (您在arquillian.xml中指定的那个)。

现在以调试模式启动测试,当您看到JBoss为Listening for transport dt_socket at address: 8787时,使用您之前创建的启动配置附加到它。

希望这有帮助。