java.lang.RuntimeException: org.json.JSONException: JSONObject["_source"] not found. #Kuzzle - kuzzle

I am trying to update the document using java sdk, when I run my code kuzzle status is connected, it update the fields but neither comes in onSuccess() nor onError(). when I again request to updateDocument(), kuzzle state change from connected to error. I debug the issue and found this exception.
java.lang.RuntimeException: org.json.JSONException: JSONObject["_source"] not found.
as I am not getting "_source" in my code
kuzzle.collection("collection","testindex").updateDocument(obj.getDocumentId(), jsonObj, new ResponseListener<Document>() {
#Override
public void onSuccess(Document response) {
System.out.println("success"+response);
}
#Override
public void onError(JSONObject error) {
System.out.println("error"+error);
}
});

A fix has recently been released for this probleme. You should try with version 3.0.10 of the SDK: https://bintray.com/kuzzle/maven/kuzzle-sdk-android/3.0.10

Related

Flutter NO_RENEGOTIATION(ssl_lib.cc:1725) error 268435638

I'm not sure why this API I'm requesting is throwing this error for only dart. For some reason dart throws this error when I attempt to make a POST request:
Unhandled Exception:
NO_RENEGOTIATION(ssl_lib.cc:1725) error 268435638
#0 IOClient.send (package:http/src/io_client.dart:90:7)
I tried the same endpoint in both Python, Java and even manually and it worked fine. It worked fine with a local server, and then when I went to push to production I encountered this problem.
add this in main
void main() {
final context = SecurityContext.defaultContext;
context.allowLegacyUnsafeRenegotiation = true;
final httpClient = HttpClient(context: context);
runApp(const MyApp());
}

Eclipse Issue: P/tag_query, does not match outer scope rule

