WSO2 API Manager and Google Analytics - google-analytics

I've configured my API Manager to enable google analytics, and am receiving the following error in API Manager:
2013-10-10 13:31:12,869 [-] [HttpServerWorker-1] ERROR APIMgtGoogleAnalyticsTrackingHandler String index out of range: -1 java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at java.lang.String.substring(String.java:1911) at org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler.trackPageView(APIMgtGoogleAnalyticsTrackingHandler.java:69) at org.wso2.carbon.apimgt.usage.publisher.APIMgtGoogleAnalyticsTrackingHandler.handleRequest(APIMgtGoogleAnalyticsTrackingHandler.java:49) at org.apache.synapse.rest.API.process(API.java:252) at org.apache.synapse.rest.RESTRequestHandler.dispatchToAPI(RESTRequestHandler.java:76) at org.apache.synapse.rest.RESTRequestHandler.process(RESTRequestHandler.java:63) at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.injectMessage(Axis2SynapseEnvironment.java:191) at org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:83) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:172) at org.apache.synapse.transport.nhttp.ServerWorker.processEntityEnclosingMethod(ServerWorker.java:455) at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:275) at org.apache.axis2.transport.base.threads.NativeWorkerPool$1.run(NativeWorkerPool.java:172) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) at java.lang.Thread.run(Thread.java:722)
Any ideas what I could be doing wrong?
My API Manager configuration is very simple:
<GoogleAnalyticsTracking>
<Enabled>true</Enabled>
<TrackingID>UA-TrackingId-1</TrackingID>
</GoogleAnalyticsTracking>

We haven't come across this issue in APIM with google analytics. But we have fixed the possible code block. You can try with latest APIM 1.5.0

Related

WSO2 APIM 3.2.0 error while updating API definition

We are getting the below error while updating the API definition through publisher on WSO2 3.2.0 APIM. How to fix this issue:
TID: [-1234] [api/am/publisher] [2021-09-13 11:32:18,306] ERROR {org.wso2.carbon.apimgt.rest.api.util.exception.GlobalThrowableMapper} - An unknown exception has been captured by the global exception mapper. org.apache.cxf.interceptor.Fault: Couldn't find MIME boundary: ------WebKitFormBoundaryEsb6bxMwX39fG8Sb
at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:60)
at org.apache.cxf.jaxrs.ext.MessageContextImpl.createAttachments(MessageContextImpl.java:284)
at org.apache.cxf.jaxrs.ext.MessageContextImpl.get(MessageContextImpl.java:79)
at org.apache.cxf.jaxrs.impl.tl.ThreadLocalMessageContext.get(ThreadLocalMessageContext.java:42)
at org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils.getMultipartBody(AttachmentUtils.java:143)
at org.apache.cxf.jaxrs.utils.multipart.AttachmentUtils.getAttachments(AttachmentUtils.java:155)
Caused by: java.io.IOException: Couldn't find MIME boundary: ------WebKitFormBoundaryEsb6bxMwX39fG8Sb
at org.apache.cxf.attachment.AttachmentDeserializer.initializeRootMessage(AttachmentDeserializer.java:140)
at org.apache.cxf.attachment.AttachmentDeserializer.initializeAttachments(AttachmentDeserializer.java:110)
at org.apache.cxf.interceptor.AttachmentInInterceptor.handleMessage(AttachmentInInterceptor.java:58)
... 54 more
Is this issue occurring in the vanilla pack? Because this erroneous behavior is due to a known bug in the Tomcat version[1]. This issue has been identified and have fixed in the latest WUM updates.
Or else, you need to use a 9.0.34[2] bundle version and replace the appropriate jars. Also, new jars should be replaced in the bundle.info[3] as appropriate.
[1] https://github.com/wso2/product-apim/issues/8029
[2] https://maven.wso2.org/nexus/content/repositories/releases/org/wso2/orbit/org/apache/tomcat/tomcat-catalina-ha/9.0.34.wso2v1/
[3]
repository/components/default/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info

WSO2 : IS and APIM integration

