开发者

Ant Freezes with no warning on exception

开发者 https://www.devze.com 2023-02-13 12:55 出处:网络
I have been experiencing a weird problem that I can\'t find a solution to. When I am running a project through ant and there\'s an uncaught exception, ant simply freezes with absolutely no error. Here

I have been experiencing a weird problem that I can't find a solution to. When I am running a project through ant and there's an uncaught exception, ant simply freezes with absolutely no error. Here is my build file. This is a multi threaded environment, also

    <fileset id="masterlibs" dir="${lib.dir}">
            <patternset>
                    <include name="*.jar"/>
            </patternset>
    </fileset>

    <target name="cle开发者_JAVA技巧an">
            <delete dir="${build.dir}"/>
    </target>
    <target name="init">
            <mkdir dir="${build.dir}"/>
    </target>
    <target name="compile" depends="init">
            <javac srcdir="${src.dir}" destdir="${build.dir}">
                    <classpath>
                            <pathelement location="${build.dir}"/>
                            <fileset refid="masterlibs"/>
                    </classpath>
            </javac>
    </target>

    <target name="run" depends="compile">
            <java classname="stockData.AlertHandler" fork="true">
                    <classpath>
                            <pathelement location="${build.dir}"/>
                            <fileset refid="masterlibs"/>
                    </classpath>
                    <arg line="true"/>
                    <arg line="true"/>
                    <arg line="true"/>
                    <arg line="true"/>
                    <arg line="false"/>
                    <arg line="27_4"/>

                    <arg line="false"/>
            </java>
    </target>


Ctrl+Break will show you a dump of threads and indicate what each is doing (plus any deadlocks). I'm guessing it's your spawned AlertHandler process and it may be easier to debug this outside the Ant environment.

If Ctrl+Break doesn't work (from the article)

On UNIX platforms you can send a signal to a program by using the kill command. This is the quit signal, which is handled by the JVM. For example, on Solaris you can use the command kill -QUIT process_id, where process_id is the process number of your Java program.


Ant can sometimes freeze when it runs a java class that asks for interactive input. Is it possible that your AlertData class asks for input?

0

精彩评论

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