You cannot set global java_home like this:
  "global": {
    "application.def": ...,
    "java_home": "${JAVA_HOME}",

None of the variables that look like ${X} in the appConfig are environment
variables.  They're internal Slider variables that Slider knows how to
substitute for real values.  Once you set global java_home to an actual
path, then you can use the ${JAVA_HOME} variable elsewhere in the
appConfig, and that path will be substituted in.  For example:
    "site.accumulo-env.java_home": "${JAVA_HOME}",

It won't work unless global java_home is set properly.

On Mon, Jun 1, 2015 at 6:01 AM, Nathaniel Braun <[email protected]> wrote:

> Hello,
>
> I'm trying to use the environment JAVA_HOME in my appConfig.json file. It
> fails for a weird reason, and I think I've pinpointed the current behavior:
>
>
> 1.       When the variable is used in the hostLevelParams part, it works:
>   "global": {
>     "application.def": ...",
>     "java_home": "${JAVA_HOME}", ...
>
> I can indeed access the java_home variable using this line of code in my
> Python scripts:
> java_home = config['hostLevelParams']['java_home']
>
>
> 2.       When I use the variable in a specific configuration, it fails:
>
>   "global": {
>     "application.def": "...",
>     "site.global.java_home": "${JAVA_HOME}", ...
>
> The error is as follows:
>
> java.lang.IllegalArgumentException: named capturing group is missing
> trailing '}'
>                 at
> java.util.regex.Matcher.appendReplacement(Matcher.java:792)
>                 at java.util.regex.Matcher.replaceAll(Matcher.java:906)
>                 at java.lang.String.replaceAll(String.java:2162)
>                 at
> org.apache.slider.providers.ProviderUtils.propagateSiteOptions(ProviderUtils.java:296)
>                 at
> org.apache.slider.providers.agent.AgentProviderService.addNamedConfiguration(AgentProviderService.java:2732)
>                 at
> org.apache.slider.providers.agent.AgentProviderService.buildCommandConfigurations(AgentProviderService.java:2639)
>                 at
> org.apache.slider.providers.agent.AgentProviderService.addInstallCommand(AgentProviderService.java:1909)
>                 at
> org.apache.slider.providers.agent.AgentProviderService.handleHeartBeat(AgentProviderService.java:922)
>                 at
> org.apache.slider.server.appmaster.web.rest.agent.AgentResource.heartbeat(AgentResource.java:98)
>                 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>                 at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>                 at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>                 at java.lang.reflect.Method.invoke(Method.java:606)
>                 at
> com.sun.jersey.spi.container.JavaMethodInvokerFactory$1.invoke(JavaMethodInvokerFactory.java:60)
>                 at
> com.sun.jersey.server.impl.model.method.dispatch.AbstractResourceMethodDispatchProvider$TypeOutInvoker._dispatch(AbstractResourceMethodDispatchProvider.java:185)
>
> Have you noticed the same error?
>
> Thanks & regards,
> Nathaniel
>
>

Reply via email to