I have been trying to integrate the APIM and IS together for WSO2. I am currently using APIM as version 2.5.0 and IS as 5.6.0
I am referring this link for the complete setup
(https://docs.wso2.com/display/CLUSTER44x/Configuring+the+Identity+Server+5.2.0+as+a+Key+Manager+with+API+Manager+2.0.0#)
Now, in the first step where it is asking to install the API keymanagement feature, I am getting below error
Cannot complete the install because of a conflicting dependency. Software being installed: WSO2 Carbon - Api management Key Manager Feature 6.0.4 (org.wso2.carbon.apimgt.keymanager.feature.group 6.0.4) Software currently installed: OAuth Feature 6.0.14 (org.wso2.carbon.identity.oauth.feature.group 6.0.14) Only one of the following can be installed at once: Identity OAuth Server Feature 6.0.14 (org.wso2.carbon.identity.oauth.server.feature.jar 6.0.14) Identity OAuth Server Feature 5.1.1 (org.wso2.carbon.identity.oauth.server.feature.jar 5.1.1) Identity OAuth Server Feature 5.1.3 (org.wso2.carbon.identity.oauth.server.feature.jar 5.1.3) Cannot satisfy dependency: From: WSO2 Carbon - Api management Key Manager Feature 6.0.4 (org.wso2.carbon.apimgt.keymanager.feature.group 6.0.4) To: org.wso2.carbon.identity.oauth.server.feature.group [5.1.1,5.2.0) Cannot satisfy dependency: From: OAuth Feature 6.0.14 (org.wso2.carbon.identity.oauth.feature.group 6.0.14) To: org.wso2.carbon.identity.oauth.server.feature.group [6.0.14] Cannot satisfy dependency: From: Identity OAuth Server Feature 5.1.1 (org.wso2.carbon.identity.oauth.server.feature.group 5.1.1) To: org.wso2.carbon.identity.oauth.server.feature.jar [5.1.1] Cannot satisfy dependency: From: Identity OAuth Server Feature 5.1.3 (org.wso2.carbon.identity.oauth.server.feature.group 5.1.3) To: org.wso2.carbon.identity.oauth.server.feature.jar [5.1.3] Cannot satisfy dependency: From: Identity OAuth Server Feature 6.0.14 (org.wso2.carbon.identity.oauth.server.feature.group 6.0.14) To: org.wso2.carbon.identity.oauth.server.feature.jar [6.0.14]
I skipped this steps and completed the other steps fully.
Now, I am able to open IS dashboard, APIM publisher and store properly but when I am trying to generate one token from Store dashboard to invoke any API, I am getting below error:
ERROR - AbstractKeyManager Can not create OAuth application : DefaultApplication_PRODUCTION
org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) https://localhost:9445/services/APIKeyMgtSubscriberService
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:381)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:456)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:227)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.wso2.carbon.apimgt.keymgt.stub.subscriber.APIKeyMgtSubscriberServiceStub.createOAuthApplicationByApplicationInfo(APIKeyMgtSubscriberServiceStub.java:1126)
at org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClient.createOAuthApplicationbyApplicationInfo(SubscriberKeyMgtClient.java:61)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createOAuthApplicationbyApplicationInfo(AMDefaultKeyManagerImpl.java:693)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createApplication(AMDefaultKeyManagerImpl.java:125)
at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.dogenerateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:140)
ERROR - APIUtil Error occurred while executing SubscriberKeyMgtClient.
org.wso2.carbon.apimgt.api.APIManagementException: Can not create OAuth application : DefaultApplication_PRODUCTION
at org.wso2.carbon.apimgt.impl.AbstractKeyManager.handleException(AbstractKeyManager.java:161)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createApplication(AMDefaultKeyManagerImpl.java:127)
at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.dogenerateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:140)
Caused by: org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) https://localhost:9445/services/APIKeyMgtSubscriberService
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:381)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:456)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:227)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.wso2.carbon.apimgt.keymgt.stub.subscriber.APIKeyMgtSubscriberServiceStub.createOAuthApplicationByApplicationInfo(APIKeyMgtSubscriberServiceStub.java:1126)
at org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClient.createOAuthApplicationbyApplicationInfo(SubscriberKeyMgtClient.java:61)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createOAuthApplicationbyApplicationInfo(AMDefaultKeyManagerImpl.java:693)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createApplication(AMDefaultKeyManagerImpl.java:125)
... 81 more
[2019-02-15 11:46:59,877] ERROR - ApplicationRegistrationSimpleWorkflowExecutor Error occurred when updating the status of the Application creation process
org.wso2.carbon.apimgt.api.APIManagementException: Error occurred while executing SubscriberKeyMgtClient.
at org.wso2.carbon.apimgt.impl.utils.APIUtil.handleException(APIUtil.java:1416)
at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.dogenerateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:165)
at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.generateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:119)
at org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor.complete(ApplicationRegistrationSimpleWorkflowExecutor.java:78)
at org.wso2.carbon.apimgt.impl.workflow.ApplicationRegistrationSimpleWorkflowExecutor.execute(ApplicationRegistrationSimpleWorkflowExecutor.java:54)
at org.wso2.carbon.apimgt.impl.APIConsumerImpl.requestApprovalForApplicationRegistration(APIConsumerImpl.java:3035)
at org.wso2.carbon.apimgt.impl.UserAwareAPIConsumer.requestApprovalForApplicationRegistration(UserAwareAPIConsumer.java:34)
at org.wso2.carbon.apimgt.hostobjects.APIStoreHostObject.jsFunction_getApplicationKey(APIStoreHostObject.java:346)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
at org.jaggeryjs.rhino.store.modules.subscription.c2._c_anonymous_2(/store/modules/subscription/key.jag:41)
at org.jaggeryjs.rhino.store.modules.subscription.c2.call(/store/modules/subscription/key.jag)
at org.mozilla.javascript.ScriptRuntime.applyOrCall(ScriptRuntime.java:2430)
at org.mozilla.javascript.BaseFunction.execIdCall(BaseFunction.java:269)
at org.mozilla.javascript.IdFunctionObject.call(IdFunctionObject.java:97)
at org.mozilla.javascript.optimizer.OptRuntime.call2(OptRuntime.java:42)
at org.jaggeryjs.rhino.store.modules.subscription.c0._c_anonymous_10(/store/modules/subscription/module.jag:35)
at org.jaggeryjs.rhino.store.modules.subscription.c0.call(/store/modules/subscription/module.jag)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:52)
Caused by: org.wso2.carbon.apimgt.api.APIManagementException: Can not create OAuth application : DefaultApplication_PRODUCTION
at org.wso2.carbon.apimgt.impl.AbstractKeyManager.handleException(AbstractKeyManager.java:161)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createApplication(AMDefaultKeyManagerImpl.java:127)
at org.wso2.carbon.apimgt.impl.workflow.AbstractApplicationRegistrationWorkflowExecutor.dogenerateKeysForApplication(AbstractApplicationRegistrationWorkflowExecutor.java:140)
... 80 more
Caused by: org.apache.axis2.AxisFault: The service cannot be found for the endpoint reference (EPR) https://localhost:9445/services/APIKeyMgtSubscriberService
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:381)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:456)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:227)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at org.wso2.carbon.apimgt.keymgt.stub.subscriber.APIKeyMgtSubscriberServiceStub.createOAuthApplicationByApplicationInfo(APIKeyMgtSubscriberServiceStub.java:1126)
at org.wso2.carbon.apimgt.keymgt.client.SubscriberKeyMgtClient.createOAuthApplicationbyApplicationInfo(SubscriberKeyMgtClient.java:61)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createOAuthApplicationbyApplicationInfo(AMDefaultKeyManagerImpl.java:693)
at org.wso2.carbon.apimgt.impl.AMDefaultKeyManagerImpl.createApplication(AMDefaultKeyManagerImpl.java:125)
... 81 more
[2019-02-15 11:46:59,894] ERROR - APIConsumerImpl Could not execute Workflow
org.wso2.carbon.apimgt.impl.workflow.WorkflowException: Error occurred while executing SubscriberKeyMgtClient.
Could not paste the complete other lines as the limit of chars got completed.
But these are the errors which I am getting in generating the Token for an application in store.
Can some one please cehck and let me know what I am doing wrong.
Thanks
Instead of installing the keymanager features, can you download the pre-packed wso2 IS as keymanager pack from https://docs.wso2.com/display/AM250/Configuring+WSO2+Identity+Server+as+a+Key+Manager#ConfiguringWSO2IdentityServerasaKeyManager-Step1-DownloadtheprepackagedWSO2ISastheKeyManager . This is a WSO2 IS pack with keymanager features installed.

{org.wso2.andes.client.AMQConnection} - Unable to connect to broker at After migrating to WSO2 API Manager 2.1.0

I migrated to API Manager 2.1.0 with Identity server as key manager 5.3.0.
I followed the document https://docs.wso2.com/display/AM210/Upgrading+from+the+Previous+Release+when+WSO2+IS+is+the+Key+Manager
I have custom domain name mapped to all url.
I have the below error in WSO2 API manager logs when i try to hit an API. How to debug this?which file should be the culprit?
In earlier version , i faced this issue when i missed to update jndi.properties.But that is done properly here as below.
# connectionfactory.[jndiname] = [ConnectionURL]
connectionfactory.TopicConnectionFactory = amqp://admin:admin#clientid/carbon?brokerlist='tcp://mydevwso2.ca:5672'
connectionfactory.QueueConnectionFactory = amqp://admin:admin#clientID/test?brokerlist='tcp://mydevwso2.ca:5672'
What could cause the below error?
Caused by: org.wso2.andes.AMQConnectionFailureException: Could not open connection
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:486)
at org.wso2.andes.client.AMQConnectionFactory.createConnection(AMQConnectionFactory.java:351)
... 13 more
Caused by: org.wso2.andes.transport.TransportException: Could not open connection
at org.wso2.andes.transport.network.mina.MinaNetworkTransport$IoConnectorCreator.connect(MinaNetworkTransport.java:216)
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.connect(MinaNetworkTransport.java:74)
at org.wso2.andes.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:130)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:631)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:628)
at java.security.AccessController.doPrivileged(Native Method)
at org.wso2.andes.client.AMQConnection.makeBrokerConnection(AMQConnection.java:628)
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:409)
... 14 more
TID: [-1] [] [2017-11-14 14:12:08,925] ERROR {org.wso2.carbon.event.output.adapter.jms.internal.util.JMSMessageSender} - {org.wso2.carbon.event.output.adapter.jms.internal.util.JMSMessageSender}
java.lang.NullPointerException
at org.wso2.carbon.event.output.adapter.jms.internal.util.JMSMessageSender.send(JMSMessageSender.java:88)
at org.wso2.carbon.event.output.adapter.jms.JMSEventAdapter$JMSSender.run(JMSEventAdapter.java:284)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
TID: [-1] [] [2017-11-14 14:12:22,207] INFO {org.wso2.andes.client.AMQConnection} - Unable to connect to broker at tcp://mydevwso2.ca:5672 {org.wso2.andes.client.AMQConnection}
org.wso2.andes.transport.TransportException: Could not open connection
at org.wso2.andes.transport.network.mina.MinaNetworkTransport$IoConnectorCreator.connect(MinaNetworkTransport.java:216)
at org.wso2.andes.transport.network.mina.MinaNetworkTransport.connect(MinaNetworkTransport.java:74)
at org.wso2.andes.client.AMQConnectionDelegate_8_0.makeBrokerConnection(AMQConnectionDelegate_8_0.java:130)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:631)
at org.wso2.andes.client.AMQConnection$2.run(AMQConnection.java:628)
at java.security.AccessController.doPrivileged(Native Method)
at org.wso2.andes.client.AMQConnection.makeBrokerConnection(AMQConnection.java:628)
at org.wso2.andes.client.AMQConnection.<init>(AMQConnection.java:409)
Check whether the super admin user credentials are correct in the jndi.properties file and also in the api-manager.xml file. In the api-manager.xml file, the relevant configuration can be seen similar to the below example (credentials can be different).
<JMSConnectionParameters>
<transport.jms.ConnectionFactoryJNDIName>TopicConnectionFactory</transport.jms.ConnectionFactoryJNDIName>
<transport.jms.DestinationType>topic</transport.jms.DestinationType>
<java.naming.factory.initial>org.wso2.andes.jndi.PropertiesFileInitialContextFactory</java.naming.factory.initial>
<connectionfactory.TopicConnectionFactory>amqp://admin:admin2#clientid/carbon?brokerlist='${jms.url}'</connectionfactory.TopicConnectionFactory>
</JMSConnectionParameters>
I could observe the same issue as you, resulting in:
org.wso2.andes.AMQConnectionFailureException: Could not open connection ..)
I was able to resolve by changing the above configurations to the correct super admin user credentials. The correct admin user credentials can be found from the <APIM_Home>/repository/conf/usr-mgt.xml file. An example configuration is as follows:
<AdminUser>
<UserName>admin</UserName>
<Password>admin2</Password>
</AdminUser>

wso2 Error while installation

I am trying out wso 2 API manager and i get this error while running it (first time) :
[2017-09-20 14:33:56,538] INFO - ConnectionStartOkMethodHandler Authentication
failed:Error processing data: java.io.IOException: Error looking up user javax.s
ecurity.auth.login.AccountNotFoundException: Invalid User : TestEmployee
I have looked at the config files, none of them have a value as test employee. Not sure from where wso2 installation reads this value. Any help will be appreciated.

Client certificates for JxBrowser

I am getting following exception with JxBrowser. Obviously I checked that KeyChain (I am on osx) contains correct certificates. Both Chrome and Electron are able to find it. Any advice?
12:58:30 SEVERE: The DialogHandler.onSelectCertificate() method has
thrown exception: java.lang.IllegalArgumentException: The
certificateStr cannot be null or empty. at
com.teamdev.jxbrowser.chromium.internal.CertificateFactory.certificatesFromString(SourceFile:27)
at com.teamdev.jxbrowser.chromium.internal.g.run(SourceFile:134) at
com.teamdev.jxbrowser.chromium.internal.q.run(SourceFile:51) at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262) at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
It is an issue in JxBrowser. This issue will be resolved in the next version 6.13 that we plan to release this month.
Network network = engine.network();
network.set(VerifyCertificateCallback.class, (params) ->
VerifyCertificateCallback.Response.valid());
Refer link to check more about this api jxbrowser

Resources