How to set a JVM property for all the Jobs executed by a JobServer on Windows

Problem Description

In some cases, it is necessary to set a JVM property, for example -Dfile.encoding=UTF-8, for all Jobs executed by a JobServer.

 

Solution

For the JobServer Windows Service created by the installer:

  1. Edit the wrapper.conf file located in the folder \jobserver\TalendServices\conf, and add the line:
    wrapper.app.env._JAVA_OPTIONS=-Dfile.encoding=UTF-8

    Under the paragraph:

    #*******************************************************************
    # Application environment properties.
    #*******************************************************************
    # Adds an environment to the application

    Example:

    #*******************************************************************
    # Application environment properties.
    #*******************************************************************
    # Adds an environment to the application
    wrapper.app.env._JAVA_OPTIONS=-Dfile.encoding=UTF-8
  2. Restart the JobServer.

 

For a JobServer created with jsl_static64.exe:

  1. In the file jsl_static64.ini, add the following to the beginning of the file:
    [defines]
    _JAVA_OPTIONS=-Dfile.encoding=UTF-8
    export=_JAVA_OPTIONS
  2. Restart the JobServer.
Version history
Revision #:
3 of 3
Last update:
‎05-30-2018 11:37 AM
Updated by:
 
Contributors
Comments
apemble

I don't believe this is correct - the jvm of the jobserver and the jvm of the jobs are two different things. The jobserver will launch a new jvm for each job using the properties defined on the job or the task on TAC.

dsegard2

The solution is correct , tested and  validated.

 

_JAVA_OPTIONS is an environment variable and if an environment variable is set for the JobServer process, it will be "inherited" by processes started by the jobserver (so, by the java processes executing the jobs).

You can verify this by using the job provided in : https://community.talend.com/t5/Troubleshooting-Internal/Job-to-dump-the-JobServer-JVM-properties-En...

apemble

Interesting - I didn't know that.

 

However - its still not something we would want to encourage customers to do in most situations. The danger is that someone sets a property on a jobserver and a job behaves differently in studio or another JS without the property set for 'no apparent reason'.

 

IMO - JVM properties should be defined at the job level.

 

Adam

dsegard2

The problem is that some JVM properties are "derived" from OS settings. (typically file.encoding  ... )

So, some jobs that may work with the default JVM settings with the Studio , will fail when executed with a JobServer because the jobserver is running on another System / Other OS.

Of course , you can set the JVM properties in the Job itself or in the TAC task definition , but if you have many jobs , this can be "cumbersome" and if you really want to be in exactly the same environment (same JVM properties), you may have to set a lot or properties for all the jobs.

apemble
To take your file encoding example - typically this is defined at the Talend component level e.g. tFileInputDelimited - when would the JVM parameter be relevant?

dsegard2

In the customer's case , the issue was related to the tMap component , with the option " Store temp data" option