WSO2 api manager 30.2.0 change db to oracle not working - wso2

WSO2 api manager 3.2.0 change db to oracle not working.
I excuted script in oracle and
I copied oracle jdbc8 jar in lib folder and
deployments.toml config as following :
[user_store]
type = "database_unique_id"
[database.shared_db]
type = "oracle"
url = "jdbc:oracle:thin:#172.24.64.3:1521/TEST_PDB"
username = "shared_db"
password = "shared_db"
driver = "oracle.jdbc.driver.OracleDriver"
validationQuery = "SELECT 1 FROM DUAL"
[database.apim_db]
type = "oracle"
url = "jdbc:oracle:thin:#172.24.64.3:1521/TEST_PDB"
username = "apim_db"
password = "apim_db"
driver = "oracle.jdbc.driver.OracleDriver"
validationQuery = "SELECT 1 FROM DUAL"
exception :
ERROR - DefaultRealm nullType class java.lang.reflect.InvocationTargetException

Is the db reachable?
Have you tried connecting to the db using a client?

Related

WSO2 APIManager (v4.1.0) response code 404 after publishing new APIs (needs restart)

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:
Delete the Application and publish a new API
Dupplicate adds a new API with the same information as Application before.
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,
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"]

wso2 3.2 how to browse H2 DB console

I am using wso2 3.2. I just wanted to browse the local H2 DB.
Can anyone know the full steps?
I am did some changes in deployment.toml file as below & restarted the server, but the
console is not opening.
[database.local]
type = "h2"
url = "jdbc:h2:C:/Tools/wso2am-
3.2.0/repository/database/WSO2CARBON_DB;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE"
enable_h2_console = "true"
port = "1010"
username = "wso2carbon"
password = "wso2carbon"
[database.apim_db]
type = "h2"
url = "jdbc:h2:C:/Tools/wso2am-
3.2.0/repository/database/WSO2AM_DB;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE"
username = "wso2carbon"
password = "wso2carbon"
enable_h2_console = "true"
port = "1010"
[database.shared_db]
type = "h2"
url = "jdbc:h2:C:/Tools/wso2am-3.2.0/repository/
database/WSO2SHARED_DB;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE"
username = "wso2carbon"
password = "wso2carbon"
enable_h2_console = "true"
port = "1010"
You need to add the following configuration to the deployment.toml.
[database_configuration]
enable_h2_console = true
Reference: https://apim.docs.wso2.com/en/3.2.0/reference/config-catalog/#enabling-the-h2-database-console
Once the H2 console is loaded, enter the JDBC URL, Username and Password to Connect to the database.
According to your configuration, enter the following values to connect to the apim_db database.
JDBC URL: jdbc:h2:C:/Tools/wso2am-
3.2.0/repository/database/WSO2AM_DB;AUTO_SERVER=TRUE;DB_CLOSE_ON_EXIT=FALSE
User Name: wso2carbon
Password: wso2carbon

WSO2 API Manager(wso2am-3.2.0) 403 Forbidden Error When Adding a Secondary JDBC Userstore from Carbon Console

We are using wso2am-3.2.0(downloaded from Github) and the following error appears in the browser when creating a secondary jdbc userstore. The test connection option tells that the connection is healthy as well.
In the wso2carbon.log the following null pointer error appears.
TID: [-1] [] [2021-11-03 11:50:08,103] ERROR {org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve} - Could not handle request: null java.lang.NullPointerException
at org.wso2.carbon.tomcat.ext.internal.Utils.getTenantDomain(Utils.java:41)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.initCarbonContext(CarbonContextCreatorValve.java:79)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:56)
at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:119)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1639)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Any input to fix this issue is very much appreciated.
Thanks in advance.
OS: Linux
Database: MariaDB
Userstore: JDBC
The changes made in the deployment.toml are as follows.
[server]
hostname = "<hostname>"
node_ip = "<ip>"
#offset=0
mode = "single" #single or ha
base_path = "${carbon.protocol}://${carbon.host}:${carbon.management.port}"
#discard_empty_caches = false
server_role = "default"
[super_admin]
username = "admin"
password = "<new_password>"
create_admin_account = true
[user_store]
type = "database_unique_id"
[database.apim_db]
type = "mysql"
url = "jdbc:mysql://<ip>:3306/am_db"
username = "<username>"
password = "<password>"
[database.shared_db]
type = "mysql"
url = "jdbc:mysql://<ip>:3306/reg_db"
username = "<username>"
password = "<password>"

