Search code examples
eclipsedebuggingpostgresqlpljava

Is it possible to debug PL/Java (ideally from Eclipse)?


Although I found PL/Java a powerful add-on for PostgreSQL, I couldn't find a way of remotely debug the clases loaded on the PSQL DBMS.

Is this possible to achieve?

Thanks in advance!


Solution

  • I suppose you could set pljava.vmoptions to enable debugging and include a port number to listen on, and then use Eclipse's "debug remote application" launcher to connect to it.

    So a JVM option -agentlib:jdwp=transport=dt_socket,suspend=n,address=localhost:55000 will make the JVM listen on port 55000 for debuggers. You then open the "Debug configurations.." dialogue in Eclipse, right click "Remote Java Application" in the launch types pane on the left and update the connection properties on the right to use port 55000. You should connect up the debug launcher with a project as well, to pick up that project's class path and sources.

    Note I haven't actually tried this in postgresql, but this corresponds to how I always used to run JBoss from a shell script rather than from within Eclipse.