The eclipse platform for RCP product was upgraded from 3.6.2 to 4.6.3. The below code was working fine with 3.6.2:
public static ConfigTagService getTagService(MethodConfiguration config) {
delegate = ConfigurationHelper.getDelegate();
thisConfig = config;
if (delegate instanceof ConfigHelperDelegate) {
configTagService = ((ConfigHelperDelegate) delegate).getTagService_(thisConfig);
return configTagService;
}
return null;
}
But after upgrade I am getting issue with this code and subsequent calls to below line throws exception:
folder.refreshLocal(IResource.DEPTH_INFINITE, null);
The detailed stack trace is:
!MESSAGE An internal error occurred during: "Fetching children of view".
!STACK 0
java.lang.IllegalArgumentException: Attempted to beginRule: P/tag_query, does not match outer scope rule: com.eclipse.rmc.authoring.ui.providers.ConfigurationContentProvider$BatchSimilarSchedulingRule#f9cfe23e
at org.eclipse.core.runtime.Assert.isLegal(Assert.java:63)
at org.eclipse.core.internal.jobs.ThreadJob.illegalPush(ThreadJob.java:134)
at org.eclipse.core.internal.jobs.ThreadJob.push(ThreadJob.java:333)
at org.eclipse.core.internal.jobs.ImplicitJobs.begin(ImplicitJobs.java:85)
at org.eclipse.core.internal.jobs.JobManager.beginRule(JobManager.java:307)
at org.eclipse.core.internal.resources.WorkManager.checkIn(WorkManager.java:121)
at org.eclipse.core.internal.resources.Workspace.prepareOperation(Workspace.java:2188)
at org.eclipse.core.internal.resources.Resource.refreshLocal(Resource.java:1586)
at com.eclipse.rmc.library.tag.internal.TagService.initialize(TagService.java:546)
at com.eclipse.rmc.library.tag.internal.TagService.<init>(TagService.java:293)
at com.eclipse.rmc.library.tag.AbstractTagService.newInstance(AbstractTagService.java:42)
at com.eclipse.rmc.library.ConfigTagService.newTagService(ConfigTagService.java:82)
at com.eclipse.rmc.library.ConfigTagService.setConfig(ConfigTagService.java:72)
at com.eclipse.rmc.library.ConfigHelperDelegate.getTagService_(ConfigHelperDelegate.java:387)
at com.eclipse.rmc.library.ConfigHelperDelegate.getTagService(ConfigHelperDelegate.java:175)
at com.eclipse.rmc.library.configuration.DefaultElementRealizer.addExtraToManyFeatureValues(DefaultElementRealizer.java:76)
at com.eclipse.rmc.library.configuration.DefaultElementRealizer.addExtraFeatureValues(DefaultElementRealizer.java:52)
at org.eclipse.epf.library.configuration.ConfigurationHelper.calculateFeature(ConfigurationHelper.java:880)
at org.eclipse.epf.library.configuration.ConfigurationHelper.calc0nFeatureValue_(ConfigurationHelper.java:1577)
at org.eclipse.epf.library.configuration.ConfigurationHelper.calc0nFeatureValue(ConfigurationHelper.java:1533)
at org.eclipse.epf.library.configuration.ConfigurationHelper.calc0nFeatureValue(ConfigurationHelper.java:1514)
at org.eclipse.epf.library.configuration.ConfigurationFilter.getChildren(ConfigurationFilter.java:150)
at org.eclipse.epf.library.edit.internal.TngAdapterFactoryImpl$FilterItemProvider.getChildren_(TngAdapterFactoryImpl.java:394)
at org.eclipse.epf.library.edit.internal.TngAdapterFactoryImpl$FilterItemProvider.getChildren(TngAdapterFactoryImpl.java:368)
at org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider.getChildren(AdapterFactoryContentProvider.java:175)
at com.eclipse.rmc.authoring.ui.providers.ConfigurationContentProvider.fetchChildren(ConfigurationContentProvider.java:168)
at com.eclipse.rmc.authoring.ui.providers.ConfigurationContentProvider$DeferredItem.fetchDeferredChildren(ConfigurationContentProvider.java:103)
at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:231)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
I find the similar issue at https://www.eclipse.org/forums/index.php/t/442274/ and applied the solution to the causing issue as:
Job job = new Job("New job for tag query") {
#Override
protected IStatus run(IProgressMonitor monitor) {
configTagService = ((ConfigHelperDelegate) delegate).getTagService_(thisConfig);
return Status.OK_STATUS;
}
};
job.schedule();
With this fix, I do not get any exception and it works fine. However, for the large library, this the publish freezes with this fix. Could you please suggest alternative to avoid freeze issue?

Server restart results in never ending Bad_ServiceUnsupported errors, onSubscriptionTransferFailed not called