WSO2 AM - Publish API - Caused by: javax.naming.ConfigurationException

I'm trying to publish an API in WSO2 API Manager and when I try to Publish it shows an error:
cup-api-manager | Caused by: javax.naming.ConfigurationException: Failed to parse entry: Null
password in user information not allowed. between indicies 7 and 5
cup-api-manager | amqp://admin#wso2.com:***#clientid/carbon?brokerlist='tcp://172.28.0.5:5672'
cup-api-manager | ^^^^^ due to : Null password in user information not allowed. at index
7: amqp://admin#wso2.com:***#clientid/carbon?brokerlist='tcp://172.28.0.5:5672'
I've changed my deployment.toml to use an email as user and also a user from LDAP:
[super_admin]
username = "admin#wso2.com"
password = "admin"
create_admin_account = true
[user_store]
type = "read_write_ldap"
connection_url = "ldap://openldap:389"
....
[tenant_mgt]
enable_email_domain= true
I'm using a docker-compose with all the services and IS as Key Manager.
wso2is:5.10.0-alpine
wso2am:3.2.0-alpine
As #RrR said I needed to put the throttling configuration in deployment.toml:
[apim.throttling]
enable_data_publishing = false
enable_decision_connection = false
receiver_username = "$ref{super_admin.username}"
[apim.throttling.policy_deploy]
username = "$ref{super_admin.username}"
[apim.throttling.jms]
username = "$ref{super_admin.username}"
password = "$ref{super_admin.password}"

how to configure datasources in wso2 IS as KM 5.9.0?

How to configure datasources for WSO2_CARBON_DB, WSO2_MB_STORE_DB, WSO2_METRICS_DB, WSO2UM_DB in deployment.toml to change it from H2 to mysql? How to write correct records in deployment.toml? I added records for mysql, but IS still uses H2, not mysql, in master-datasources.xml configurations are for H2, not for mysql. My config:
[database.carbon]
type = "mysql"
url = "jdbc:mysql://is.com:3306/WSO2CARBON_DB?autoReconnect=true"
username = "wso2carbon"
password = "wso2carbon"
[database.mb]
type = "mysql"
url = "jdbc:mysql://is.com:3306/WSO2MB_DB?autoReconnect=true"
username = "wso2carbon"
password = "wso2carbon"
[database.metrics]
type = "mysql"
url = "jdbc:mysql://is.com:3306/WSO2METRICS_DB?autoReconnect=true"
username = "wso2carbon"
password = "wso2carbon"
[database.WSO2UM_DB]
type = "mysql"
url = "jdbc:mysql://is.com:3306/userdb?autoReconnect=true"
username = "wso2carbon"
password = "wso2carbon"
You do not need to configure CARBON_DB as this database has the internal data related to the product. This data is stored in the embedded H2 database.
But a SHARED_DB has been introduced in the newer version, this database contains the registry and user management data. But as in the previous version, you can configure different databases for registry and user management.
You can configured SHARED_DB by adding following configuration:
[database.shared_db]
type = "mysql"
url = "jdbc:mysql://localhost:3306/reg_db"
username = "username"
password = "password"
You can configure User management DB by adding the configuration as:
[database.user]
type = "mysql"
url = "jdbc:mysql://is.com:3306/userdb?autoReconnect=true"
username = "wso2carbon"
password = "wso2carbon"
For UM_DB, if you want to add additional properties, you can add parameters in following format:
pool_options.maxActive = 50
pool_options.maxWait = 60000
pool_options.defaultAutoCommit = false
To configure other databases, you can follow the approach mentioned below. For example, to configure MB_DB, add following configuration:
[[datasource]]
id = "WSO2_MB_STORE_DB"
url = "jdbc:mysql://is.com:3306/WSO2MB_DB?autoReconnect=true"
username = "username"
password = "password"
driver = "com.mysql.jdbc.Driver"
validationQuery = "SELECT 1"
pool_options.maxActive = 50
pool_options.maxWait = 60000
pool_options.validationInterval = 30000
pool_options.defaultAutoCommit = false
I have exactly the same problems setting up the dbs for WSO2 API manager 3.0.0: I can add mysql type datasources for MB_STORE_DB and CARBON_DB but H2 types still alive in master-datasources.xml.
By the way it is not clear for me if the carbon DB needs or not to be shared between nodes while configuring an Active-Active Deployment solution.
Thanks, Bernard