dansomething / coc-java-debug Goto Github PK
View Code? Open in Web Editor NEWAn extension for coc.nvim to enable Java debugging via jdt.ls
Home Page: https://www.npmjs.com/package/coc-java-debug
License: Eclipse Public License 2.0
An extension for coc.nvim to enable Java debugging via jdt.ls
Home Page: https://www.npmjs.com/package/coc-java-debug
License: Eclipse Public License 2.0
Describe the issue
Hi,
Thanks for buiding this excellent extension to simplify our java debug in NVIM, I could have basic java debug in NVIM with limited configuration, cheers!!!
but i see java class hotswap function not working, is it not supported today?
I have set "let g:ycm_java_hotcodereplace_mode = 'always' as suggested from https://github.com/puremourning/vimspector#java
but it seems the java class cannot be hot-swapped in debug model.
See hotcodereplace message in vimspector log:
2022-03-26 20:54:50,921 - DEBUG - Message received: {'event': 'hotcodereplace', 'body': {'changeType': 'BUILD_COMPLETE', 'message': 'Build completed.', 'type': 'hotcodereplace'}, 'seq': 21, 'type': 'event'}
I'm using coc-java-debug under NeoVim 0.4.4.
Now I'd like to debug a few applications at the same time since they communicate with each other via API requests and/or queues. However it seems at the moment if I launch a new debugging session via CocCommand java.debug.vimspector.start
, it replaces the existing one instead of starting a new one.
Is it possible to have multiple debugging sessions at the same time?
Hi there,
I've been trying to get the debugger to work. But I keep running into errors. To me it looks like debug adaptor is sending requests with a wrong protocol. Logs below :-
Steps
Load the project.
Activate coc-debug-java plugin.
Run :CocCommand java.debug.vimspector.start
The splash screen opens up and says "Initializing debug adaptor" but never moves beyond it. Vim status bar (which i think shows JDT ls logs ) says "Request for initialization aborted: closing down".
In the logs I see the error "Unable to start debug server"
My vimspector settings :-
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "4456"
}
},
"configurations": {
"Java Attach": {
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "127.0.0.1",
"port": "4455"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}
Describe the issue
Static variables are not shown in "Variables" view in vimspector.
In vscode-java-debug
plugin there is an config option
java.debug.settings.showStaticVariables: show static variables in "Variables" viewlet, defaults to false.
I wonder if something needs to be enabled/configured in this plugin or it is not supported.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Static variables should be visible
Versions of relevant software
9.1.445
392264f475
1.15.2
master
Is hot-swap code possible?
Hello,
One thing I really miss about IntelliJ is the evaluate expression
feature when I can run arbitrary code on variables in the current stack. Could you help me figure out how to do this (or point me to documentation where I can read more about it)?
Protocol error: Server returned no threads
Getting the following error
The specified adapter 'java-debug-server' is not available. Did you forget to run 'install_gadget.py'?
My configuration is
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "${AdapterPort}"
}
},
"configurations": {
"Java Attach": {
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "localhost",
"port": "29220"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}```
Good day to you!
I have java spring application that runs in docker-container (tomcat7) and I want to debug it from vim.
here is my docker-compose.yml for java app :
version: '3'
services:
java-tomcat:
build:
context: ../_bin/${JAVA_VERSION}
container_name: "${CONTAINER_NAME}"
restart: always
volumes:
- ${DOCUMENT_ROOT}/WAR:/usr/local/tomcat/webapps/
- ${TOMCAT_CONF}:/usr/local/tomcat/conf/
environment:
ENV JPDA_ADDRESS: "8000"
ENV JPDA_TRANSPORT: "dt_socket"
networks:
- lamp
ports:
- 8888:8080
- 9000:8000
labels:
- "traefik.enable=true"
- "traefik.http.routers.${CONTAINER_NAME}.rule=Host(`${CONTAINER_NAME}.docker.localhost`)"
- "traeeik.http.routers.${CONTAINER_NAME}.entrypoints=web"
networks:
lamp:
external: true
my .vimspector.json:
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "${AdapterPort}"
}
},
"configurations": {
"Java Attach": {
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "localhost",
"port": "5005"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}
after container runs I'm calling
:CocCommand java.debug.vimspector.start
and
m
after that it loads hangs in 'Attaching in debugee...'
Before that I've had a problem with running java server and it was resolved by using answer:
neoclide/coc-java#99 (comment)
My thoughts, that I have incorrect .vimspector.json config, but at the moment can't figure out what to do.
Will appreciate any help!
Thanks!
Coc-java cannot view the source code, but you can view the source code by installing a plug-in vscode-java-decompiler for vscode. Can you write a coc java decompiler plugin based on dgileadi/vscode-java-decompiler?
Hi. first of all, let me thank you for this plugin. I tired to debug a super simple java application that contains only one file: main.java:
public class main {
public static void main(String[] args) {
System.out.println("foo");
System.out.println("bar");
}
}
So, i don't use maven or other fancy stuff. Seems in README we need maven to start a java process. Is it necessary?
First, run a Java process with debug enabled. Make sure its configured to pause and wait for a remote debugger on port 5005.
For example:
mvn test -Dmaven.surefire.debug
Hi,
I followed the steps mentioned in the READMe but still unable to start the debug server.
Steps taken
Nothing happned. When typed :messages all i see is [coc.nvim] Starting Java debug server...
Here is my :checkhealth report
health#coc#check
OK: Environment check passed
OK: Javascript bundle build/index.js found
OK: Service started
vim version: NVIM v0.4.3
node version: v12.13.0
coc.nvim version: 0.0.80-cc1ad56699
platform: darwin
2021-03-24T23:30:15.867 INFO (pid:29275) [coc-java] - Using java from /Library/Java/JavaVirtualMachines/jdk-11.0.8.jdk/Contents/Home, version: 11
2021-03-24T23:30:15.905 INFO (pid:29275) [plugin] - coc.nvim 0.0.80-cc1ad56699 initialized with node: v12.13.0 after 246ms
2021-03-24T23:30:15.924 INFO (pid:29275) [coc-java] - JDT Language Server starting at /Users///****/learnJava
2021-03-24T23:30:15.925 INFO (pid:29275) [services] - registered service "java"
2021-03-24T23:30:15.930 INFO (pid:29275) [language-client-index] - Language server "java" started with 29277
2021-03-24T23:30:54.196 INFO (pid:29275) [attach] - receive notification: runCommand [ 'java.debug.vimspector.start' ]
2021-03-24T23:33:44.420 INFO (pid:29275) [attach] - receive notification: runCommand [ 'java.debug.vimspector.start' ]
2021-03-24T23:35:50.498 INFO (pid:29275) [attach] - receive notification: showInfo []
2021-03-24T23:35:50.511 INFO (pid:29275) [attach] - receive request: CocAutocmd [ 'BufReadCmd', 'output', 'output:///info' ]
2021-03-24T23:44:48.065 INFO (pid:29275) [attach] - receive notification: showInfo []
Kindly help.
Describe the issue
Could not evaluate variables when debugging web apps using mvnDebug jetty:run, But it is ok when using mvnDebug tomcat7:run.
To Reproduce
Steps to reproduce the behavior:
In step 2, if I use mvnDebug tomcat7:run to launch, there will be no problem.
I have compared the vimspector debug log, and find nothing different between jetty:run and tomcat7:run.
Expected behavior
The variable evaluation function as expected.
Versions of relevant software
Relevant logs and error messages
{ "java.trace.server": "verbose" }
in :CocSettings
.:CocCommand workspace.showOutput java
.:VimspectorShowOutput Vimspector
.
:CocCommand java.debug.vimspector.start
Do you see a message like [coc.nvim] Java debug server started on port
in the output of :messages
?Screenshots
If applicable, add screenshots to help explain your problem.
It is fine with tomcat7:run
It does not work with jetty:run
The sample project:
demo-app-1.tar.gz
Currently after the code is modified I can see Unhandled event: hotcodereplace
. Is it possible to have HCR in Vim? DCEVM with auto HotSwap works but is usually very resource intensive.
I'm seeing Unable to set breakpoint: java.lang.IllegalArgumentException
whenever I kick off a test with a break point set in one of the tests. The command I use is, mvn clean -Dmaven.surefire.debug test
. The same setup works on my laptop (running slightly older arch), on my desktop I hit this issue. I'm not sure how to debug this problem. Any help please?
Below is my jdt.ls server log ,
!ENTRY java-debug 1 0 2021-03-09 16:22:29.783
!MESSAGE Trying to attach to remote debuggee VM null:5005 .
!ENTRY java-debug 1 0 2021-03-09 16:22:29.817
!MESSAGE Attaching to debuggee VM succeeded.
!ENTRY java-debug 4 0 2021-03-09 16:22:32.345
!MESSAGE [error response][setBreakpoints]: java.lang.IllegalArgumentException
!STACK 0
java.lang.IllegalArgumentException
at org.eclipse.jdt.core.dom.ASTParser.<init>(ASTParser.java:240)
at org.eclipse.jdt.core.dom.ASTParser.newParser(ASTParser.java:134)
at com.microsoft.java.debug.plugin.internal.JdtSourceLookUpProvider.getFullyQualifiedName(JdtSourceLookUpProvider.java:105)
at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.convertClientBreakpointsToDebugger(SetBreakpointsRequestHandler.java:277)
at com.microsoft.java.debug.core.adapter.handler.SetBreakpointsRequestHandler.handle(SetBreakpointsRequestHandler.java:125)
at com.microsoft.java.debug.core.adapter.DebugAdapter.lambda$dispatchRequest$0(DebugAdapter.java:87)
at java.base/java.util.concurrent.CompletableFuture.uniComposeStage(CompletableFuture.java:1106)
at java.base/java.util.concurrent.CompletableFuture.thenCompose(CompletableFuture.java:2235)
at com.microsoft.java.debug.core.adapter.DebugAdapter.dispatchRequest(DebugAdapter.java:86)
at com.microsoft.java.debug.core.adapter.ProtocolServer.dispatchRequest(ProtocolServer.java:118)
at com.microsoft.java.debug.core.protocol.AbstractProtocolServer.lambda$new$0(AbstractProtocolServer.java:78)
at io.reactivex.internal.observers.LambdaObserver.onNext(LambdaObserver.java:60)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.drainNormal(ObservableObserveOn.java:200)
at io.reactivex.internal.operators.observable.ObservableObserveOn$ObserveOnObserver.run(ObservableObserveOn.java:252)
at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:61)
at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:52)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
!ENTRY java-debug 1 0 2021-03-09 16:50:13.409
!MESSAGE Debug connection closed
Hi,I am a java programmer.can it run in neovim? I run CocCommand java.debug.vimspector.start,but the report is wrong: The specified adapter'java-debug-server' is not available. but I installed coc-java and vimspector.It has othertings to do ?
Think you ,very much!
For example selecting from one of the existing configurations when starting?
I followed the exact steps on readme.md. I put some breakpoints and then when i connect to the remote host it just runs the code without stopping.
here is my .vimspector.json:
`
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "${AdapterPort}"
}
},
"configurations": {
"Java Attach": {
"default": true,
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "127.0.0.1",
"port": "5005"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}
`
EDIT: I got it to work on maven project, But still cant cofigure it on a stand alone file.
Describe the issue
can not get evalution work when debuging single class program without maven or gradel support.
I found this in vscode doc
projectName - The preferred project in which the debugger searches for classes. There could be duplicated class names in different projects. It is required when the workspace has multiple Java projects, otherwise the expression evaluation and conditional breakpoint may not work.
and this in vscode-java-debug repo
projectName - The preferred project in which the debugger searches for classes. It's required for the evaluation feature. Most of the time, the debugger will auto generate the configuration for you. In case you want to manually configure it, here are the rules.
When you open a maven project, the project name is the artifactId.
When you open a gradle project, the project name is the baseName or the root folder name.
When you open other Java files, leave the launch.json empty and allow the debugger auto generates the project name for you.
Pro Tip: The easiest way to get the project name is to install Java Dependency Viewer extension, the top node in the JAVA DEPENDENCIES view is your project name.
when debuging in vscode, the projectName will be automatically generated, something like "test_c3ac9756" for example.
I tried some possible projectNames, but none of them could work.
To Reproduce
Expected behavior
able to watch expression. maybe get the ${projectName) like ${adapterPort}.
Versions of relevant software
Relevant logs and error messages
[Error - 11:04:18 PM] May 5, 2022, 11:04:18 PM [error response][evaluate]: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
com.microsoft.java.debug.core.DebugException: Cannot evaluate because of java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json..
at com.microsoft.java.debug.core.adapter.AdapterUtils.createCompletionException(AdapterUtils.java:246)
at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:147)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1692)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.IllegalStateException: Cannot evaluate, please specify projectName in launch.json.
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.findJavaProjectByType(JdtEvaluationProvider.java:277)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.ensureDebugTarget(JdtEvaluationProvider.java:405)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:140)
at com.microsoft.java.debug.plugin.internal.eval.JdtEvaluationProvider.evaluate(JdtEvaluationProvider.java:115)
at com.microsoft.java.debug.core.adapter.handler.EvaluateRequestHandler.lambda$handle$0(EvaluateRequestHandler.java:84)
... 7 more
:CocCommand java.debug.vimspector.start
Do you see a message like [coc.nvim] Java debug server started on port
in the output of :messages
?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.