IntelliJ: Debugger not working in a Maven project - java

I am new to using IntelliJ and this seems to be a common problem having gone through similar questions but am still unable to use debugger in a Maven project.
After configuring the Debugger when I click on Debug I see following in my console:
"C:\Program Files\Java\jdk1.8.0_151" -agentLib:jdwp=trasnport=dt_socket,address=127.0.0.1:52485 server=n suspend=y
...//Few project specific environment variables
Connected to target VM 127.0.0.1:52485
Note that the application is up and listening on port 8080 as I can access it from the browser and its a standalone Dropwizard application.
There is a cross on the break point and the debugger doesn't stop over it. Have tried removing Cache, restarting, deleting .idea folder, building Maven project but still the break point doesn't work.
Should the jdwp port also be 8080 and not 50000 something as shown above. I am unable to debug this in Eclipse as well. Can some one help me out what could be the solution. Thanks for any help.

Related

Unable to ping server at localhost:8180

Screenshot of the issue
Hi guys im using intellij and maven and i was working on my code but when I try to ru it locally im getting this issue, I checked all the configuration but I dont know exactly why this issue appear
This happens when IDE can not connect to mentioned port. It is most likely specified in run debug configuration. This may happen because the port has already been occupied by another process (e.g. There is already Tomcat instance running).
Also if you have antivirus/firewall make sure it does not block IDE process from making connections on localhost: make sure to exclude IDE process, IDE installation home, IDE configuration/system folders, project and library directories from the scan. Try restarting the PC, try using different JMX port in Run/Debug Configuration.

How can I troubleshoot a localhost error?

I'm working on a project pulled from GitHub in IntellijIdea. I am able to build my project and have a database running, but when I try to run it using Tomcat, I get an error in Chrome saying that there is no webpage attached to local port 8080.
I've tried building and rebuilding artifacts, reconfigured Tomcat using different ports, and tried previewing the project through index.jsp, but I continue to get this error.
I'm expecting to see a map and webpage (as my teammates can), but am having no luck. Does anyone have thoughts on how to troubleshoot?

Debugging Thorntail Services in Eclipse?

I've got several microservices projects that I'm developing using the Thorntail framework. I'm writing my code using Eclipse. In the past, I've done all of my development using the Wildfly app server, and Eclipse made debugging these apps dead simple. Right Click->Debug As->Debug On Server. Done. Now that I'm using Thorntail, I'm not quite sure how to do it.
From the command line, I would start my Thorntail projects using:
mvn thorntail:run -Dthorntail.useUberJar # Project 1
mvn thorntail:run -Dthorntail.useUberJar -Dthorntail.port.offset=1000 # Project 2
That gets everything up and running, and listening on ports 8080 and 9080. However, the services are not in debug mode and I didn't launch these through Eclipse.
I know I can Right Click->Debug As->Maven Build... and then create a new debug configuration. I've done so, with my goals corresponding to the mvn commands above. However, when I do so no debugger is automatically attached, so breakpoints and such don't work. I'm sure I'm missing a step somewhere, but this is functionality I haven't tried to use before so I'm lost. Any recommendations?
The mvn thorntail:run accepts a system property thorntail.debug.port with a port number. For example, if you run
mvn thorntail:run -Dthorntail.useUberJar -Dthorntail.debug.port=5005
the Java process will wait for remote debugger connection and only then will it continue.
I don't use Eclipse, but I'm pretty sure configuring a remote debugging session isn't hard.
Execute the uberjar with the following parameters. Ensure that all the parameters are specified before the name of the uberjar on the line.
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=$PORT_NUMBER -jar $UBERJAR_FILENAME
$PORT_NUMBER is an unused port number of your choice. Remember this number for the remote debugger configuration.
$UBERJAR_FILENAME is the uberjar.
suspend=y ensures that JVM will pause and wait for remote debugger connection before it starts the application.
To remote debugging it using Eclipse IDE you have to open Eclipse, open source code of the targeted application and create a debug configuration ("Remote Java Application") by specifying the targeted host and port. After this, hit "Debug" button and proceed with the remote debugging.

Running GWT through through IntelliJ gives "Plugin failed to connect to Development Mode server at 127.0.0.1:9997" but it works fine through eclipse

I have a multimodule gwt project that I'm able to start up and run through IntelliJ just fine. But when I go to debug the application (or actually just the act of adding ?gwt.codesvr=127.0.0.1:9997 to the end of the url) causes me to get the dreaded "Plugin failed to connect to Development Mode server at 127.0.0.1:9997.
My current setup is:
Entrypoint has a dependency on several portal modules. I'm unsure of what I'm doing wrong, because the portal runs fine as long as it's not through the code server..
Edit: Here is my current run configuration. I've tried everything including changing the -war directory to target\ROOT and src\main\webapp and I've changed the web facet resource folder to the same, I have no clue what I'm doing wrong.
Note that I've tried removing and adding the bindAddress several times. It doesn't differently either way.
It is not your Project Structure that is at fault here. Most probably your "Run Configuration" has flaws. In "Run/Debug Configurations" you need to create "GWT Configuration" and set up properties correctly. I run with "GWT Module to load" = "All" and with "Dev Mode parameters" set to "-bindAddress 0.0.0.0" to allow accessing my debug config from various hosts, not only from localhost - you may or may not need it. Obviously, for your setup "Use Super Dev mode" should be turned off.
Also you need to check that the port 9997 is not taken up by another process. But if it is, you will see the error in Jetty's startup log in debug console. I assume if it works with Eclipse it should not be.

Java: How do you debug a module/jar that works as a plugin for another application

I know this sounds like a pathetic question and I'm sure it will get ridiculed but thats the only way I know how to describe the situation.
Scenerio : I'm creating a plugin for another java application. This application that uses the compile jar (my plugin) gets placed in the applications plugin directory. Is there anyway I can go about debugging this jar (which I have to source to) in execution of an application I do not have the source to?
I'm using Eclispe Juno as my IDE.
I would say yes, if you can start the application that you plugin plugs in into :).
java -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n myapp
to start then in eclipse setup a remote-debugging session setting it up to connect to your app running in the java debug mode to the localhost on the port 4000
This linky will probably solve all your eclipse problems
http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html

Categories