Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

New Virtualize Java ExtensionTool - overwrite jar?

Options
jefftuckerbofa
jefftuckerbofa Posts: 234

I am creating Java extension tools using the API. As part of this process I am uploading jar file to the system_jars folder. Works sometimes, but if there has been a recent request to a tool that uses that jar I find I can not overwrite or delete the jar. It is considered in-use by another process. I know there is a call to reload jars. Is there a related call to somehow make existing jars available to be overwritten? Thanks JT

Comments

  • jefftuckerbofa
    jefftuckerbofa Posts: 234
    Options

    If not, what is the best practice for updating jars that support ExtensionTools? Thanks JT

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    Options

    Hi,

    The file being in use is probably going to depend on the host OS of the remote Server. Windows tends to lock files more than Linux. There isn't any specific call the allow the jar to be overwritten, the OS is the one locking the file. You could try disabling assets that use that extension to see if it helps and gets the OS to release the file.

    Typically extension jars are updated outside of the product and may require a server stop/start to ensure the jar file can be overwritten and properly reloaded.

  • benken_parasoft
    benken_parasoft Posts: 1,231 ✭✭✭
    edited June 2023
    Options

    It is considered in-use by another process.

    Does the error message say "the process cannot access the file" and/or "file is in use by another process"? I am asking because I believe those messages originate from Windows. One thing to consider is that Linux can be more forgiving in allowing files to be overwritten. I am not saying that deploying your server on a different OS is necessarily a realistic solution for you but only something to consider.

    You could also check whether the behavior is impacted by any antivirus software you are running in case the lock is really being held by "another process" like this.

    I know there is a call to reload jars

    Yes. This basically throws away the original ClassLoader and creates a new one for loading those jars. This may eventually release any open locks on the jar files if no scripts are still executing that would still be using the original ClassLoader. So, this is a good measure to take.

  • jefftuckerbofa
    jefftuckerbofa Posts: 234
    Options

    I am actually deploying to several envs for testing purposes and I do believe the one where I am experiencing issues is a Windows server. The only one in the mix. And, it's going away very soon. This may not be an issue. Will confirm and report back. Thanks.

  • jefftuckerbofa
    jefftuckerbofa Posts: 234
    Options

    Thanks guys for the excellent feedback. I can confirm that this only happens on the Windows host. Linux handles things perfectly. I'm off of Windows now so this shouldn't be an issue. JT

  • williammccusker
    williammccusker Posts: 643 ✭✭✭
    Options

    Great new, thanks!