How to debug extensions in Java Platform?

How to debug extensions in Java Platform?

  
How to debug extensions in Java platform? I saw similar question has answers for .Net platform. But hoping to find answers for Java.

Thanks in Advance
Jeyanthi Gopalan wrote:
How to debug extensions in Java platform? I saw similar question has answers for .Net platform. But hoping to find answers for Java.

Thanks in Advance
Hello Jeyanthi,

One approach that you can take is to use the logging system. As described in this post by this answer.

The code for logging in java that you can use is this:
 
outsystems.hubedition.runtimeplatform.log.GeneralLog log = new outsystems.hubedition.runtimeplatform.log.GeneralLog();
log.write( new DateTime(), AppInfo.getAppInfo().getOsContext().getSession().getSessionID(), AppInfo.getAppInfo().geteSpaceId(), AppInfo.getAppInfo().getTenant().getId(), AppInfo.getAppInfo().getOsContext().getSession().getUserId(), e.getMessage(), "Warning", "ModuleName", "0");

Let us know if you need more help.

Cheers,
Miguel

Doesn't Java have a remote debugging system? .NET does and can be used to debug extensions running on a remote server...

If not, I guess you'll have to go with the logs, but that's pretty bad. Also, if you're doing this, put Audits before and after calling the extension method. Sometimes it's just the parameters passed to the method that are wrong, and there's no need to actually debug the extension.

In absence of debug for JAVA , it's really tough to know the issue and it's takes good amount of time to debug and get to the root cause, having a debug for java would be a boon.

If you have access to the server machine you can just do remote debugging via eclipse like you would do with any other java application.


1- You need to enable remote debugging in the jboss config file (standalone-outsystems.conf) and uncomment the line for debugging that looks like:


# Sample JPDA settings for remote socket debugging
JAVA_OPTS="$JAVA_OPTS -Xrunjdwp:transport=dt_socket,address=18888,server=y,suspend=n"


Note: if using Weblogic you will need to add that flag in the start command line via the weblogic consoile

Make sure the port that is on that command line is accessible (change it if necessary) from your machine and its not being blocked by your server firewall, network or iptables rules.

Restart your application server after changing the config.


2 - Then in your extension, open the build.xml file and change the javac line to something like:
        <javac srcdir="${src}" destdir="${build}"
               debug="true"
               debuglevel="lines,vars,source"
               includeantruntime="false">


3 - Publlish your extension and the module using it.

4 - In eclipse start a remote debug session to your server (and the port previously configured in 1- )


Regards,
João Rosado

Thank, that would help. We would give it a try