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.
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)
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?
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.
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?