{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Hybrid /
avatar image
2

Cloud Code IDE Java Callout Debugging  

  • Export to PDF
ylesyuk created · Jan 22 at 01:48 PM · 67 Views · Dino-at-Google edited · Jan 22 at 07:20 PM

This community article describes the key steps that need to be done to remotely debug your Java Callout source that executes in a Kubernetes container.

The target audience are the Apigee Java Callout authors and users who need to troubleshoot a callout execution in context of a real proxy. Frequently (especially the second category) would know generic concepts behind remote debugging and can benefit from some tutorial on how this is done in a specific environment.

You can follow the following link for more detailed explanation and a complete step-by-step walkthrough using an example of JSON Sanitizer Apigee Java Callout

https://github.com/apigee/ahr/wiki/tadaa-cloud-code-apigee-hybrid-javacallout-debugging

It's still a good-old Remote JVM debugging

Of course, you can use Eclipse or VIM to do remote java debugging, but they need to be installed and connectivity needs to be taken cared. With CloudShell and Cloud Code it's already there. That also enables an ability to debug your Java Callout code in production deployments, especially when you cannot reproduce the problem on a development system.

In any case, we have to configure two items:

  • jvm-debug port that exposes container's remote debugging port;
  • JAVA_TOOL_OPTIONS environment variable that configures jvm remote debugging options.

Kubernetes Pod Configuration

1. Locate port: section and add three lines that patch the debug port 50005 for the apigee-runtime container name: apigee-runtime

        - containerPort: 50005
          name: jvm-debug
          protocol: TCP

2. Add container environment variable for container name: apigee-runtime at the containers:env: location

        - name: JAVA_TOOL_OPTIONS
          value: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=50005,quiet=y

Cloud Code Configuration

1. Select Cloud Code: Attach (Java) to k8s Pod

Attache Java K8s Pod

2. Edit the launch.json file to finetune a podSelector as follows:

      {
          "name": "Attach to Kubernetes Pod (Java)",
          "type": "cloudcode.kubernetes",
          "request": "attach",
          "language": "Java",
          "debugPort": 50005,
          "podSelector": {
              "debug": "apigee-runtime"
          }
      }

Set Breakpoint and Attach to the Pod

You are now ready to set a breakpoint in your source code; hit a request that would trigger the breakpoint and inspect the context.

Stop at breakpoint

Observe:

  • Call Stack;
  • Local Values;
  • etc...
thub.nodes.view.add-new-comment
java callouthybrid cloudremote debugging
Add comment Show 3
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Dino-at-Google ♦♦   · Jan 22 at 07:20 PM 0
Link

WOW, this is terrific Yuriy. Cool stuff ! This will be really useful.

avatar image Priyadarshi Ajitav Jena · Jan 23 at 07:19 AM 0
Link

Is this helpful in case of onprem ?

avatar image ylesyuk ♦ Priyadarshi Ajitav Jena · Jan 23 at 12:31 PM 0
Link

on-prem case is documented in this lab at the following link:

https://apigee.github.io/alfa/edge-dev-javacallout/#11

Article

Contributors

avatar image avatar image

Follow this article

49 People are following this .

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Navigation

Cloud Code IDE Java Callout Debugging

Related Articles

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges