Conversation-with-Discovery "Exception on Query:null" - No Response from Chat App - java

I have successfully been able to deploy and run this demo for using conversation-with-discovery.
I have spent the last 2 weeks trying to run the application with my own data, and provide a query on the Chat App localhost that I know should provide results from my data from Watson Discovery, I get the following:
http://localhost:9081/dist/index.html: "Service seems to be down.Please try again
after sometime or Please check the logs." "No response from Watson"
On Terminal Command Line: "10:40:03.549 [Default Executor-thread-79]
INFO com.ibm.watson.apis.conversation_with_discovery.discovery.DiscoveryQuery - Query: searchText:CO2 Absorption
10:40:04.360 [Default Executor-thread-79]
INFO com.ibm.watson.apis.conversation_with_discovery.discovery.DiscoveryClient - Creating Discovery Payload
10:40:04.361 [Default Executor-thread-79]
ERROR com.ibm.watson.apis.conversation_with_discovery.rest.ProxyResource - Exception on Query:null"
Now if I run a query on the Local Chat App that doesn't make sense to Watson Discovery I get the following:
http://localhost:9081/dist/index.html: "Sorry I haven't learned answers to questions like this" " "log_messages": [],
"CEPayload": [
{
"text": "empty",
"textSnippet": "empty",
"confidence": "0.0",
"sourceUrl": "empty",
"title": "No results found"
}
]
},
"input": {
"text": "CO#""
On Terminal Command Line: "10:52:39.614 [Default Executor-thread-228]
INFO com.ibm.watson.apis.conversation_with_discovery.discovery.DiscoveryQuery - Query: searchText:CO#
10:52:40.385 [Default Executor-thread-228]
INFO com.ibm.watson.apis.conversation_with_discovery.discovery.DiscoveryClient - Creating Discovery Payload"
My intuition tells me that something is not right when Discovery API tries to send back a response to the Chat App via the Java application I am using but when I ask something that Discovery cannot answer I get "empty" fields for my Payload, as shown above.
Based on what I have found regarding this type of set up tried the following:
I changed the fields on the Java Application to match with what is shown on discovery as fields on the data schema and on the API
I modified the manifest.yml file: buildpack: liberty-for-java_v3_7-20170118-2046" and "env: JVM: openjdk as suggested on a few forums
I downloaded java-sdk-java-sdk-4.0.0 but am not sure how to update my current Java SDK. Not sure if it's the actual problem so haven't deeply approached this route.
I am running on macOS Sierra version 10.12.6. Perhaps something is incompatible with my OS?
I just need some guidance before I continue down a rabbit hole that holds no solution. Could it be the Java Application or is this an internal Java system issue on my laptop? I have searched forums and seen both situations.

Related

Firebase FCM returning 403 SenderId mismatch PERMISSION_DENIED while trying to push a notification

I'm trying to setup a dev environment for developing with FCM and I'm getting this error.
I'm using the configuration of out-of-box and it is been loaded properly (I've debugged).
I'm working with java 8 and spring 2.2.12 and firebase-admin 7.1.0.
com.google.api.client.http.HttpResponseException: 403 Forbidden
POST https://fcm.googleapis.com/v1/projects/projectt-82004/messages:send
{
"error": {
"code": 403,
"message": "SenderId mismatch",
"status": "PERMISSION_DENIED",
"details": [
{
"#type": "type.googleapis.com/google.firebase.fcm.v1.FcmError",
"errorCode": "SENDER_ID_MISMATCH"
}
]
}
}
What I've tried so far
Create a new project and a new key
There was an old documented error where the services were not activated by default. I've checked the services and all of them are active.
Also, the user appears to have enough privileges.
I've also updated the library to the latest version (it also happened with the previous version)
Am I missing something here?
UPDATE
Same code, later on the following day, without any changes to the code, it started working. So the conclusion was that there was some problem with the service itself.

Cumulocity microservice deployment: access is denied

My goal (background info)
I want to develop a java microservice on cumulocity. It should be able to do the following:
I would send "112233" to the microservice as follows:
https://myTenant.cumulocity.com/service/my-application-name/decode?data=112233
The microservice should then split the data into "11" for the first measurement and "22" for the second measurement etc. These measurements would be POSTed to cumulocity.
My problem
I am now stuck on getting the Hello, microservice tutorial to work. I can't deploy the microservice (zip file) to cumulocity.
"error":"security/Forbidden","info":"https://www.cumulocity.com/guides/reference-guide/#error_reporting","message":"Access is denied"} (I am an admin user.)
I also tried to upload the zip file via the website, this created a HOSTED application instead of a MICROSERVICE. Uploading my zip via a POST request to a HOSTED application actually works (which I obviously don't need).
I suspect that I get the "access denied" error cause cumulocity thinks that I upload a HOSTED application to a MICROSERVICE.
What I've done so far
Code side
I downloaded the hello-world-microservice example from the cumulocity bitbucket development branch. (This code is not available on the default branch).
I changed the cumulocity versions to 9.3.0, only this version seems to exist.
The HelloWorldMain.java is unedited
This is my cumulocity.json manifest file: (the roles make no difference)
{
"apiVersion":"1",
"type":"MICROSERVICE",
"version":"#project.version#",
"availability":"PRIVATE",
"provider":{
"name":"Cumulocity GmbH"
},
"isolation":"MULTI_TENANT",
"requiredRoles":[
"ROLE_APPLICATION_MANAGEMENT_ADMIN",
"ROLE_MEASUREMENT_ADMIN",
"ROLE_INVENTORY_ADMIN"
],
"roles":[
"ROLE_APPLICATION_MANAGEMENT_ADMIN",
"ROLE_MEASUREMENT_ADMIN",
"ROLE_INVENTORY_ADMIN"
],
"livenessProbe":{
"httpGet":{
"path":"/health",
"port":80
},
"initialDelaySeconds":15,
"periodSeconds":10
},
"readinessProbe":{
"httpGet":{
"path":"/health",
"port":80
}
}
}
This is my application.properties file
application.name=my-application-name
server.port=80
C8Y.baseURL=https://myTenant.cumulocity.com
C8Y.bootstrap.tenant=myTenant
C8Y.bootstrap.user=servicebootstrap_my-application-name
C8Y.bootstrap.password={SECRET_BOOTSTRAP_PASSW}
C8Y.user={MY_USERNAME}
C8Y.password={SECRET_PASSW}
C8Y.bootstrap.register=true
C8Y.microservice.isolation=MULTI_TENANT
C8Y.bootstrap.initialDelay=10000
Cumulocity side
I successfully created a microservice application,
GET https://myTenant.cumulocity.com/application/applications/5886 returns:
{
"availability":"PRIVATE",
"id":"5886",
"key":"my-application-key",
"manifest":{
"imports":[
],
"noAppSwitcher":true
},
"name":"my-application-name",
"owner":{
"self":"https://myTenant.cumulocity.com/tenant/tenants/myTenant",
"tenant":{
"id":"myTenant"
}
},
"requiredRoles":[
"ROLE_APPLICATION_MANAGEMENT_ADMIN",
"ROLE_MEASUREMENT_ADMIN",
"ROLE_INVENTORY_ADMIN"
],
"roles":[
"ROLE_APPLICATION_MANAGEMENT_ADMIN",
"ROLE_MEASUREMENT_ADMIN",
"ROLE_INVENTORY_ADMIN"
],
"self":"https://myTenant.cumulocity.com/application/applications/5886",
"type":"MICROSERVICE"
}
I also successfully subscribed to this application.
When I try to upload the zip file to cumulocity, I get this error:
"error":"security/Forbidden","info":"https://www.cumulocity.com/guides/reference-guide/#error_reporting","message":"Access is denied"}
(Uploading to a HOSTED type application works fine, but I don't want that.)
note: I also tried to use the microservice deploy script, this gave the same result as doing everything manually.
Trying to run it locally
Since I couldn't get it to work on the cumulocity platform, I tried to run it locally via docker. I ran it with this command:
docker run -e "C8Y_MICROSERVICE_ISOLATION=MULTI_TENANT" 10aa0b73ddb3
note: I had to add the "C8Y_MICROSERVICE_ISOLATION=MULTI_TENANT" environment variable. if I didn't add this, I'd get credential/permission issues. This seems weird to me, since all other info is read from the application.properties file except for this one.
I have no errors when running this image on a local docker.
According to the Hello, microservice tutorial, I should be able to request curl -H "Authorization: {AUTHORIZATION}" https://myTenant.cumulocity.com/service/my-application-name/hello?who=me
This returns:
{"error":"microservice/Not Found","info":"https://www.cumulocity.com/guides/reference-guide/#error_reporting","message":"Microservice my-application-name not found."}
Back to the questions
Has anyone else had difficulties with setting up a microservice on cumulocity?
Is there something I'm totally overseeing?
The microservice hosting needs to be assigned to your tenant otherwise it won't work and the API in that case will return forbidden. So it might be that it is no issue with your user but that your tenant has the feature not activated.

string index out of range on generating client lib

We are developing on Google App Engine. Endpoints developed are working fine locally and in production. Generating client libs using the endpoints.sh works for most of endpoints.
There is only one endpoint that it is not working for some reason. It keeps returning the following:
Error: 500 Internal Server Error
{"error": {"message": "Internal Server Error", "code": 500, "errors": [{"message": "unknown exception", "debug_info": "string index out of range"}]}}
As you can see the error message does not provide much additional information so we've tried running the script in debug mode with no much luck either.
We are developing on OS X, Java 1.7.0_25 and Google App Engine 1.9.40.
Any help appreciated.
The issue is as follow. I had an enum for country defined as the country name and its abbreviation. There is one for UNKNOWN and had no abbreviation (its value was actually set to ""). After changing this to "UNKNOWN" it started to work and generate client lib.
Full details on:
https://code.google.com/p/googleappengine/issues/detail?id=13337

Passing end-user details from client to real backend endpoint via JWT token in WSO2 APIM

I am new to WSO2 API Manager using version 1.9.1. I am trying to implement the WSO2 APIM + JWT assertion looking at http://lalajisureshika.blogspot.in/2013/06/passing-end-user-details-from-client-to.html and http://sumedha.blogspot.in/2012/08/using-jwt-to-send-application-user.html (but the steps are not too good enough to understand). I changed following from <APIM_HOME>/repository/conf/api-manager.xml
<APIConsumerAuthentication>
<SecurityContextHeader>X-JWT-Assertion</SecurityContextHeader>
<ClaimsRetrieverImplClass>org.wso2.carbon.apimgt.impl.token.DefaultClaimsRetriever</ClaimsRetrieverImplClass>
<ConsumerDialectURI>http://wso2.org/claims</ConsumerDialectURI>
<SignatureAlgorithm>SHA256withRSA</SignatureAlgorithm>
<EnableTokenGeneration>true</EnableTokenGeneration>
</APIConsumerAuthentication>
Please find attachment of few images, so it will give more idea about the failure:
I also subscribe my application and when try to execute command from "API Console", I see very wired error.
Also TCP/IP Monitor tool shows
Please help me what is the issue is?
Can you provide the error log which is printed in the wso2carbon.log (< APIM Home>/reposiory/logs) or terminal. it will be more useful to identify the reason to you error.
or else you can try other way To capture the outgoing message as mentioned below
Uncomment
log4j.logger.org.apache.synapse.transport.http.headers=DEBUG
log4j.logger.org.apache.synapse.transport.http.wire=DEBUG
in the log4j.properties file which can be found from {AM_Home}/repository/conf
restart server and invoke the subscribed api. you will get message like this in APIM with JWT-Assertion.
TID: [0] [AM] [2013-06-29 09:05:05,548] DEBUG {org.apache.synapse.transport.http.headers} - http-outgoing-1>>X-JWT-Assertion: eyJ0eXAiOiJKV1QiLCJhbGciOiJTSEEyNTZ3aXRoUlNBIiwieDV0IjoiTm1KbU9HVXhNelpsWWpNMlpEUmhOVFpsWVRBMVl6ZGhaVFJpT1dFME5XSTJNMkptT1RjMVpBPT0ifQ==.eyJpc3MiOiJ3c28yLm9yZy9wcm9kdWN0cy9hbSIsImV4cCI6MTM3MjUyMjgwNTE3NywiaHR0cDovL3dzbzIub3JnL2NsYWltcy9zdWJzY3JpYmVyIjoibGFsYWppIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy9hcHBsaWNhdGlvbmlkIjoiMSIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvYXBwbGljYXRpb25uYW1lIjoiRGVmYXVsdEFwcGxpY2F0aW9uIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy9hcHBsaWNhdGlvbnRpZXIiOiJVbmxpbWl0ZWQiLCJodHRwOi8vd3NvMi5vcmcvY2xhaW1zL2FwaWNvbnRleHQiOiIvYXBpMSIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvdmVyc2lvbiI6IjEuMi4zIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy90aWVyIjoiVW5saW1pdGVkIiwiaHR0cDovL3dzbzIub3JnL2NsYWltcy9rZXl0eXBlIjoiUFJPRFVDVElPTiIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvdXNlcnR5cGUiOiJBUFBMSUNBVElPTiIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvZW5kdXNlciI6ImxhbGFqaSIsImh0dHA6Ly93c28yLm9yZy9jbGFpbXMvZW5kdXNlclRlbmFudElkIjoiLTEyMzQifQ==.YtVaDtRYtfUkVDvwe9V8oqsXK8OkB4HUhsQS2z3ngWRNjAktSKWlH+Is9T5EQnsg8hrsJQ4nKDdwDWHAUIFxIsb7bX/Y1O+WSLMLZYQ11WVzFaw50BJuqPbL9ZOfux1iRnm4ZbxClVSan72g/w8a05UnCvsGyIh5oCP4RUsAhXo= {org.apache.synapse.transport.http.headers}

elasticsearch not starting {0.90.0} : Startup Failed

I am not able to start elasticsearch. I tried
bin/elasticsearch
bin/elasticsearch -f
bin/elasticsearch -f ES_HEAP_SIZE=4g
but I keep getting the following message after a two-second pause...
{0.90.0}: Startup Failed ...
- OutOfMemoryError[unable to create new native thread]
NOTE 1: elasticsearch was working perfectly for me before I indexed 4 million documents into the server, after which I kept getting this error.
NOTE 2: even though elasticsearch does not startup, I am still able to execute the curl command on the elasticsearch server (strange indeed)
curl -XGET http://localhost:9200
{
"ok" : true,
"status" : 200,
"name" : "Thumbelina",
"version" : {
"number" : "0.90.0",
"snapshot_build" : false
},
"tagline" : "You Know, for Search"
}
My guess is that one of the search queries to the 4 million documents is still running but I tried exiting the terminal, killing the process, increasing the heap size and stopping the elasticsearch process using bin/elasticsearch stop. My elasticsearch version is 0.90.0. Sorry for the long question and any help would be great. Thanks.
This discussion implies that increasing the ulimit value may help. Search for ulimit on this Elasticsearch reference page for additional details.
Does the process still appear to be running on the OS (e.g., using ps on the host box)?

Categories

Resources