Jump to content
View in the app

A better way to browse. Learn more.

OSBot :: 2007 OSRS Botting

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

HTTP request keeps failing

Featured Replies

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?

👏You👏need👏to👏link👏code👏and👏errors

  • 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 by testrobot22

  • 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 by testrobot22
dddddddddd

  • 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 by testrobot22
ddddddd

  • Author

So.. Uhh, can anyone help? Does OSBOT block getProxySelector? How can I send HTTP requests then?

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.

  • 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.

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.

  • 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

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.