开发者

Debugging Cactus Tests in Eclipse

开发者 https://www.devze.com 2023-01-31 12:16 出处:网络
Side note: This is inherited code, I didn\'t do any of the setup and am new to the project. I\'m trying to set up remote debugging in Eclipse for these unit tests that use Cactus. I\'ve read around a

Side note: This is inherited code, I didn't do any of the setup and am new to the project.

I'm trying to set up remote debugging in Eclipse for these unit tests that use Cactus. I've read around a bit (but I can't seem to find any REAL information how to set this up). Closest I've found is here (http://www.eclipse.org/webtools/community/tutorials/CactusInWTP/CactusInWTP.html), but it just says to Debug -> Debug on Server, but nowhere does it say where the debug port is set or anything, and I can't find anything on how to enable this, set it.

Just asking to see if anyone has set this up before, it would really help stepping through the code rather than just logging. The plugin (http://jakarta.apache.org/cactus/integration/eclipse/runner_plugin.html) Looks promising, but I also don't even know where to download it, it doesn't link to a location -.-

The project uses ant, cactus, and I'm using Eclipse. Thanks

EDIT Here is the target I'm using

<junit fork="no" forkmode="perTest" printsummary="yes" haltonfailure="no" haltonerror="no" failureproperty="tests.failed">
            <jvmarg value="-Xdebug" />
            <jvmarg value="-Xrunjdwp:transport=dt_socket,address=localhost:8005,server=y,suspend=y" />
            <format开发者_开发技巧ter type="xml" usefile="true" />
            <formatter type="plain" usefile="false" />
            <classpath>
                <pathelement location="${clover.jar}"/>
                <path refid="cactus.classpath.id" />
                <pathelement location="../ejb/src" />
            </classpath>
            <sysproperty key="cactus.contextURL" value="${cactus.contextURL}"/>
            <test name="com.test.AllTests" outfile="TESTS" />
        </junit>


Not that familiar w/ Cactus, but you should be able to use JPDA over JDWP. Simply put something like this in the JVM args (either in the Eclipse run config, the java cmd line, or however Cactus accepts its args for the JVM):

-agentlib:jdwp=transport=dt_socket,address=localhost:1234,server=y,suspend=y

(or use "-Xrunjdwp:" instead of "-agentlib:jdwp" if JRE version < 5)

Then wherever you start it, it will wait for you to connect. Then just create a new debug configuration in Eclipse as a Remote Java Application. Put the source that you expect to debug into the Source tab. Make sure the Connection Type is "Standard (Socket Attach)" and put localhost for the Host and 1234 for the Port. Then start that debug config and you should be good.

0

精彩评论

暂无评论...
验证码 换一张
取 消