Accessing configuration parameters from a Groovy script

  • Brett G. Palmer

    Brett G. Palmer - 2014-04-25

    I'm new to YAJSW but I'm trying to use the framework to write different groovy scripts to monitor various aspects of our application.

    Here are my questions:

    1. From my groovy file how can I access the configuration properties that were passed to the wrapper process. For example, if I wanted to include a username and password for the application I would like to read them from the configuration file that was loaded with the process.

    Is there a best practice for doing this type of task in YAJSW?

    1. I have an external process that calls these monitor scripts. Should I just be using the file to run a single YAJSW groovy script as I just need to script to exit with a status result?

    Thanks in advance for your help.


  • rzo

    rzo - 2014-04-26


    your questions are not clear to me.

    1. Do you have a java application which is wrapped using yajsw, and you are using groovy scripts which you are refering to in the configuration file (example: send mail) ?

    2. do you have groovy scripts which are wrapped by yajsw and which are doing monitoring of some other application ?

    3. you have a groovy script which is independent of yajsw and needs to access the configuration ?

    for 1: try the following:


    for 2:


    for 3:

    System.setProperty("wrapper.config", full path to config file);
    conf = new YajswConfigurationImpl();

    the second question is not clear. could you please elaborate.

    -- Ron

    • Brett G. Palmer

      Brett G. Palmer - 2014-04-29


      Thanks for the quick reply. I am trying to use option 2 that you indicated in your reply. I have a groovy script that I have placed in the script directory. I want to use yajsw to call the script and execute it. I will be using yajsw to call multiple groovy scripts to monitor different parts of our application. I wanted to use yajsw as a standard framework for calling these scripts.

      I am currently trying to test my script using runScript.bat.

      for example:

      runScript.bat scripts/myapp/myapp.conf scripts/myapp/monitorapp.gv

      When I try to reference the WRAPPER_MANAGER.getProperties() in the groovy script I get an error saying:

      “error initializing script….”

      I don’t see any other information in the log files. I'm sure the error is a class not found exception or something like that.

      Here are my follow up questions:

      1. I would like my groovy scripts to have access the to yajsw configuration file that is used to run the script. Then I can include custom properties like authentication information for my application.

      What is the proper way to reference the WRAPPER_MANAGER.getProperties() as it is currently giving me an initializing error.

      1. Where can I find the stack trace for the groovy error that I am seeing in the script? I looked in the wrapper.groovy.log but don’t see the error.



  • rzo

    rzo - 2014-04-29


    it is still not clear to me what you are doing.
    pls post your configuration file, and your script. (or send them per mail)

    runScript.bat is only used to test scripts for case 1.

    -- Ron


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks