product-apim icon indicating copy to clipboard operation
product-apim copied to clipboard

Issue while running profile optimization for Control Plane and TM profiles in APIM 4.0

Open npamudika opened this issue 3 years ago • 3 comments

Describe your problem(s)

While starting the TM and Control Plane profiles in APIM 4.0.0 U2 pack level 46, after optimizing it gave FileNotFound errors for the files at repository/deployment/server/synapse-configs/default/inbound-endpoints/ and after adding the 4 files, the issues are solved.

Sample Command -

sh api-manager.sh --optimize -Dprofile=control-plane

Sample Error -

[2021-11-03 17:46:58] INFO - Starting to optimize API Manager for the Control Plane profile
[2021-11-03 17:46:58] INFO - Starting to optimize configs in deployment.toml
[2021-11-03 17:46:58] INFO - Renamed the existing ../repository/conf/deployment.toml file as deployment.toml.backup
[2021-11-03 17:46:58] INFO - Copied the existing ../repository/resources/conf/deployment-templates/control-plane.toml file as ../repository/conf/deployment.toml
[2021-11-03 17:46:58] INFO - Removed the WebSocketInboundEndpoint.xml file from ../repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the WebSocketInboundEndpoint.xml.j2 file from ../repository/resources/conf/templates/repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the SecureWebSocketInboundEndpoint.xml file from ../repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the SecureWebSocketInboundEndpoint.xml.j2 file from ../repository/resources/conf/templates/repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the WebhookServer.xml file from ../repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the WebhookServer.xml.j2 file from ../repository/resources/conf/templates/repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the SecureWebhookServer.xml file from ../repository/deployment/server/synapse-configs/default/inbound-endpoints/
[2021-11-03 17:46:58] INFO - Removed the SecureWebhookServer.xml.j2 file from ../repository/resources/conf/templates/repository/deployment/server/synapse-configs/default/inbound-endpoints/
Finished the optimizations
Starting the server...
JAVA_HOME environment variable is set to /usr/lib/jvm/java-11-openjdk-amd64
CARBON_HOME environment variable is set to /home/naduni/patches/wso2am-4.0.0
Using Java memory options: -Xms256m -Xmx1024m
[2021-11-03 17:47:00,824]  SEVERE {org.wso2.carbon.server.Main handleConfiguration} - Error while performing configuration changes 
org.wso2.config.mapper.ConfigParserException: Error while reading metadata
	at org.wso2.config.mapper.MetaDataParser.readLastModifiedValue(MetaDataParser.java:76)
	at org.wso2.config.mapper.MetaDataParser.getChangedFiles(MetaDataParser.java:164)
	at org.wso2.config.mapper.ConfigParser.parse(ConfigParser.java:108)
	at org.wso2.carbon.server.Main.handleConfiguration(Main.java:236)
	at org.wso2.carbon.server.Main.main(Main.java:107)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.wso2.carbon.bootstrap.Bootstrap.loadClass(Bootstrap.java:69)
	at org.wso2.carbon.bootstrap.Bootstrap.main(Bootstrap.java:51)
Caused by: java.io.FileNotFoundException: /home/naduni/patches/wso2am-4.0.0/repository/deployment/server/synapse-configs/default/inbound-endpoints/WebhookServer.xml (No such file or directory)
	at java.base/java.io.FileInputStream.open0(Native Method)
	at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
	at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
	at org.wso2.config.mapper.MetaDataParser.getMetadata(MetaDataParser.java:97)
	at org.wso2.config.mapper.MetaDataParser.readLastModifiedValue(MetaDataParser.java:74)
	... 10 more

npamudika avatar Nov 03 '21 12:11 npamudika

hi, same here. Any fix or workaround ?

damoebius avatar Mar 24 '22 13:03 damoebius

Ok, i get it.

TIL :

  • running sh api-manager.sh --optimize -Dprofile=control-plane the first time worked but failed the second time with error above
  • running sh api-manager.sh -Dprofile=control-plane the first time failed

What's worked for me

  1. running sh profileSetup.sh -Dprofile=control-plane once before launching anything else
  2. running sh api-manager.sh -Dprofile=control-plane always works

Documentation isn't really clear : https://apim.docs.wso2.com/en/latest/install-and-setup/setup/distributed-deployment/deploying-wso2-api-m-in-a-distributed-setup/

damoebius avatar Mar 25 '22 10:03 damoebius

Same issue in APIM 4.1.0

maron546 avatar May 17 '22 10:05 maron546