Migrating the wso2 APIs and Applications to a Different Environment - wso2

I'm setting up the API Manager Import and Export tooling for which we need deploy "api-import-export-2.6.0-v10.war" file to "/repository/deployment/server/webapps folder" where as it is throwing an error.
StandardContext Servlet [JAXServlet] in web application [/api-import-export-2.6.0-v10] threw load() exception
I'm using API Manager 2.6.0 and deployed "api-import-export-2.6.0-v10.war" which is of same version .war file. Tried another system where the error was same.
ERROR - StandardContext Servlet [JAXServlet] in web application [/api-import-export-2.6.0-v10] threw load() exception
java.lang.ClassNotFoundException: org.apache.cxf.transport.servlet.CXFServlet

Try a previous version of the jar and let me know if it works.

To use the latest war file, you need to WUM update WSO2 APIM 2.6.0. You are getting this error as you have not WUM updated the WSO2 APIM 2.6.0. In the docs, under step 1 you can get the previous version[1] or you can WUM update WSO2 API Manager following [2].
[1] - https://docs.wso2.com/display/AM260/Migrating+the+APIs+and+Applications+to+a+Different+Environment
[2] - https://docs.wso2.com/display/AM260/Updating+WSO2+API+Manager

I have sorted out the issue in my case as version compatibility among apimcli, import/export war file and WSO2 API-M server.
Issue was occurred due to the version (api-import-export-2.6.0-v10) mentioned as compatible by WSO2 not working properly with our APIM server and tried lowering the version and worked properly now.
WSO2 API-M version: 2.6.0
Import/Export tool version: APIMCLI v2.0.1
[Zip file downloaded for apimcli is ready for use no additional config was needed in my case]
Import/Export WAR file version: api-import-export-2.5.0-v1
[war file has been hot deployed to below path wso2am/2.6.0/repository/deployment/server/webapps/]
Below Commands executed:
Exported an already created API from DEV environment:
$ ./apimcli export-api -n ProfileManagementNJ -v v1.0.0 -r admin -e dev -k
Successfully exported API!
Find the exported API at /home/stwso2/.wso2apimcli/exported/apis/dev/ProfileManagementNJ_v1.0.0.zip
Imported the above exported API to ST environment:
$ ./apimcli import-api -k -f /home/stwso2/.wso2apimcli/exported/apis/dev/ProfileManagementNJ_v1.0.0.zip -e st --preserve-provider false
Successfully imported API
Actual error message details can be found as in below and are captured from console log:
$ ./apimcli export-api -n ProfileManagementNJ -v 1.0.0 -r admin -e st -k --verbose
Executed ImportExportCLI (apimcli) on Wed, 30 Oct 2019 13:41:52 UTC
[INFO]: Insecure: true
[INFO]: export-api called
[INFO]: ExportAPI: URL: https://172.26.41.4:9443/api-import-export-2.6.0-v10/export-api?name=ProfileManagementNJ&version=1.0.0&provider=admin&preserveStatus=true
apimcli: Error while exporting Reason: Get https://172.26.41.4:9443/carbon/admin/login.jsp: Auto redirect is disabled
Exit status 1
For more details on apimcli setup: https://docs.wso2.com/display/AM260/Migrating+the+APIs+to+a+Different+Environment#Example-exportAPI

Related

Cannot login to an environment using apictl tool

I'm using APIM version 3.0.0, apictl version 3.0.1 and I have APIM up and running on windows. I also created an environment named dev.
However, when I try to login to the dev environment using the below command, an error occurs.
Command: apictl login dev -u admin -p admin -k
Error: Warning: Using --password in CLI is not secure. Use --password-stdin
apictl: Error in connecting. Reason: Post https://localhost:9443/carbon/admin/login.jsp: Auto redirect is disabled
PS: I also set up the environment variables using the main_config.yaml, as below.
NAME API MANAGER ENDPOINT REGISTRATION ENDPOINT TOKEN ENDPOINT
dev https://localhost:9443 https://localhost:9443/register https://localhost:8243/token
Any suggestive approach to solve this issue is much appreciated.
Thanks
Seems you have used the endpoints names and values as in APICTL 3.1.0. Please note that, in APICTL 3.1.0, the endpoint names and values have been modified. Can you please try adding like below to be matched for APICTL 3.0.1 version?
apictl add-env -e production --registration https://localhost:9444/client-registration/v0.15/register --apim https://localhost:9444 --token https://localhost:8244/token --admin https://localhost:9444/api/am/admin/v0.15 --api_list https://localhost:9444/api/am/publisher/v0.15/apis --app_list https://localhost:9444/api/am/store/v0.15/applications

Importing/Migrating an API from Local Repo/ Environment to Other Environment

I tried to export/import an API from one environment to other environment, where as Exporting is working fine but facing issues while Importing an API from Local/Environment
I have used api-import-export-2.6.0.war with APIM-2.6.0,
Command used to Import api: apimcli import-api -f G:/Petstore_1.0.0.zip -e dev
Error importing API Reason: C:\Users\RAVIKU~1\AppData\Local\Temp\apim130994779\Petstore_1.0.0\Meta-information\api was not found as a YAML or JSON
Exit status 1
Did you try giving the import API command the API file name as <environment>/file_name; where <environment> is the environment where the zip file exists[1].
apimcli import-api -f <environment>/Petstore_1.0.0.zip -e dev
[1].https://docs.wso2.com/display/AM260/Migrating+the+APIs+and+Applications+to+a+Different+Environment#MigratingtheAPIsandApplicationstoaDifferentEnvironment-ImportinganAPI
The version of the API Import and Export web application is compatible with the WSO2 WUM. Meanwhile please check with that also.

Error Wso2 "Problem accessing: /. Reason: Not Found" when I try to log in Api Manager after configure Api Analytics

