Reputation: 21
I have implemented a publisher 1 new API on WSO2 v4.1.0 system, the API status has been Published, but after I Subscriptions and call the API by Postman, I get 404 error code. In log carbon, it says API not found. .
I have tried several ways like:
The result is still 404 error code.
In case if I restart wso2 apim, the API works normally, no more 404 error code.
Has anyone encountered the same error as me? Please assist me with the solution.
This is my deployment.toml, and I run on only one server (not use loadbalance)
[server]
hostname = "***.****.****.****
base_path = "${carbon.protocol}://${carbon.host}:${carbon.management.port}"
server_role = "default"
[super_admin]
username = "******"
password = "******"
create_admin_account = true
[user_store]
type = "database_unique_id"
#mssql database
[database.apim_db]
type = "mssql"
url = "jdbc:sqlserver://***.****.****.****:****;databaseName=WSO2AM_INT_DB;SendStringParametersAsUnicode=false;encrypt=true;trustServerCertificate=true"
username = "*******"
password = "******
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
validationQuery = "SELECT 1"
[database.shared_db]
type = "mssql"
url = "jdbc:sqlserver://***.****.****.****:****;databaseName=WSO2_SHARED_INT_DB;SendStringParametersAsUnicode=false;encrypt=true;trustServerCertificate=true"
username = "*****"
password = "******"
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
validationQuery = "SELECT 1"
[database.stats_db]
type = "mssql"
url = "jdbc:sqlserver://***.****.****.****:****;databaseName=WSO2_STATS_INT_DB;SendStringParametersAsUnicode=false;encrypt=true;trustServerCertificate=true"
username = "*******"
password = "*******"
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
validationQuery = "SELECT 1"
[[apim.gateway.environment]]
name = "Default"
type = "hybrid"
provider = "wso2"
display_in_api_console = true
description = "This is a hybrid gateway that handles both production and sandbox token traffic."
show_as_token_endpoint_url = true
service_url = "https://***.****.****.****:${mgt.transport.https.port}/services/"
username= "${admin.username}"
password= "${admin.password}"
ws_endpoint = "ws://localhost:9099"
wss_endpoint = "wss://localhost:8099"
http_endpoint = "http://***.****.****.****:${http.nio.port}"
https_endpoint = "https://***.****.****.****:${https.nio.port}"
websub_event_receiver_http_endpoint = "http://localhost:9021"
websub_event_receiver_https_endpoint = "https://localhost:8021"
[apim.sync_runtime_artifacts.gateway]
gateway_labels =["Default"]
[apim.analytics]
enable = false
auth_token = ""
[apim.devportal]
url = "https://***.****.****.****:${mgt.transport.https.port}/devportal"
[apim.cors]
allow_origins = "*"
allow_methods = ["GET","PUT","POST","DELETE","PATCH","OPTIONS"]
allow_headers = ["authorization","Access-Control-Allow-Origin","Content-Type","SOAPAction","apikey","Internal-Key"]
allow_credentials = false
[[event_handler]]
name="userPostSelfRegistration"
subscriptions=["POST_ADD_USER"]
[service_provider]
sp_name_regex = "^[\\sa-zA-Z0-9._-]*$"
#mssql database
[database.local]
type = "mssql"
url = "jdbc:sqlserver://***.****.****.****:****;databaseName=WSO2_CARBON_INT_DB;SendStringParametersAsUnicode=false;encrypt=true;trustServerCertificate=true"
username = "******"
password = "*****"
driver = "com.microsoft.sqlserver.jdbc.SQLServerDriver"
validationQuery = "SELECT 1"
[[event_listener]]
id = "token_revocation"
type = "org.wso2.carbon.identity.core.handler.AbstractIdentityHandler"
name = "org.wso2.is.notification.ApimOauthEventInterceptor"
order = 1
[event_listener.properties]
notification_endpoint = "https://***.****.****.****:${mgt.transport.https.port}/internal/data/v1/notify"
username = "${admin.username}"
password = "${admin.password}"
'header.X-WSO2-KEY-MANAGER' = "default"
[oauth.grant_type.token_exchange]
enable = true
allow_refresh_tokens = true
iat_validity_period = "1h"
# Enabling Zipkin Tracing
[apim.open_tracer]
remote_tracer.enable = true
remote_tracer.name = "zipkin"
remote_tracer.properties.hostname = "***.****.****.****"
remote_tracer.properties.port = "9411"
Sincerely thank you,
Upvotes: 1
Views: 691
Reputation: 1031
If you API is only available after server restart and is not available when you deploy, there should be an issue with the jms connection between the CP and GW. API deployment events are not received by the gateway thus preventing them from deploying in the gateway. These events are distributed between CP and GW via jms. APIs get deployed in the restart means, the gateway can reach to event hub (which resides in the same instance because this is an all-in-one deployment) via HTTP.
Shall we add the following configuration and see whether this solves your issue?
[apim.event_hub]
enable = true
username = "$ref{super_admin.username}"
password = "$ref{super_admin.password}"
service_url = "https://<control-plane-host>:${mgt.transport.https.port}/services/"
event_listening_endpoints = ["tcp://<control-plane-host>:5672"]
Upvotes: 0