ballerina-platform / ballerina-lang

The Ballerina Programming Language
https://ballerina.io/
Apache License 2.0
3.66k stars 751 forks source link

[Bug]: Ballerina Java Debug (BAL_JAVA_DEBUG) is not working with Windows 11 #41284

Open SachinAkash01 opened 1 year ago

SachinAkash01 commented 1 year ago

Description

I wrote a simple http service using ballerina to send a post request and generate OpenAPI specification. I wanted to debug my code using java debug.

Operating System: Windows 11 Pro.

After setting up environment variable, and running the OpenAPI command I got the following error. e.g: $env:BAL_JAVA_DEBUG = '5005' bal openapi -i \main.bal

ERROR: JDWP unable to get necessary JVMTI capabilities.

I fixed this issue by replacing the JAVA_OPTS value in bal.bat file locally into the value given for Command line arguments for remote JVM in the IntelliJ IDEA. Then it worked fine.

replaced this: set JAVA_OPTS=-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=%BAL_JAVA_DEBUG%

with this: set JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005

anupama-pathirage commented 1 year ago

@NipunaRanasinghe FYA