简体   繁体   English

Java applet无法与applet的远程调试一起使用

[英]Java applets doesnt not working with Remote debugging of applet

I have trying to use remote debugging for Java applets. 我试图对Java小程序使用远程调试。 I m using Java 7 update 51 and when i try to load the applets this is displyed in the java console and then it is struck. 我正在使用Java 7 update 51,当我尝试加载小程序时,将其显示在Java控制台中,然后将其删除。

network: Connecting http://domain.com/useradmin3.gif with proxy=DIRECT
network: Connecting http://domain.com/ with proxy=DIRECT
preloader: Stop progressCheck thread

I have passed the following as runtime parameters in the Javacpl: "-Djava.compiler=NONE -Xnoagent -Xdebug -Xrunjdwp:transport=dt_socket,address=8007,server=y,suspend=n" 我在Javacpl中将以下参数作为运行时参数传递:“ -Djava.compiler = NONE -Xnoagent -Xdebug -Xrunjdwp:transport = dt_socket,地址= 8007,服务器= y,暂挂= n

Biscuit maybe you are missing some compiler flags (like "lines,vars,source") to allow remote debugging. 饼干也许您缺少一些允许远程调试的编译器标志(如“ lines,vars,source”)。

For example, is you are using Ant you need to add this lines to your javac: 例如,如果您正在使用Ant,则需要将此行添加到javac中:

<!-- Javac lines, vars, source compiler flags -->
<javac srcdir="..." destdir="..." classpathref="..." debug="true" debuglevel="lines,vars,source" />

Then in your execution script you jave to add: 然后在执行脚本中添加以下内容:

<!-- debug configurations: modify the port you want-->
<jvmarg value="-Xdebug"/>
<jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4060"/>

On the other hand, if you are using Maven same flags can be added in the , like this: 另一方面,如果您使用的是Maven,则可以在中添加相同的标志,如下所示:

<build>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>2.0.2</version>
      <configuration>
        <!-- Necessary in order for the debug levels to be considered-->
        <debug>true</debug>
        <debugLevel>lines,vars,source</debugLevel>
      </configuration>
    </plugin>
  </plugins>
</build>

In case of using Jetty, same as before... you need to have the following variable: 如果使用Jetty,则与以前相同...您需要具有以下变量:

export MAVEN_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n"

On the other hand, what you can check is setting the suspend flag to "yes", it is " suspend=y ". 另一方面,您可以检查的是将suspend标志设置为“ yes”,即“ suspend = y ”。 This won't start your app unless you connect a debugger to your port. 除非您将调试器连接到端口,否则这不会启动您的应用程序。

Here you can check specific info about jboss: 在这里您可以查看有关jboss的特定信息:

http://webdev.apl.jhu.edu/~jcs/ejava-javaee/coursedocs/605-784-site/docs/content/html/devenv-jboss-setup.html#enable-jboss-debug http://webdev.apl.jhu.edu/~jcs/ejava-javaee/coursedocs/605-784-site/docs/content/html/devenv-jboss-setup.html#enable-jboss-debug

And always check stoping your firewall. 并始终检查停止防火墙。 In case of iptables, you can execute the following command: 对于iptables,可以执行以下命令:

service iptables stop

Oh, an another thing you can try is checking if your port is currently used by another process: 哦,您可以尝试的另一件事是检查端口当前是否被其他进程使用:

In windows:
netstat -nab

Linux:
netstat -nap

Hope to help. 希望对您有所帮助。

I did figure out the casue for this issue. 我确实找到了解决此问题的方法。 I have a page which contains multiple applets. 我有一个包含多个小程序的页面。 And i have set the Java params for remote debugging. 而且我已经为远程调试设置了Java参数。 Whenever i load the page, it loads two JVMs for the page which i am not sure why. 每当我加载页面时,它都会为页面加载两个JVM,但我不确定为什么。 So for the first JVM it uses the port no. 因此,对于第一个JVM,它使用端口号。 mentioned for listening. 提到听。 But for the second JVM, the same port no. 但是对于第二个JVM,相同的端口号。 is supposed to be used as the Java params are defined globally. 应该用作Java参数,因为它们是全局定义的。 So the second JVM gets hangs while waiting for the port to get free. 因此,第二个JVM在等待端口释放时挂起。

I did come up with a workaround for this problem and let me know if anyone need it. 我确实提出了解决此问题的方法,并让我知道是否有人需要它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM