Discovery Listener Exception in Endevor Web Services (WSTOMSTC)
search cancel

Discovery Listener Exception in Endevor Web Services (WSTOMSTC)

book

Article ID: 136970

calendar_today

Updated On:

Products

Endevor Endevor - ECLIPSE Plugin

Issue/Introduction

Endevor Tomcat/Web Services had been up and operational for several weeks.  After recycled Tomcat/Web Services this past weekend found following error in Tomcat STC (WSTOMSTC) log and WSEWSSTC is not being spawned:

SEVERE: Exception sending context initialized event to listener instance of class [com.ca.mfaas.eurekaservice.RestDiscoveryListener]
 java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key eureka.name
  at java.util.ResourceBundle.getObject(ResourceBundle.java:461)
  at java.util.ResourceBundle.getString(ResourceBundle.java:418)
  at com.ca.mfaas.eurekaservice.RestDiscoveryListener.initializeApplicationInfoManager(RestDiscoveryListener.java:36)

Environment

Endevor 18.0.12 Only 

Cause

1. When Tomcat starts, it will deploy EndevorService.war into its own directory /tomcat/webapps/EndevorService/ 
2. After that Web Services are being initialized, which means two listeners will be executed.
3. First Web Services Listener InitialServiceSetupListener, which will update file eureka-client.properties with values from enws.properties
4. Then mfaas listener RestDiscoveryListener, which reads eureka-client.properties and load all the properties from that bundle.

From the Tomcat job log:
 [INFO] Endevor Webservice properties file found: /cai/CADeploy/ESCM/tpv/tomcat/webapps/endevor/enws.properties  <- InitialServiceSetupListener

 [INFO] Updating eureka-client.properties    <- InitialServiceSetupListener  
 [WARN] No URLs will be polled as dynamic configuration sources.
 [INFO] To enable URLs as dynamic configuration sources, define System property archaius.configurationSource.additionalUrls or make config.properties available on classpath.
 [INFO] DynamicPropertyFactory is initialized with configuration sources: .config.ConcurrentCompositeConfiguration
 [INFO] Loaded properties file file:/cai/CADeploy/ESCM/tpv/tomcat/webapps/EndevorService/WEB-INF/classes/eureka-client.properties <- RestDiscoveryListener

And here is error: 
SEVERE: Exception sending context initialized event to listener instance of class [com.ca.mfaas.eurekaservice.RestDiscoveryListener]
 java.util.MissingResourceException: Can't find resource for bundle java.util.PropertyResourceBundle, key eureka.name
  at java.util.ResourceBundle.getObject(ResourceBundle.java:461)
  at java.util.ResourceBundle.getString(ResourceBundle.java:418)
  at com.ca.mfaas.eurekaservice.RestDiscoveryListener.initializeApplicationInfoManager(RestDiscoveryListener.java:36)

The code in that line is trying to do something like this:

private static ResourceBundle eurekaProperties = ResourceBundle.getBundle("eureka-client");

String serviceId = eurekaProperties.getString("eureka.name");

This means, that it loads the bundle from class path, which should be /cai/CADeploy/ESCM/tpv/tomcat/webapps/EndevorService/WEB-INF/ 
Then it tries to get eureka.name from it. And that's where it fails and gives the first error with missing key.

Resolution

The file /cai/CADeploy/ESCM/tpv/tomcat/webapps/EndevorService/WEB-INF/classes/eureka-client.properties is empty (possibly due to IPL). 
After copy eureka-client.properties from a backup and recycled Tomcat, Tomcat is up and running. 

Alternative options if backup of eureka-client.properties is not available:
1. Stop Tomcat
Rename or delete /cai/CADeploy/ESCM/tpv/tomcat/webapps/endevor/enws.properties
Rename or delete /cai/CADeploy/ESCM/tpv/tomcat/webapps/EndevorService
Restart Tomcat
That should create new tomcat/webapps/EndevorService at runtime with new/default eureka-client.properties file

2. After trying option #1, if Tomcat still fails with the same error exception:
If have enough space, rename /cai/CADeploy/ESCM/tpv/tomcat to /cai/CADeploy/ESCM/tpv/tomcat_bk. Otherwise delete that directory but first backup any customised files (ENDEVOR.cfg, server.xml) for use during the reinstall process.
Then reinstall web service by running ENWSIns.sh
During the installation when prompted for:
CLEAN_ENDEVOR_TOMCAT_INSTANCE yes or no
Enter yes