MissingVariableException prevents StreamBase fragment startup

MissingVariableException prevents StreamBase fragment startup

book

Article ID: KB0081200

calendar_today

Updated On:

Products Versions
TIBCO Streaming 10

Description

The TIBCO StreamBaseĀ® server fails to start and shows error:
error (fragment deploy): app.cluster - 2018-04-16 13:55:56.632000-0400 [14148:EventFlow Fragment] ERROR com.tibco.ep.sb.rt.launcher.EventFlowFragment: java.lang.Exception: Fragment package_and_name terminated with status [-1,number,#####}]: Aborting transaction default: 
  java.lang.RuntimeException: 
  java.lang.ClassCastException: 
    com.streambase.sb.expr.ExprContext$MissingVariableException cannot be cast to java.lang.String:

Ā 

Issue/Introduction

How to resolve the MissingVariableException in SB configuration

Resolution

This is a problem with quote handling when defining named values in HOCON configuration. String values may need to be double-quoted (using both double-quotes and single quotes together) in the configuration due to usage context.

For example, this is correct for supplying a substitution value as part of a string constant:
streamBase = {
			constantsOverwrite = {
				"NAMECON" = "'prefix-${NAMESUB:-VALUE_FROM_CONF}-suffix'"	
			}
}

This will raise the above error (missing interior single quotes):
streamBase = {
			constantsOverwrite = {
				"NAMECON" = "prefix-${NAMESUB:-VALUE_FROM_CONF}-suffix"	
			}
}