Error importing Swagger Endpoint - wso2

The swagger file that I have created for my demo end point is valid according to the swagger validator. Unfortunately, when I attempt to import the API into GREG via the swagger json I'm told there is an error. The failure occurs whether I'm importing the file or accessing it via the URL. The message is nearly useless and the stack trace is pasted below:
Caused by: org.wso2.carbon.registry.core.exceptions.RegistryException: Failed to add resource /_system/governance/apimgt/applicationdata/api-docs/0.0.1/api-docs.json. An exception occurred while executing handler chain. Some or all of the arguments may be null. Cannot add the endpoint to registry.
at org.wso2.carbon.registry.resource.services.utils.AddResourceUtil.addResource(AddResourceUtil.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
What is GREG expecting that isn't part of the swagger definition I have created? Why is it throwing an error?

It is currently a limitation with GReg-5.1.0.
https://wso2.org/jira/browse/REGISTRY-3195
Has a workaround, and this will be properly fixed in a later version of the product.

This is fixed in new G-Reg 5.2.0. You can download G-Reg 5.2.0 from here.
If you want to stick to G-Reg 5.1.0, you can always backport the fix by applying this fix as a patch.
Hope this helps.

Related

UserStoreException when connecting wso2 is to oracle

Dears, I tried https://apim.docs.wso2.com/en/latest/install-and-setup/setup/distributed-deployment/configuring-wso2-identity-server-as-a-key-manager/#step-1-download-and-install-wso2-is to use oracle db as shared_db between wso2 api manager and identity server and got this error ? just created databases and set deployment config based on the document.
nullType class java.lang.reflect.InvocationTargetException
org.wso2.carbon.user.core.UserStoreException: nullType class
java.lang.reflect.InvocationTargetException
The same issue was observed here. Check the provided answer.
Seems like changing the region might resolve the issue (if you have configured all others properly including the compatible drivers).

WSO2 Api Manager 3.0 Data Mapper does not work

I have installed wso2 Api Manager 3.0 on my windows by downloading the binaries.
I wonder if the datamapper does work in the v3.0 of the Api Manager.
it does not work in my case.
I am using OOTB sequences, but unfortunately unable to actually save it:
The logs are saying that the XML sequence are not found for the datamapper, regarding the apache-synapse configuration.
Steps to reproduce the issue:
1.)Downlaod AM3.0 Binaries and install in windows machine
2.)Open publisher and create a dummy api and in request mediator select the json_to_xml or any ootb sequences. and click on save button.
SAME FLOW WORK PERFECTLY FINE IN 2.6
Please find the errror log file attached.
Please find the server logs:
org.wso2.carbon.apimgt.api.APIManagementException: Issue is in accessing the Registry[2019-11-18 17:41:43,883] ERROR - APIUtil Issue is in accessing the Registry
[2019-11-18 17:41:43,900] ERROR - APIMappingUtil Error occurred while getting the uuid of the mediation sequence
org.wso2.carbon.apimgt.api.APIManagementException: Issue is in accessing the Registry
at org.wso2.carbon.apimgt.impl.utils.APIUtil.getMediationPolicyAttributes_aroundBody322(APIUtil.java:5438) ~[org.wso2.carbon.apimgt.impl_6.5.349.jar:?]
at org.wso2.carbon.apimgt.impl.utils.APIUtil.getMediationPolicyAttributes(APIUtil.java:5373) ~[org.wso2.carbon.apimgt.impl_6.5.349.jar:?]
at
Caused by: org.wso2.carbon.registry.core.exceptions.ResourceNotFoundException: Resource does not exist at path /_system/governance/apimgt/customsequences\in
at org.wso2.carbon.registry.core.jdbc.handlers.builtin.MountHandler.get(MountHandler.java:449) ~[org.wso2.carbon.registry.core_4.5.1.jar:?]
at org.wso2.carbon.registry.core.jdbc.handlers.HandlerManager.get(HandlerManager.java:2446) ~[org.wso2.carbon.registry.core_4.5.1.jar:?]

Exception running the WSO2 Identity Server STS Client

I running the STS Client from sample located in
https://docs.wso2.com/display/IS540/Downloading+a+Sample
I am using 'sts-policy-ut.xml' as my policy (please refer to the code). I get the SAML2 tokens and I can validate too. When when I enable relyingPary flag in the 'client.properties' file, I get the following error :
java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMElementImpl cannot be cast to org.w3c.dom.Element
at org.apache.rampart.builder.BindingBuilder.handleSupportingTokens(BindingBuilder.java:392)
at org.apache.rampart.builder.SymmetricBindingBuilder.doSignBeforeEncrypt(SymmetricBindingBuilder.java:499)
at org.apache.rampart.builder.SymmetricBindingBuilder.build(SymmetricBindingBuilder.java:86)
at org.apache.rampart.MessageBuilder.build(MessageBuilder.java:144)
at org.apache.rampart.handler.RampartSender.invoke(RampartSender.java:65)
at org.apache.axis2.engine.Phase.invokeHandler(Phase.java:340)
at org.apache.axis2.engine.Phase.invoke(Phase.java:313)
at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:262)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:427)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:406)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:531)
at org.wso2.carbon.identity.samples.sts.Client.run(Client.java:239)
at org.wso2.carbon.identity.samples.sts.Client.main(Client.java:95)
Please let me know how to fix it. I just using the recommended Maven way to build the project and running the supplied batch file.
I finally upgraded the Axis 2 library including the Ramapart jars to the following :
i) Axis 2 - 1.7.7
ii) Rampart - 1.7.0
This solved the problem. So this seems to be a bug with Axis 1.6.1 the version which the WSO2 uses for its examples.