my Milo client (sdk 0.4.1) subscribes on server events by use of UaSubscription and can receive events sucessfully. But once I restart the server, the clients only logs errors in an endless loop in the form of:
[ERROR] 2021-06-11 17:29:11.467 [milo-netty-event-loop-0]
UascClientMessageHandler -
errorMessage=ErrorMessage{error=StatusCode{name=Bad_ServiceUnsupported,
value=0x800B0000, quality=bad}, reason=null}
Unfortunately implementing the onSubscriptionTransferFailed method does not help because it is never called.
client.getSubscriptionManager().addSubscriptionListener(new UaSubscriptionManager.SubscriptionListener() {
#Override
public void onSubscriptionTransferFailed(UaSubscription subscription, StatusCode statusCode) {
try {
LOGGER.info("onSubscriptionTransferFailed");
client.getSubscriptionManager().clearSubscriptions();
client.disconnect().get();
run(client, serverAddress, biConsumer, requestedPublishingInterval);
} catch (InterruptedException | ExecutionException e) {
LOGGER.error("Failed re-subscription: {}", e.getMessage(), e);
}
}
}
Any idea how I can get the client to detect its current problem and resubscribe on server events?
Thank you in advance.
Update:
Found this commit https://github.com/eclipse/milo/commit/e854374845e6c5f46a7b033c2c62cee2ee10622a and was able to fix the problem by just increasing the Milo client sdk version to 0.6.1. Version 0.5.3 should probably also fix it but I did not test it.

SignalR Core - Error: Websocket closed with status code: 1006

I use SignalR in an Angular app. When I destroy component in Angular I also want to stop connection to the hub. I use the command:
this.hubConnection.stop();
But I get an error in Chrome console:
Websocket closed with status code: 1006
In Edge: ERROR Error: Uncaught (in promise): Error: Invocation canceled due to connection being closed. Error: Invocation canceled due to connection being closed.
It actually works and connection has been stopped, but I would like to know why I get the error.
This is how I start the hub:
this.hubConnection = new HubConnectionBuilder()
.withUrl("/matchHub")
.build();
this.hubConnection.on("MatchUpdate", (match: Match) => {
// some magic
})
this.hubConnection
.start()
.then(() => {
this.hubConnection.invoke("SendUpdates");
});
EDIT
I finally find the issue. Its caused by change streams from Mongo. If I remove the code from SendUpdates() method then OnDisconnected is triggered.
public class MatchHub : Hub
{
private readonly IMatchManager matchManager;
public MatchHub(IMatchManager matchManager)
{
this.matchManager = matchManager;
}
public async Task SendUpdates() {
using (var changeStream = matchManager.GetChangeStream()) {
while (changeStream.MoveNext()) {
var changeStreamDocument = changeStream.Current.FullDocument;
if (changeStreamDocument == null) {
changeStreamDocument = BsonSerializer.Deserialize<Match>(changeStream.Current.DocumentKey);
}
await Clients.Caller.SendAsync("MatchUpdate", changeStreamDocument);
}
}
}
public override async Task OnDisconnectedAsync(Exception exception)
{
await base.OnDisconnectedAsync(exception);
}
}
Method GetChangeStream from the manager.
ChangeStreamOptions options = new ChangeStreamOptions() { FullDocument = ChangeStreamFullDocumentOption.UpdateLookup };
var watch = mongoDb.Matches.Watch(options).ToEnumerable().GetEnumerator();
return watch;
But I don't know how to fix it.
This can be for many reasons but i think it is most likely this one:
I think this is because of how the server is handling the connected / disconnected events. I can't say for sure but the connection closing needs to handled correctly on the server also with code. Try overriding the built in On Connected /Disconnected methods on the server and see. My assumption only is that you're closing it but the server isn't closing properly and therefore not relaying the proper closed response.
found as a comment at : getting the reason why websockets closed with close code 1006
Where you don't need to change the connection/disconection because evrything works fine. But as an answer this one is the most likely.
It throws error because the callback doesn't get clear properly.
And it is caused by the return data from websocket.
normally it should return like
However, for some reason it might return something like
the very last response breaking into 2 pieces
And that causes the issue.
I don't think there is a way to bypass this without changing the source code.
I reported this on github repo as well at here
It turns out that I can just utilize invocation response to notify client to stop the hub. So it doesn't trigger racing issue.

Unable to pull contacts from gmail after GWT 2.4 upgrade

I am currently running into an issue when attempting to pull contacts from a users gmail account.
Prior to upgrading to GWT 2.4 this worked as required, since upgrading to 2.4 (from 2.3) we are running into a really obscure error that is causing it to fail.
try
{
myService.setUserCredentials(username, password);
}
catch (final AuthenticationException e)
{
//log exception
}
URL feedURL;
try
{
feedURL = new URL("https://www.google.com/m8/feeds/contacts/default/full?max-results=1000");
}
catch (final MalformedURLException e)
{
//log exception
}
ContactFeed resultFeed;
try
{
resultFeed = myService.getFeed(feedURL, ContactFeed.class);
}
catch (final IOException e) //Exception is caught here, see below
{
//log exception
}
catch (ServiceException e)
{
//log exception
}
What is being caught:
cause = ProtocolException
detailedMessage= "Missing WWW-Authenticate header"
java.net.ProtocolException: Missing WWW-Authenticate header
With the upgrade to GWT 2.4 is there any new authentication that needs to be done? I have not found anything to say this is the case, specificly on their developer guide.
Any advice is greatly appreciated at this point.
This issue was being caused by a third party library. The library was using httpclient 1.0, which gdata is not compatible with.
For some reason gdata is trying to communicate using the outdated 1.0 instead of latest.