I have a problem with debugging my add-ons java code through eclipse. I did some research and found a way to debug that should work:
1) Run jira/confluence with the additional parameters to open a port for debugging
atlas run --jvmargs "-Xdebug -Xrunjdwp:transport=dt_socket,address=xxxx,server=y,suspend=n"
2) In eclipse go to Run->Debug Configurations and make a newRemote Java Application where the Host is your Jira/Confluence address (i.e. localhost) and the Port is xxxx.
When I start the instance of jira with the additional parameters, I do a netstat -a | find "LIST", to check if the port is open for listening and I find that it is, but when I try to run the debug from eclipse nothing happens the 1st time, I run netstat -a | find "LIST" again and see that the port is no longer in the list, on the 2nd attempt to debug it gives me the Failed to connect to remote VM error.
Any suggestions as to where the problem might lie? I was concidering that there is something wrong with my eclipse but I'm not sure.
Community moderators have prevented the ability to post new answers.
With SDK 4.2.9 (on Linux in my case), the "--jvmargs" option has only effect if "jvmArgs" is NOT already set in pom.xml. "jvmArgs" from pom has priority and both are not concatenated.
You have to check "JVM Input Arguments" in target/jira/home/log/atlassian-jira.log to be sure your option has been used.
When I first run "atlas-debug" with an Atlassian plugin source code, I got:
[INFO] Starting jira on the tomcat7x container on ports 2990 (http) and 36370 (rmi) [INFO] using codehaus cargo v1.2.3 [INFO] [cargo:start] [INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-tomcat:jar:1.2.3 for container tomcat7x [INFO] [stalledLocalDeployer] Deploying [target/jira/jira.war] to [target/container/tomcat7x/cargo-jira-home/webapps]... [INFO] [talledLocalContainer] Tomcat 7.x starting... [WARNING] [talledLocalContainer] ERROR: Cannot load this JVM TI agent twice, check your java command line for duplicate jdwp options. [INFO] [talledLocalContainer] Error occurred during initialization of VM [INFO] [talledLocalContainer] agent library failed to init: jdwp
After investigations around atlassian-jira.log (line "JVM Input Arguments") and opened ports (with netstat), I find out that atlas-run already enables JVM TI "by default" with port 8787 because of agentlib already set in "jvmArgs" for the "maven-jira-plugin".
-XX:MaxPermSize=384m -Xms1024m -Xmx2048m -Djira.dev.mode=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8787
After removal of the "agentlib" option from the "maven-jira-plugin", "atlas-debug" starts properly and default port is 5005.
Update Conclusion:
That doesn't work either :(
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
im getting port 8787 when port 5005 is in use.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should check you have no local firewall settings that prevent the port to be used
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I specifically asked the admins to open the port before trying to debug, still it didn't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you see your "agentlib" option on your JVM command-line (with Process Explorer on Windows) ? Do you see it in "JVM Input Arguments" in atlassian-jira.log ? Check for "jvmArgs" present in your plugin POM.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In case anyone else runs into this, I was having the exact same problem where the first time you click Debug in Eclipse it does nothing, then the second time it errors out.
Turns out clicking Debug does not automatically open the browser. Restart Eclipse, click Debug, then navigate to your page in the browser, and the Eclipse debug should start up. Hope that helps someone.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you Stephen, you're my hero! Seriously, it is exactly like that. I was getting the same error. Just leave the eclipse pop-up be, doesn't matter. Once you navigate to the page in the browser and hit your action, Eclipse will start debugging. Really thanks a lot!!!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Daniel, i do it without any parameters, you can try "atlas-debug" and connect with eclipse.
Java Remote Application
Connection-Type: Standard (Socket Attach)
Port: 5005
Host: Localhost
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There's definately something wrong with my PC, I tried it your way and I got the same result -> port was open tried to connect and debug, port closed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Daniel Milkov
works for me as Paul Pasler said. Usually you dont have to open ports yourself. When you start your instance with atlas-debug instead of atlas-run, your instance will be open for debuging on port 5005.
have a nice day
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you check your JIRA logs if there is anything related? Maybe something fails on JIRA side.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I get the same thing with confluence sometimes and intellij idea - no idea why. Happens if I connect, disconnect, then connect again, or sometimes it seems like the connection is made then closed straight away. No help, just saying I doubt it's related to eclipse.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
1) Yes, they are on the same machine.
2) What exactly do I need to do there, I haven't used telnet like... ever?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
telnet localhost xxxx
where xxxx is your port number. If connection is not rejected it means that JIRA port is open correctly.
Maybe port number is too high or too low and your IT guys block it somewhow with your local machine firewal rules? Please ask your IT for assistance.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried to connect with telnet, it worked (didn't get refused), ran netstat to check if the port was still open after trying to connect with telnet - it was, but again when I tried to debug with eclipse the port closed.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Probably some misconfiguration is there and Eclipse does not send what JIRA/java expects.
Can you try -Xrunjdwp:transport=dt_shmem instead of dt_socket?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Tried atlas-run --jvmargs "-Xdebug -Xrunjdwp:transport=dt_shmem,address=7777,server=y,suspend=n", I assume this is what you were talking about, tried netstat to see if the port was open for listening - it wasn't, also tried to connect with telnet localhost 7777, connection got refused and when I tried to debug with settings localhost 7777 it gave me this error (which makes sense seeing as the connection got refused when I tried it with telnet):
Failed to connect to remote VM. Connection refused.
Connection refused: connect
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
shmem means used shared memory and not sockets for debugging, so you don't need to provide an address. You need to adjust the eclipse debug profile if using dt_shmem.. there should be an option for that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Aha, I see... I'll have to read up on that when I get to work on Monday, thanks for the clarification.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Exactly. If you work on the same machine then shared memory can do the trick.
However it does not look like Eclipse supports shared memory: http://stackoverflow.com/questions/8589883/debugging-java-application-in-eclipse-using-transport-dt-shmem
You would need to try IDEA.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'll try that, as soon as I can get someone from IT to install IntelliJ on my PC and I'll give feedback.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I finally installed IntelliJ and tried debugging, here's what happened:
1) With shmem:
Error running Atlassian Debug
Unable to open debugger port : java.io.IOException "shmemBase_attach failed: The system cannot find the file specified"
2) With socket attach:
Error running Atlassian Debug: Unable to open debugger port : java.net.ConnectException "Connection refused: connect"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.