Closed fedoranvar closed 4 years ago
Based on the Docker configuration you provided, it looks like you're mapping your host port 9000 to the Java debugger on port 8000 in the container. In that case it would be my expectation to set your "Java Attach" port to 9000 in your .vimspector.json file instead of 5005.
{
"adapters": {
"java-debug-server": {
"name": "vscode-java",
"port": "${AdapterPort}"
}
},
"configurations": {
"Java Attach": {
"adapter": "java-debug-server",
"configuration": {
"request": "attach",
"host": "localhost",
"port": "9000"
},
"breakpoints": {
"exception": {
"caught": "N",
"uncaught": "N"
}
}
}
}
}
@dansomething I've changed port to 9000, but no luck
it hangs on Connecting to localhost: ....
he can't connect to Adapter?
My steps:
mvn clean package
and move ROOT.WAR file to tomcat folder here is my docker inspect output
maybe there is something in Maven?
To ensure that application is debugable: Before moving to neovim, I was able to debug this app in vscode.
Thanks!
It does seem like Vimspector may not be connecting to the Java debug server "Adapter". When you debugged it from vscode, what Java debug port did you attach to? Also, what do you see in Vim when you run :messages
after you've started the debugger? For example, after I run :CocCommand java.debug.vimspector.start
I see the following messages:
[coc.nvim] Starting Java debug server...
[coc.nvim] Java debug server started on port: 52737
[coc.nvim] Launching Vimspector with settings: {"AdapterPort":52737}
Paused in thread 1 due to breakpoint
Also, what do you see in Vim when you run :messages after you've started the debugger?
When you debugged it from vscode, what Java debug port did you attach to?
here is Server configuration file:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<Server port="8005" shutdown="SHUTDOWN">
<Listener className="org.apache.catalina.startup.VersionLoggerListener"/>
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on"/>
<Listener className="org.apache.catalina.core.JasperListener"/>
<Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener"/>
<Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"/>
<Listener className="org.apache.catalina.core.ThreadLocalLeakPreventionListener"/>
<GlobalNamingResources>
<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml"/>
</GlobalNamingResources>
<Service name="Catalina">
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443"/>
<Engine name="Catalina" defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm className="org.apache.catalina.realm.UserDatabaseRealm" resourceName="UserDatabase"/>
</Realm>
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="localhost_access_log." suffix=".txt" pattern="%h %l %u %t "%r" %s %b"/>
</Host>
</Engine>
</Service>
</Server>
for debugging in vscode no launch.json need
I've realised that I was using tomcat-server debugger in vscode, not vscode-java-debug
It does look like your Vim is connecting to the debug adapter server since it got a port and is passing that to Vimspector. Its possible Vimspector isn't able to connect to that port, but its unclear why. Are you able to debug a Java project that isn't running in Tomcat or Docker?
Another thing I noticed, and I'm not that familiar with Docker Compose, is it looks like the way you're defining Environment
in docker-compose.yaml doesn't resemble the documented configuration format. Can you confirm it is correctly setting those environment options in the container for Tomcat?
Based on the Docker compose docs I'd expect your config to look like:
environment:
- JPDA_ADDRESS=8000
- JPDA_TRANSPORT=dt_socket
@dansomething
You were right: It was the problem with the environment variables in docker compose.
Thank you!
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 :
my .vimspector.json:
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: https://github.com/neoclide/coc-java/issues/99#issuecomment-663856695
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!