简体   繁体   English

SAP Cloud Foundry中的远程调试

[英]Remote Debugging in SAP Cloud Foundry

I am wondering how to remote debug a S4SDK/Spring 2.0.6 Java Application deployed in SAP Cloud Foundry. 我想知道如何远程调试在SAP Cloud Foundry中部署的S4SDK / Spring 2.0.6 Java应用程序。

I am using Eclipse (Spring Tool Suite) and started the app in Debug Mode. 我正在使用Eclipse(Spring工具套件),并在调试模式下启动了该应用程序。 The application will be restarted with the following environment variable: -Dspring.devtools.remote.secret=secret -Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n,address=47822 应用程序将使用以下环境变量重新启动:-Dspring.devtools.remote.secret = secret -Xdebug -Xrunjdwp:server = y,transport = dt_socket,suspend = n,address = 47822

The console output shows, that after startup an SSH tunnel has automatically been created successfully (as a prerequisite I have enabled SSH using cf enable-ssh). 控制台输出显示,启动后会自动成功创建SSH隧道(作为前提,我已使用cf enable-ssh启用了SSH)。 and 'Successful remote access by 10.0.136.5:34858'. 和“通过10.0.136.5:34858成功进行远程访问”。

After a few seconds, eclipse shows the message "Failed to connect to remote VM". 几秒钟后,eclipse会显示消息“无法连接到远程VM”。

How to enable remote debugging? 如何启用远程调试?

This depends a bit on the buildpack you are using (see this link ). 这取决于您使用的buildpack(请参阅此链接 )。

For the sap_java_buildpack you need to do the following: 对于sap_java_buildpack您需要执行以下操作:

  1. Run the jvmmon in your CF container: 在您的CF容器中运行jvmmon
     cf ssh <app name> -c "app/META-INF/.sap_java_buildpack/sapjvm/bin/jvmmon" 
  2. In the opened CLI enter start debugging . 在打开的CLI中输入start debugging

  3. (Optional) Enter print debugging information to verify that debugging is enabled. (可选)输入print debugging information以确认已启用调试。

  4. Exit the CLI with q . 使用q退出CLI。

  5. To open the ssh tunnel enter cf ssh <app name> -N -T -L 8000:127.0.0.1:8000 . 要打开ssh隧道,请输入cf ssh <app name> -N -T -L 8000:127.0.0.1:8000

  6. With that you can connect to your application via localhost:8000 by the usual means of your IDE. 这样,您可以使用IDE的常规方法通过localhost:8000连接到您的应用程序。

As I have no experience with remote debugging in Eclipse I cannot help you with that part, in IDEA there is a special "Remote" Configuration where you can add the remote URL, so localhost:8000 in this case. 由于我没有在Eclipse中进行远程调试的经验,因此我无法为您提供帮助,因此在IDEA中有一个特殊的“远程”配置,您可以在其中添加远程URL,因此本例中为localhost:8000

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

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