如何使用远程调试功能获取对象的数据?

发布于 2024-08-01 19:26:53 字数 225 浏览 10 评论 0原文

我想知道如何使用类似于 Eclipse 的远程调试技术从远程对象(驻留在服务器上)获取数据? 我已经有了客户端代码,只想将其扩展以绑定(如果可能)到某个端口并从服务器获取数据。

老实说,我不想在服务器端使用任何特定的内容(即在服务器上创建额外的代码),因为服务器已经允许远程调试,并且我可以在 Eclipse 调试器视图中看到数据。

如果您能给我一些示例代码,那就更好了。 提前非常感谢。

I wonder how can I use similar to Eclipse's remote debugging technique to get the data from remote object (that reside on server)? I am already have the client code and just want to extend it to bind (if possible) to some port and get the data from the server.

Honestly I don't want to use anything specific on the server side (i.e. create an additional code on server) because server already allows remote debugging and I can see the data in Eclipse debugger view.

If you can point me to some sample code - that would be even better. Greatly appreciate in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

很快妥协 2024-08-08 19:26:53

阅读了 @Romam 对我的评论的回复后,我认为更好的解决方案是添加一个简单的服务器端远程监控接口,该接口响应客户端请求、收集相关对象数据并将其返回给客户端。 如果服务器端监控与 JMX 兼容,您甚至可能不需要实现任何客户端代码。

为此使用 JDPA 存在许多问题,包括:

  • 安全性:如果用户可以使用您的自定义客户端远程访问您的服务器,他们可能也可以使用常规远程调试器。 这使他们能够看到他们想要的任何状态,并且还可能远程更改状态。
  • 复杂性:从客户端驱动 JDPA 协议很可能不是一件简单的事情。
  • 脆弱性:除非我弄错了,否则您的客户端将需要对服务器端代码库的类名称、成员名称和成员类型进行硬编码(例如在字符串中)知识。 如果您更改服务器端对象的实现细节,您的 JDPA 代码很可能会崩溃。

Having read the @Romam's response to my comment, I think a better solution would be to add a simple server-side remote monitoring interface that responded to a client request, gathered the relevant object data, and returned it to the client. If the server side monitoring was compatible with JMX, you may not even need to implement any client code.

There are a number of problem with using JDPA for this, including:

  • Security: if the user can use your custom client to remote access your server, they can probably also use a regular remote debugger. That allows them to see any state they want to, and possibly remotely change state as well.
  • Complexity: driving the JDPA protocol from the client side is most likely not a simple thing to do.
  • Fragility: unless I'm very mistaken, your client will need to have hard-coded (e.g. in Strings) knowledge of class names, member names and member types for the server-side codebase. If you change implementation details of your server-side objects, your JDPA code may well break.
森林迷了鹿 2024-08-08 19:26:53

我怀疑您会在这里找到您需要的内容:

http:// /www.j2ee.me/j2se/1.3/docs/guide/jpda/architecture.html

并且您需要实现所谓的“前端”,它“实现高级 Java 调试接口” '。

I suspect you'll find what you need here:

http://www.j2ee.me/j2se/1.3/docs/guide/jpda/architecture.html

And that you need to implement what if referred to as the 'front end' which 'implements the high-level Java Debug Interface'.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文