I've installed Wso2 Api Manager a few days ago follow this intructions:
1. I've downloaded https://wso2.com/api-management/install.
2. I've installed using the wizard in C:\Program Files\WSO2\API Manager directory.
3. I've initialize Api Manger console, then created some apis from https://localhost:9443/publisher .
Now, I want to see some statistics (https://192.168.138.117:9443/publisher/site/pages/all-statistics.jag?page=api-usage-user&stat=all-stat). I've read that API Analytics has to be configured, so I carried out the following steps (https://docs.wso2.com/display/AM260/Configuring+APIM+Analytics#ConfiguringAPIMAnalytics-Step1-DownloadandinstallWSO2API-M).
I download it (https://wso2.com/api-management/install/analytics).
Unzip file in C:\WSO2\wso2am-analytics-2.6.0.
I've created and Environment Variables called JAVA_HOME. In value field, I typed the installation path of the Java Development Kit, C:\Program Files\Java\jdk1.8.0_191.
I edited the tag true in the file "C:\Program Files\WSO2\API Manager\2.6.0\repository\conf\api-manager.xml".
I exec this command in cmd windows: "C:\WSO2\wso2am-analytics-2.6.0>worker.bat -run". It excecuted some process and aparentely everything was ok.
Finally, I run another windows console and exec: "C:\Program Files\WSO2\API Manager\2.6.0\bin>wso2server.bat -run".
Now, when I try to log in https://localhost:9443/publisher, /store o /carbon, I'm getting this error:
Problem accessing: /. Reason: Not Found
If I only lunch the Api Manager, it works perfectly but I can't get the statistics.
Did you follow Quick setup?
To access Analytics you need to carry out Standard Setup which includes:
Creating Analytics DB with the "am_usage_uploaded_files" table in addition
Configuring /conf/dashboard/deployment.yaml --> APIM_ANALYTICS_DB
Configuring /conf/worker/deployment.yaml --> APIM_ANALYTICS_DB
Configure /conf/worker/deployment.yaml --> WSO2AM_MGW_ANALYTICS_DB
And then starting the worker which creates the rest tables for analytics.

Not able to apply the mobile server patch in WSO2 mobile server 1.0.0

I am configuring the wso2 mobile server for accessing an app from wso2 app manager.The steps at https://docs.wso2.com/display/APPM100/Integrating+a+Mobile+Device+Manager say to apply a patch by the command patch -Np1 -d emm/ < emm-appm.patch.This is not working for my linux machine.I have modified the command to point my EMM_HOME patch -Np1 < emm-appm.patch.The console says patching file api/appManager.js
can't find file to patch at input line 133
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
|diff -rupN emm/api/deviceRouter.js emm-mod/api/deviceRouter.js
|--- emm/api/deviceRouter.js 2014-06-10 22:53:52.000000000 +0530
|+++ emm-mod/api/deviceRouter.js 2015-03-31 19:24:37.065589000 +0530
File to patch:
The above command is for EMM 1.1.0.
The instructions for executing the command as as follows.
Copy the content in [1] to a file named emm-appm.patch
Copy the file to wso2emm-1.1.0/repository/deployment/server/jaggeryapps folder
Navigate to wso2emm-1.1.0/repository/deployment/server/jaggeryapps folder
Execute the command patch -Np1 -d emm/ < emm-appm.patch
[1] https://docs.wso2.com/download/attachments/45955719/emm-appm.patch?version=1&modificationDate=1430419323000&api=v2

AWS elastic beanstalk git deployment suddenly failing due to composer issue despite no changes to composer.json

I have a number of environments running in AWS Elastic Beanstalk. I deploy direct from git using git aws.push.
I use composer.json to install required php sdk's. I've not changed this file for a long time but it's suddenly started failing in all environments.
Output from the AWS logs is
+ echo 'Found composer.json file. Attempting to install vendors.'
Found composer.json file. Attempting to install vendors.
+ composer.phar install --no-ansi --no-interaction
Loading composer repositories with package information
Installing dependencies
[RuntimeException]
Could not load package aws/aws-sdk-php in http://packagist.org: [UnexpectedValueException] Could not parse version constraint ^5.3: Invalid version string "^5.3"
[UnexpectedValueException]
Could not parse version constraint ^5.3: Invalid version string "^5.3"
install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-scripts] [--no-progress] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader]
2015-05-28 09:57:18,414 [ERROR] (15056 MainThread) [directoryHooksExecutor.py-33] [root directoryHooksExecutor error] Script /opt/elasticbeanstalk/hooks/appdeploy/pre/10_composer_install.sh failed with returncode 1
my composer.json is:
{
"require": {
"aws/aws-sdk-php": "2.7.*",
"monolog/monolog": "1.0.*",
"facebook/php-sdk-v4" : "4.0.*",
"ext-curl": "*",
"paypal/sdk-core-php": "v1.4.2",
"paypal/permissions-sdk-php":"v2.5.106",
"paypal/adaptivepayments-sdk-php":"2.*"
}
}
I notice it does want the aws-sdk-php but the version is not 5.3 (which is mentioned in the logs).
5.3 makes me think php version, checking php -v i get
php -v
PHP 5.5.12 (cli) (built: May 20 2014 22:27:36)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2014, by Zend Technologies
I've tried re-installing older versions that have previously installed fine and they also fail with the same error. This has to be due to the environment. Does anyone know if there have been changes recently.
Create a folder in your root of the project called .ebextensions. Then create a new file in there called 01-composer-install.config with the following content.
commands:
01_update_composer:
command: export COMPOSER_HOME=/root && /usr/bin/composer.phar self-update
option_settings:
- namespace: aws:elasticbeanstalk:application:environment
option_name: COMPOSER_HOME
value: /root
I just had to update composer using the instructions here:
https://getcomposer.org/download/