远程调试在Glassfish中运行的Java Web应用程序

编程入门 行业动态 更新时间:2024-10-10 21:31:44
本文介绍了远程调试在Glassfish中运行的Java Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个网络应用程序。它目前部署在Glassfish实例中的远程服务器上。是否有可能使用Netbeans远程连接到服务器并调试应用程序(就像我正常的Java应用程序一样)?

如果有人已经这样做并且可以提供洞察力或可以指向我一个指导,这将是伟大的。

我知道这个功能存在与Visual Studio和ASP.Net。我不确定是否有Java等价物。

我在网上看到的大多数示例都是针对只在远程计算机上运行或调试Glassfish应用程序的应用程序运行在本地机器上。

解决方案

是的,这是可能的。

在调试模式下运行GlassFish后,请转到NetBeans中的调试菜单,然后单击附加调试器... ,这会调出附加对话框。调试器:Java调试器(JPDA)

blockquote>

连接器:SocketAttach

传输:dt_socket $ b 主机:hostname_or_ip_address

端口:9009

超时可能留空。在此对话框中单击确定时,您应该能够将NetBeans调试器连接到GlassFish。

请记住:

  • 远程服务器上的防火墙(以及中间的任何网关)应允许连接到调试器端口(在本例中为9009)。
  • 确保您使用的是匹配的端口号。在GlassFish管理控制台中,通常位于: http:// localhost:4848
  • 展开配置。
  • 展开 server-config (或者您正在使用的服务器) li>点击 JVM设置。
  • 检查调试选项 strong>包含:

    -Xdebug -Xrunjdwp:transport = dt_socket,server = y,suspend = n,address = 9009
  • 阅读 JPDA文档,您可以使用其他选项。

    I have a web application. It is currently deployed on a remote server in a Glassfish instance. Is it possible to remotely connect to the server and debug the application (like I would a normal java application) using Netbeans?

    If someone has done this and could provide insight or could point me to a guide, that would be great.

    I know this functionality exists with Visual Studio and ASP.Net. I was not sure if there is a java equivalent.

    Most examples that I have seen online are for applications that are simply running on a remote machine or for debugging a Glassfish application running on the local machine.

    解决方案

    Yes, it is possible.

    Once you have GlassFish running in debug mode, go to the Debug menu in NetBeans and click on Attach Debugger..., which brings up the Attach dialog. You'll probably go with something like:

    Debugger: Java Debugger (JPDA)

    Connector: SocketAttach

    Transport: dt_socket

    Host: hostname_or_ip_address

    Port: 9009

    Timeout may be left blank. When you click OK on this dialog, you should be able to connect your NetBeans debugger to GlassFish.

    Remember:

  • The firewall on your remote server (and any gateways in between) should allow connections to the debugger port (9009 in my example).
  • Make sure you're using matching port numbers. In the GlassFish admin console, usually at: localhost:4848
  • Expand Configurations.
  • Expand server-config (or whichever you are using).
  • Click JVM Settings.
  • Check Debug to Enabled.
  • Verify that Debug Options contains:

    -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9009

  • Read the JPDA docs for other options you can use.

    更多推荐

    远程调试在Glassfish中运行的Java Web应用程序

    本文发布于:2023-11-25 06:01:03,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:应用程序   Glassfish   Java   Web

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!