November 30, 20196 yr My custom made script doesn't start and the logger shows that some of my classes keep getting the message "Failed to load local script". I then pinpointed the exact problem to some async HTTP requests (both OkHttp and Unirest libraries). Synchronous requests work fine, but if I leave an async request in my code, the script will never be able to start and the logger will print that there is something wrong with the class that has the async method. What can I do to fix this?
December 1, 20196 yr Author 46 minutes ago, Medusa said: 👏You👏need👏to👏link👏code👏and👏errors Error in logger : [ERROR][12/01 10:34:28 AM]: Failed to load local script : com/osbot/jagex/AccountManager.class Code: import kong.unirest.HttpResponse; import kong.unirest.JsonNode; import kong.unirest.Unirest; import java.util.concurrent.CompletableFuture; public class AccountManager { public void registerAccount(String recaptchaResponse) { Unirest.post("http://www.google.com") .field("email", "xxxxx") .asJsonAsync(new Callback<JsonNode>() { @Override public void completed(HttpResponse<JsonNode> response) { System.out.println("xxx"); } @Override public void failed(UnirestException e) { e.printStackTrace(); cancelled(); } @Override public void cancelled() { System.out.println("login failed."); } }); } } As I said, if I replace this with a synchronous call I don't get that error. The same goes for both OkHttp and Unirest libs. Edited December 1, 20196 yr by testrobot22
December 2, 20196 yr Author Ugh, apparently, for some reason, OSBOT can't load this specific interface 'Callback', which is used for async calls. Does anyone have any idea why?? I'm using plenty of libs and everything else is working fine. Caused by: java.lang.NoClassDefFoundError: okhttp3/Callback at com.bot.osrs.gui.FXController.registerAccount(FXController.java:44) ... 57 more Caused by: java.lang.ClassNotFoundException: okhttp3.Callback at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 58 more EDIT: It seems it's actually a Kotlin file: Callback.kt, I presume Osbot doesn't support that? Edited December 2, 20196 yr by testrobot22 dddddddddd
December 2, 20196 yr Author Why must I suffer.. lmao Caused by: java.security.AccessControlException: access denied ("java.net.NetPermission" "getProxySelector") at java.security.AccessControlContext.checkPermission(Unknown Source) at java.security.AccessController.checkPermission(Unknown Source) at java.lang.SecurityManager.checkPermission(Unknown Source) at org.osbot.Gb.checkPermission(mh:186) at java.net.ProxySelector.getDefault(Unknown Source) at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:167) at okhttp3.OkHttpClient.<init>(OkHttpClient.kt:211) Edited December 2, 20196 yr by testrobot22 ddddddd
December 3, 20196 yr Author So.. Uhh, can anyone help? Does OSBOT block getProxySelector? How can I send HTTP requests then?
December 3, 20196 yr Is this for creating accounts on runescape? If so you could create this as a console app and create a bunch of accounts then dump them into a text file and have your script read from that text file. The file will have to be in the osbot data folder. I think thats the only location that scripts can read/write from.
December 4, 20196 yr Author 20 hours ago, BravoTaco said: Is this for creating accounts on runescape? If so you could create this as a console app and create a bunch of accounts then dump them into a text file and have your script read from that text file. The file will have to be in the osbot data folder. I think thats the only location that scripts can read/write from. Yes, it's for registering accounts. The idea was to have all in one solution, though, of course I can just make account registration a separate process. Then again, I imagine, that I would still need sometimes to use HTTP requests, for example, to check GE prices.
December 5, 20196 yr 7 hours ago, testrobot22 said: Yes, it's for registering accounts. The idea was to have all in one solution, though, of course I can just make account registration a separate process. Then again, I imagine, that I would still need sometimes to use HTTP requests, for example, to check GE prices. For checking GE prices you can do it with HttpUrlConnection class. I once used it to compare github version vs the current script version.
December 5, 20196 yr Author 15 hours ago, BravoTaco said: For checking GE prices you can do it with HttpUrlConnection class. I once used it to compare github version vs the current script version. Alright, Ill try that out. What kind of solution others are using?
Create an account or sign in to comment