What is the easiest way to debug my Nuxeo plugin?

We are working as primates to deploy and test the new features of our plugins for Nuxeo DM (customizing the default JSF Web UI).

We are developing totaly off-line the Nuxeo OSGi maven plugin. Coding into the IDE the xhtml pages and Seam beans, contribs, etc… after compilation, copy the plugin JAR to Nuxeo plugin folder…

Run Nuxeo and navigate… and just wait for the Exceptions to be thrown in the log to find the developer mistakes, also poluting the code with many Log.Debug to test steps of methods, var values, actions result, etc…

If we are working with JSF, Seam, etc… it should be a dream to debug, deploy, start, stop the Nuxeo (e.g. Tomcat package) as a IDE Server, e.g. Eclipse… just compile and clean the project and click PLAY/DEBUG button… some night I catch my self dreaming that I can debug my Seam inside Eclipse and seeing the Breakpoints in debug perspective….

Is it possible? What is the way to have a develop environment like this?

1 votes

3 answers

6451 views

ANSWER



You can use remote socket debugging.

Just look for it in nuxeo.conf and uncomment

JAVA_OPTS=$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

Start Nuxeo and from Eclipse create a new debugger profile in menu Run > Debug create a new Remote Java Application profile and set the source to the filesystem directory that host your complete Eclipse workspace and set the port to 8787.

I've been using this with IDEA and it works great. Personally I prefer to just symlink my jars to the bundles directory so I just have to do a mvn package and restart Nuxeo (if you're using Windows you have mklink)

Also, you can hot-reload your JSF-Seam layer (seam components and xhtml files) just look here: How to do incremental deployment (hot reload) in the JSF-Seam layer

3 votes



Hi Nelson!!! Thankyou very much!

After post the answer I start to looking for and saw how is simple!! I got shy when take a look to nuxeo.conf and saw that the debug config stay there already along all this time =), Your idea to work with SymLink is great! We set your tip for all of my staff

I'm sure this answer shall be post into Nuxeo Documentation Website!

Have a nice Week!!!

09/07/2011

Thanks a lot!

We're enjoying it as childs with new toys!

09/17/2011

Does not work for me, it always fail with this error "Failed to connect to remote VM. Connection refused. Connection refused: connect"
07/24/2017


In addition, keep in mind that when you have an IDE with a debugger attached to your project through JPDA like described above for Eclipse or IDEA, you can make non-structural modifications to your code in the IDE, save the file, and have the changes reflected immediately in the running code.

This applies for any code modification that does not involve class changes (new fields or new methods), or method signature changes (changed parameters). It won't work either on classes that have been instrumented by things like Hibernate, Seam or EJBs. But it's valid for the rest.

This is extremely useful and we use it all the time.

2 votes



Hi, I have nuxeo 5.5 on virtualbox and windows 7, I try debug my plugin following these steps

  • Open the nuxeo.conf file, by default is here $TOMCAT_HOME/bin/nuxeo.conf or /etc/nuxeo.conf
  • Uncomment the following line:

    JAVA_OPTS=$JAVA_OPTS -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

  • start your server

but when I try to start my server this error is showed on screen: alt text

I commented this line again but the error persist what can I do?

0 votes