WSO2 - Error while invoking APIUsageStatisticsClient for ProviderAPIUsage

I have setup WSO2 API Manager (version 1.9.1) and have configured it with BAM (version 2.5.0) following the instructions provided here to the letter:
https://docs.wso2.com/display/AM191/Publishing+API+Runtime+Statistics
I am using MySQL server and can see the api_* tables created and getting updated as I make API calls. However, when I go to look at the statistics, I see an exception on the console, while the UI tells me that I need to configure BAM to see the dashboards.
Here is a snippet of the ERRORs seen in wso2carbon.log
TID: [0] [AM] [2015-11-19 11:27:39,110] ERROR {org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject} - Error while invoking APIUsageStatisticsClient for ProviderAPIUsage {org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject}
org.wso2.carbon.apimgt.usage.client.exception.APIMgtUsageQueryServiceClientException: Error occurred while querying from JDBC databasecom.mysql.jdbc.driver
at org.wso2.carbon.apimgt.usage.client.APIUsageStatisticsClient.queryFirstAccess(APIUsageStatisticsClient.java:2762)
at org.wso2.carbon.apimgt.usage.client.APIUsageStatisticsClient.getFirstAccessTime(APIUsageStatisticsClient.java:2706)
... 65 more
Caused by: java.sql.SQLException: com.mysql.jdbc.driver
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:254)
at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:182)
at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:701)
at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:635)
at org.apache.tomcat.jdbc.pool.ConnectionPool.getConnection(ConnectionPool.java:188)
at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:128)
at org.wso2.carbon.apimgt.usage.client.APIUsageStatisticsClient.queryFirstAccess(APIUsageStatisticsClient.java:2730)
... 65 more
Caused by: java.lang.ClassNotFoundException: com.mysql.jdbc.driver
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:475)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:274)
at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:246)
... 71 more
TID: [0] [AM] [2015-11-19 11:27:39,138] ERROR {JAGGERY.modules.statistics.usage:jag} - java.lang.NullPointerException: null {JAGGERY.modules.statistics.usage:jag}
I have looked at other similar posts but nothing seems to be exactly relevant. The closest similar post had a SQL Server specific issue, but I am using MySQL.
Additional Information: I am running BAM and API Manager on the same machine. I have set offset on BAM to 3 as recommended in the guide.
Apparently, you have not added the SQL connector to /repository/components/lib and /repository/components/lib folders. This is mentioned in the step 5 of https://docs.wso2.com/display/AM191/Publishing+API+Runtime+Statistics.
Make sure that the SQL connector is correctly placed on those locations
If you are trying above scenario in a Windows environment, please use "mysql-connector-java-5.1.30" connector and place it in /repository/components/lib and /repository/components/lib folders. This could be due to a connector version problem.

During XACML Policy published issue in WSO2 API

After creating the XACML Policy trying to publish it to PDP, but getting error
[2014-07-10 06:30:15,910] ERROR - ApplicationDispatcher
Servlet.service() for servlet bridgeservlet threw exception
java.lang.NoSuchMethodError:
org.wso2.carbon.identity.entitlement.stub.EntitlementPolicyAdminServiceStub.publishPolicies([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)
at org.wso2.carbon.identity.entitlement.ui.client.EntitlementPolicyAdminServiceClient.publish(EntitlementPolicyAdminServiceClient.java:414)
at org.apache.jsp.entitlement.publish_002dfinish_jsp._jspService(org.apache.jsp.entitlement.publish_002dfinish_jsp:133)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:111)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:403)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:492)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:378)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
Could you please suggest to resolve the above error.
Thanks,
Asit
I too encountered this issue and the reason was due to some conflicts of copying org.wso2.carbon.identity.entitlement.stub jars in different versions when installing XACML via feature manager. If you are installing XACML 2.2 and XACML mediator 2.2 it should copy org.wso2.carbon.identity.entitlement.stub 4.2.1. I could resolve it as follows,
Go to /repository/components and open artifacts.xml.
Find the artifact id 'org.wso2.carbon.identity.entitlement.stub and change the version to 4.2.1 (there may have two artifacts with different versions 4.2.0 and 4.2.1)
Go to /repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator and open bundles.info file.
Find the line org.wso2.carbon.identity.entitlement.stub,4.2.0 and remove it. (there should be a same entry with version 4.2.1)
Then try to publish to PDP
Thanks,
Nipuni
This has been already answered by an another SO answer, You also can check it for more details. Please find from here.
If you are using APIM 1.7.0 and If you install XACML feature 4.2.2, you would not see such error.