I'm using intelij as IDE in application tapesrty5 and for server i'm using jetty runner as plugin for intelij
the problem is when i'm trying to run as debug mode the break point never been trigged
Breakpoint created but never been triggered !
Related
I have a java maven project that I am running on Netbeans 11 on a Mac with jdk 14. The program is a simple java project running locally and doesn't have any connections to databases or anything. When I set breakpoints to debug a method and run Debug Project, the project runs normally and it ignores all breakpoints. How can I make it stop at breakpoints?
I can start my main Spring Boot application of the shelves in debug mode I can set a breakpoint in IntelliJ and it works! I.e. Running below:
#SpringBootApplication
public class JasperApplication {
public static void main(String[] args) {
SpringApplication.run(JasperApplication.class, args);
}
}
However if I start my Spring Boot application in IntelliJ with the maven run plugin with debug option:
spring-boot:run
Debug does not work. I have read about
-Drun.jvmArguments=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
I can't fit everything together, could someone enlightning me how it all works or direct me to some articles describing the whole thing under the hood.
I like to be able to run maven Spring Boot plugin from within IntelliJ aswell as the command line, being able to debug and set breakpoints. Thanks!
When you invoke spring-boot:run you are starting a remote process i.e. this process is not running inside your IDE.
If you want to debug this process from within your IDE the following pre requisites apply:
The remote process must be 'remote debug aware', this is what you are doing when you run that process with -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
You must use a remote debugger within your IDE. More details in the docs but the brief summary is:
Run > Edit Configurations
Click on the + icon and choose Remote
Name the run configuration and choose a module for the Search sources using module's classpath
The invoke mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" and launch this Run configuration within your IDE and the two will talk to each other.
Here's a screenshot showing the remote run configuration looks like:
I'm running a Vaadin web app using the TomEE Maven plugin. When attempting to run debug in IntelliJ, it skips all breakpoints.
From what research I've read, it points to the debugger not attaching to the TomEE plugin.
Is there a way to do this without having to configure a standalone server? Ideally for development, I want to keep the dev setup simple and packaged within the pom.
if you run
mvn tomee:debug
then in intellij you configure a remote server on port 5005 and when the lisne "Listen ...5005..." is in the logs you connect/run this debug configuraton.
Then you debug in the server.
My breakpoints aren't being hit when I try to debug a Junit test in Eclipse. Is there some trick I am missing? Does anyone have any ideas?
Okay it is resolved. The Junit test was being injected into a jboss server running in the Eclipse IDE. The Junit test is injected into the jboss server through the use of Arquillian. The reason the Junit test was skipping the breakpoints was because the jboss server also had to be started in debug mode. I restarted jboss in debug mode and ran the junit test again. This time, the break points are hit.
My problem is with respect to debugging web application on an already installed glassfish using eclipse.
If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.
I can use maven's jetty or tomcat plugin and debug the application but I need to debug application on an already installed glassfish. Basically I have followings
1) Web application created using maven archetype
2) Eclipse IDE
3) Glassfish which is already installed outside of Eclipse IDE
I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.
Please let me know your suggestions.
Thanks
If I create a web project using eclipse then eclipse will let be deploy and debug application on an already installed glassfish application server. However, if I have created a web project using maven archetype, eclipse does not let me debug the application.
This is not true. Whether you use the Maven Eclipse Plugin (which provides WTP support) or m2eclipse (with the optional Maven Integration for WTP installed from the m2eclipse Extras), you can deploy a project created outside Eclipse to an existing "Server" (that you can start in Debug mode), as long as you imported it appropriately (Import... > Existing Project into Workspace if you use the former, Import... > Maven Projects if you use the later).
Basically I have followings 1) Web application created using maven archetype 2) Eclipse IDE 3) Glassfish which is already installed outside of Eclipse IDE
I use the same setup with several projects with no problem (and can debug them on my locally installed GlassFish server).
I came across maven's glassfish plugin but as far as I understood it is not for debugging the application.
There is no need for extra Maven plugins, you can just rely on your IDE if you follow the right steps.
I don't know about eclipse, but IntelliJ IDEA has a remote debug feature. You start your server with something like
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5055
and then the IDE will connect to that port and you'll have a regular debug.
I'm sure eclipse has this feature.
EDIT: This article shows how to use this feature with eclipse.
I´m going to write it most for me in order to keep trace of my solution:
If you are using the maven.failsafe plugin just force the execution of glassfish internally the current JVM started by maven avoiding the fork with the parameter
-DforkCount=0
in such way you are able to debug both test and server from the usual way, ie. running a debug task from eclipse and setting break points both in test and in server side.
Extra parameter information could be found here, including setting different debug port:
http://maven.apache.org/surefire/maven-failsafe-plugin/examples/debugging.html