Debugging gradle web application in Jetty

(malini kennady) #1

I am new to Gradle. I am using Buildship in eclipse. My build.gradle looks like,

gretty {
    httpPort = 8080
    contextPath = '/'
    servletContainer = 'jetty9'

When I debug the application as, ‘gretty -> appStartDebug’, the console waits saying like,

Listening for transport dt_socket at address: 5005

My project is a web application with init as,

@WebServlet(urlPatterns="/InitServlet", loadOnStartup=0)
public class InitServlet extends HttpServlet {

public static void initialize() {

I have my break point in the sysout. Is this proper way of debugging gradle application?

(James Justinic) #2

This is normal Java debugging behavior with suspend=y, unrelated to Gradle or Buildship. You need to configure your IDE remote debugger to attach to localhost:5005 before the application will continue to run normally.

(malini kennady) #3

Let me just clarify the steps I followed in eclipse,

  1. Create new debug configuration ‘Remote Java Application’ with Host: localhost, port = 5005
  2. Debug as ‘appRunDebug’
  3. Run remote debugger.

Error throws:
Failed to connect to remote VM. Connection refused.
Connection refused: connect

Are these steps right?

What about the value,
set GRADLE_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=9999,server=y,suspend=‌​n ?
Should I need it anyway?

(malini kennady) #4

Following the above steps works fine. 'Connection refused: connect' is resolved.