Monday, August 29, 2016

Launching Apache Zeppelin in Debug Mode

Sometimes, the easiest way to find and fix a code problem is to step into the code execution.
Below I am going to give a few simple steps to launch Apache Zeppelin in debug mode and then attach a remote debug from IntelliJ IDE.

Configure Apache Zeppelin to start in debug mode

First, let's update zeppelin-env.sh to properly set the configuration to get the JVM to start in debug mode.


  • Edit $ZEPPELIN_HOME/conf/zeppelin-env.sh
  • Add the following to the file:
    export ZEPPELIN_MEM="-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8111
    

Now that we have updated the zeppelin-env.sh, the next time Apache Zeppelin is starter, it will be listening for a remote debugger on port 8111.

Configure IntelliJ IDE to connect and debug the remote Apache Zeppelin


  • Go to Run->Edit Configuration
  • Create a new remote configuration in your IntelliJ IDE

Configure IntelliJ to stop on exceptions

  • Go to Run->View Breakpoints
  • Enable 'Java Exception Breakpoints'
  • Select condition checkbox, and add the following condition :
    !(this instanceof java.lang.ClassNotFoundException || 
      this instanceof java.util.MissingResourceException || 
      this instanceof javax.naming.NoInitialContextException || 
      this instanceof java.lang.NoSuchMethodException)
    
  • You should now have Exception breakpoints configured like:
Hopefully this can help get you started with Contributing to Apache Zeppelin.

No comments:

Post a Comment