Clarity

  • 1.  Need help to debug the existing Java Jobs

    Posted Sep 24, 2012 05:20 PM
    Hi,

    I have couple of java Jobs developed by somebody else with source code and now I need to modify them to add some new requirement or debug it. I just look in the[b] lib folder in Clarity application server and there I found a jar file which is having the details of all the java codes. I have couple of questions here.

    1- We are planning to move from CA V12.04 to V13.1 very soon then during or after upgrade do I need to compile the custom jar file? Is there any additional steps require to take care the custom java codes other then the backup of custom files?
    2- What all are the per-requisite to view custom java jobs code. Can somebody explain the steps like What is the tool require to open this file on my local machine (example eclipse etc). , How to set the class path etc.


    Any help/suggestion will be appreciated

    Thanks,


  • 2.  RE: Need help to debug the existing Java Jobs
    Best Answer

    Posted Sep 24, 2012 07:31 PM

    shalinee wrote:

    Hi,

    I have couple of java Jobs developed by somebody else with source code and now I need to modify them to add some new requirement or debug it. I just look in the[b] lib folder in Clarity application server and there I found a jar file which is having the details of all the java codes. I have couple of questions here.

    1- We are planning to move from CA V12.04 to V13.1 very soon then during or after upgrade do I need to compile the custom jar file? Is there any additional steps require to take care the custom java codes other then the backup of custom files?
    2- What all are the per-requisite to view custom java jobs code. Can somebody explain the steps like What is the tool require to open this file on my local machine (example eclipse etc). , How to set the class path etc.


    Any help/suggestion will be appreciated

    Thanks,
    This sounds like a task that should be carried out by a java programmer; I'm making an assumption from these questions that you are not one currently.

    Although there are some java decompilers out there to reverse engineer the byte code .class files back to .java source, you really need access to (and the permission) to the true source .java files, especially if asking these questions, as any reverse engineering would lose the original structure (somewhat) of that source as the compiler rewrites the code (optimizes), the naming of all variables and constants will get replaced with generic tags, and all of the source code comments, all adding up to a significant reduction in source code readability. If you have the source, then you don't really need anything that is compiled/deployed to the Clarity server currently.

    To open .java files on your local machine you could use any text editor. Eclipse is a fine IDE for .java source, but a bit overkill for what most Clarity jobs should be looking to do. It can also help with debugging the running of a job inside Clarity, but needs the original source files and for the .class files to have been built with the debug symbols included ("javac.exe -help" and look at the first parameters on debugging "-g", if the source was compiled with "-g:none" then the binaries aren't much use for live debugging).

    Setting the class path is a JVM argument needed at compile and run time, i.e. when running the javac.exe and java.exe commands to build and run your code. Have a look in the xog.bat file for example and see the call to java.exe in there with the "-cp <path>" jvm parameter, that's the classpath for that jvm alone, and that is how it is set. For running a background job in Clarity that's not needed though (Clarity services scavenge for the files it finds in the /lib directory at startup for its class path), so you'll just want it for compiling in your case, and perhaps running any out-of-Clarity unit test runs.


  • 3.  RE: Need help to debug the existing Java Jobs

    Posted Sep 25, 2012 02:34 PM
    Thanks Nick for quick response.

    I was just concerned if there is anything to do during upgrade time which we are planning very soon.Later we might need to change some of the Java Jobs which is mainly reading the other ERP Database to the resource information for clarity and building the xml files for resource and OBS.

    This sounds like there is no extra compilation require during upgrade process with existing custom java class files.

    Thanks


  • 4.  RE: Need help to debug the existing Java Jobs

    Posted Sep 25, 2012 03:46 PM
    No need to recompile as a rule at least, of course it depends on exactly what the source code contains in terms of dependencies to java library files that have been dropped (if for example, moving to 13.1 and java 1.7, there may be some differences that result in a java 1.6 app no longer working, but these would be few and far between, usually with warnings to the 1.6 developer that the articles are being deprecated well in advance). Also if the job is 'badly behaved' and tries to hook into Clarity's own libraries and code, then between versions they may also break.

    But from a pure point of view, recompiling isn't a strict requirement when changing JRE versions or changing an app that calls your code, where the calling interfaces are unchanged (it would be havoc for example, if the .jar files containing jdbc drivers had to be rebuilt and reshipped for each JRE version, whereas the reality is there tends to be just one that covers multiple versions fine from the same binary file).