Compiled Jar keeps throwing: Uncaught exception in the SynchronizationContext - firebase

I have been trying to make a small application which first scans a HTML for data and then uploads it to my Firestore. I'm now essentially done with it and when starting it from within IntelliJ IDEA it works just fine. However as soon as I export it in to an artifact it starts throwing the following exception when trying to download/upload from/to Firestore!
I should mention that I'm coding in Koltin/JVM as it is way easier. Since there is no Kotlin Firebase-Admin version I'm just using the Java one which shouldn't be a problem since Kotlin compiles down to Java. If I'm wrong about that please correct me!
Nov 27, 2019 6:59:17 PM io.grpc.internal.ManagedChannelImpl$1 uncaughtException
SEVERE: [Channel<1>: (firestore.googleapis.com:443)] Uncaught exception in the SynchronizationContext. Panic!
java.lang.IllegalStateException: Could not find policy 'pick_first'. Make sure its implementation is either registered to LoadBalancerRegistry or included in META-INF/services/io.grpc.LoadBalancerProvider from your jar files.
at io.grpc.internal.AutoConfiguredLoadBalancerFactory$AutoConfiguredLoadBalancer.<init>(AutoConfiguredLoadBalancerFactory.java:97)
at io.grpc.internal.AutoConfiguredLoadBalancerFactory.newLoadBalancer(AutoConfiguredLoadBalancerFactory.java:67)
at io.grpc.internal.ManagedChannelImpl.exitIdleMode(ManagedChannelImpl.java:379)
at io.grpc.internal.ManagedChannelImpl$ChannelTransportProvider$1ExitIdleModeForTransport.run(ManagedChannelImpl.java:473)
at io.grpc.SynchronizationContext.drain(SynchronizationContext.java:95)
at io.grpc.SynchronizationContext.execute(SynchronizationContext.java:127)
at io.grpc.internal.ManagedChannelImpl$ChannelTransportProvider.get(ManagedChannelImpl.java:477)
at io.grpc.internal.ClientCallImpl.startInternal(ClientCallImpl.java:257)
at io.grpc.internal.ClientCallImpl.start(ClientCallImpl.java:190)
at io.grpc.internal.CensusTracingModule$TracingClientInterceptor$1.start(CensusTracingModule.java:394)
at io.grpc.internal.CensusStatsModule$StatsClientInterceptor$1.start(CensusStatsModule.java:695)
at io.grpc.ForwardingClientCall.start(ForwardingClientCall.java:32)
at com.google.api.gax.grpc.GrpcHeaderInterceptor$1.start(GrpcHeaderInterceptor.java:94)
at com.google.api.gax.grpc.GrpcDirectStreamController.startCommon(GrpcDirectStreamController.java:115)
at com.google.api.gax.grpc.GrpcDirectStreamController.start(GrpcDirectStreamController.java:101)
at com.google.api.gax.grpc.GrpcDirectServerStreamingCallable.call(GrpcDirectServerStreamingCallable.java:68)
at com.google.api.gax.grpc.GrpcServerStreamingRequestParamCallable.call(GrpcServerStreamingRequestParamCallable.java:61)
at com.google.api.gax.grpc.GrpcExceptionServerStreamingCallable.call(GrpcExceptionServerStreamingCallable.java:59)
at com.google.api.gax.rpc.WatchdogServerStreamingCallable.call(WatchdogServerStreamingCallable.java:69)
at com.google.api.gax.rpc.ServerStreamingCallable$1.call(ServerStreamingCallable.java:237)
at com.google.api.gax.rpc.ServerStreamingAttemptCallable.call(ServerStreamingAttemptCallable.java:230)
at com.google.api.gax.rpc.ServerStreamingAttemptCallable.start(ServerStreamingAttemptCallable.java:193)
at com.google.api.gax.rpc.RetryingServerStreamingCallable.call(RetryingServerStreamingCallable.java:87)
at com.google.api.gax.tracing.TracedServerStreamingCallable.call(TracedServerStreamingCallable.java:76)
at com.google.api.gax.rpc.ServerStreamingCallable$1.call(ServerStreamingCallable.java:237)
at com.google.api.gax.rpc.ServerStreamingCallable.serverStreamingCall(ServerStreamingCallable.java:166)
at com.google.api.gax.rpc.ServerStreamingCallable.serverStreamingCall(ServerStreamingCallable.java:178)
at com.google.cloud.firestore.FirestoreImpl.streamRequest(FirestoreImpl.java:474)
at com.google.cloud.firestore.FirestoreImpl.getAll(FirestoreImpl.java:243)
at com.google.cloud.firestore.FirestoreImpl.getAll(FirestoreImpl.java:253)
at com.google.cloud.firestore.FirestoreImpl.getAll(FirestoreImpl.java:143)
at com.google.cloud.firestore.DocumentReference.get(DocumentReference.java:354)
at FirebaseHandler.getLehrer(FirebaseHandler.kt:95)
at HtmReader.readFile(HtmReader.kt:12)
at MainView.theStuff(MainView.kt:61)
at MainView.onDock(MainView.kt:44)
at tornadofx.UIComponent.callOnDock$tornadofx(Component.kt:700)
at tornadofx.UIComponent$rootSceneWindowShowingPropertyChangeListener$1.changed(Component.kt:556)
at tornadofx.UIComponent$rootSceneWindowShowingPropertyChangeListener$1.changed(Component.kt:327)
at com.sun.javafx.binding.ExpressionHelper$SingleChange.fireValueChangedEvent(ExpressionHelper.java:182)
at com.sun.javafx.binding.ExpressionHelper.fireValueChangedEvent(ExpressionHelper.java:81)
at javafx.beans.property.ReadOnlyBooleanPropertyBase.fireValueChangedEvent(ReadOnlyBooleanPropertyBase.java:72)
at javafx.beans.property.ReadOnlyBooleanWrapper.fireValueChangedEvent(ReadOnlyBooleanWrapper.java:103)
at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:110)
at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:144)
at javafx.stage.Window.setShowing(Window.java:922)
at javafx.stage.Window.show(Window.java:937)
at javafx.stage.Stage.show(Stage.java:259)
at tornadofx.App.start(App.kt:101)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$161(LauncherImpl.java:863)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$174(PlatformImpl.java:326)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
My code which (in this case) downloads stuff is as following:
fun getLehrer(): HashMap<String, Any> {
[...]
val out = HashMap<String, Any>()
try {
val future = firestore.collection("stuff").document("lehrer").get()
future.await()
if (future.isDone) {
[...]
}
} catch (ex: Exception) {
println(" ++ cant get lehrer liste")
}
[...]
}
The error occurs at this line:
val future = firestore.collection("stuff").document("lehrer").get()
I have been trying to fix this for days now and literally spend hours googeling and trying different things but nothing has worked for me so far!
I tried:
randomly adding a LoadBalancer since I wasn't able to find any viable docs
adding the loadbalancer to my META-INF/services
I also found something that seemed similar here (https://github.com/grpc/grpc-java/issues/5493) but it talks about a load of stuff I don't use and frankly don't understand
FYI: Weirdly my icon from my resource folder turns into a completely different one in the Jar. Don't ask me why. I couldn't find an answer to that as well, but it isn't such a big issue since I can just replace that in the jar.
Oh and also this is my first question so if I made any mistakes I'm sorry! I probably made some spelling errors as well which I apologize for.
Any help would be greatly appreciated!

Hey so after googling some more I found some an article listing code snipets from LoadBalancerRegistry (https://www.codota.com/code/java/classes/io.grpc.LoadBalancerRegistry) and I scrolled around in it and found this: PickFirstBalancerFactory.init()
So i decided to look for this Factory but couldn't find it, instead I found PickFirstLoadBalancerProvider(). Remembering from randomly going through the autocomplete that in order to register something to LoadBalancerRegistry one would need a Provider.
Long story short I set them both together and added the following to the init section of my class and it works fine now!
LoadBalancerRegistry.getDefaultRegistry().register(PickFirstLoadBalancerProvider())
Thought I should answer if anyone has the same issue!
FYI: The icon still changes to that weird one. I don't know why or how thats even possible but it works if I replace it in the .jar so I don't really care xD

Related

Sulu: How to get the exact location of template errors in preview?

When I develop templates in Sulu 1.6 and an error occurs, where can I find the full error or exact error location? Is there some kind of special log or do I need to change the default location?
The corresponding /admin/websocket/admin response contains only this (basically the same information):
{
"handler":"sulu_preview.preview",
"message":{
"code":9903,
"message":"Unclosed \"block\".",
"type":"Sulu\\Bundle\\PreviewBundle\\Preview\\Exception\\TwigException"
},
"options":[],
"error":true
}
Currently I only see messages like this:
It would be also helpful to know, where the catch block for this is, in case it is not jet implemented.
Thx a lot!
So it turned out, that there is no logging enabled, and because the PreviewRendere throws a new Exception, the original information is pretty much lost. It can be added in this way: https://github.com/sulu/sulu/pull/4363
Best wishes
Andreas

Error: 5 NOT_FOUND: Resource not found (resource=blockchain-transactions)

I’ve got an angular/node.js application that uses firebase functions and blockchain in the back end.
I’m getting an error when it tries to add an object to the blockchain:
Error: 5 NOT_FOUND: Resource not found (resource=blockchain-transactions)
This is coming from this line here:
const pubsub = new PubSub();
pubsub.topic(‘blockchain-transactions').publisher().publish(signedBlockTransaction);
The call to publish(signedBlockTransaction) is throwing the error.
All I can understand about this error is that it’s looking for a resource called ‘blockchain-transaction’ and it can’t find it. But beyond this, I’m not sure why it can’t find it or how to fix it (I didn’t write the code).
One thing that may be affecting it is the following:
I was dealing with a different error which I managed to get by but I don’t know if I did it the right way. The error was:
Cannot read property ‘privatekey’ of undefined
…when trying to execute this line:
functions.config().blockchain.privatekey
It turns out .runtimeconfig.json was empty, literally only containing {}
So in an attempt to give it a private key, I went to my file id_rsa which contain a private key for something or other (I think github) and added it like so:
{
"blockchain": {
“privatekey": *** my private key ***
}
}
That got me past the first error, but I understood the private key I gave it probably isn’t the one it’s looking for.
So my question is: is the error I’m encountering now a consequence of the wrong private key? If not, what is the cause of the error, and how do I fix it?
Thanks.

browseForOpenMultiple - crashing

I am trying to work with browseForOpenMultiple function inside Flex, sdk 3.5, I am trying to figure out a bug. The browseForOpenMultiple does not crash everytime, but it seems as though I can upload a file once, but when I go to upload a second file, it crashes when the browseForOpenMultiple function is called. Anyone have any ideas about possible causes?
Update:
private function browseForFiles():void
{
fileBrowser = new File();
fileBrowser.addEventListener(FileListEvent.SELECT_MULTIPLE, filesSelected);
fileBrowser.addEventListener(Event.CANCEL, fileSelectionCancelled);
fileBrowser.browseForOpenMultiple("Select Desired Media File(s)", [(mode == "Media")? MediaTypes.getFileFilter() : MediaTypes.getVideoFilter()]);
}
So the code in our array of file extensions was crashing when there were over 60 items listed in an array that gets converted into a string for the FileFilter. This may not be an Adobe limit, but I wanted to make mention that the crash is fixed, so that others who may be encountering issues with browseForOpenMultiple will know what the issue was for this problem. This is not code that I originally wrote, so I will check into it for more clues, but for the time being, too many array items being joined together into a string for FileFilter object caused the crash.
It could be how it's construct the File, without a real file reference.
Try something like this :
var fileBrowser = File.desktopDirectory

Broken JavaScript Registry in Plone 3.1.7

I created a javascript file TTW for a quick fix to something i was working with, and when i went to the portal_javascripts and added it there i was met with this error upon saving:
Exception Type: CompilerError
Exception Value: Path element may not be empty in 'portal/http://www.example.com/portal_skins/cloud.js'
I get that same error every time i attempt to navigate to the portal_javascripts through the ZMI, it's obvious that I incorrectly entered the id of my file, but now I can't even fix it.
I was able to find this example of someone with a similiar issue, but I have no how to go about his fix
http://markmail.org/message/zbjhjoezz2h423yr#query:+page:1+mid:yhgjekdkwnegwqen+state:results
Try this:
http://example.com/portal_javascripts/unregisterResource?id=[your_js_resource_id]

Flash/Flex Error #1063 When Retrieving SharedObject

I have a parts application that is built on Flex 3 and I having a problem with the parts list. The parts list uses two objects:
Part
ArrayOfPart
I cache the parts list locally in a SharedObject. This has been working fine for a couple months. I added a new Boolean property to the Part class and re-imported web services (which shouldn't have affected anything) and now, I can save the ArrayOfPart SharedObject fine, but when I try to retrieve the SharedObject, I get "ArgumentError: Error #1063: Argument count mismatch on ArrayOfPart. Expected 1, got 0. AND then it DELETES my SOL file completely.
(I used RegisterClass on Part and ArrayOfPart, so they both are serializable to SharedObjects)
Here's the steps I followed to get the error:
Save the shared object:
so = SharedObject.getLocal("PartsList");
so.data.AllParts = AllParts;
so.flush();
Verify the SharedObject:
The SharedObject PartsList.sol exists where it should
I opened the SharedObject file and the ArrayOfPart data looks valid
Restart the application and it retrieves the parts list from the SharedObject. This is the line that throws the Error #1063 and causes the sol file to be deleted:
so = SharedObject.getLocal("PartsList");
It looks like the data may not be well-formed when it's saved in the SharedObject? Is this possible?
I solved my own problem.
The ArrayOfPart had a constructor with a parameter. When I removed the constructor, the error went away.
By the way, this was Flash 9.
This looks like a tough one.
I don't think it is a formation or serialization issue. Maybe something else in your code is writing to the shared object?
Is there any way you can share your source? This would help as I personally don't have enough info to diagnose what is going on w/o seeing the rest of the code :(
Also....
Is there anything else that is writing to or changing this shared object?
Are all my objects created in AS3 or are some in MXML (I have noticed that the Flex compiler does not always do a good job figuring out MXML).
What version of Flash do I have?
If its Flash 10 does the same problem occur in Flash 9?
Does this happen in all browsers and on all platforms?
Just a hunch, but, since I installed Flash Player 10, I am seeing lots of errors with Shared Objects when browsing. Could it be related to newly introduced sandbox/security restrictions?

Resources