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.

NoSuchMethodError help (again)

Featured Replies

Hi guys, I am trying to make a safe-cracker script, I was cleaning up my projects so I copied them all into one workspace for all my osbot stuff, ever since I get this error at runtime when I run my jar file (there are no compiler errors)

[ERROR][09/15 03:45:44 PM]: Uncaught exception!
java.lang.NoSuchMethodError: core.Task.<init>(Lcore/SafeCracker;)V
	at tasks.ClickSafe.<init>(ClickSafe.java:14)
	at core.SafeCracker.onStart(SafeCracker.java:59)
	at org.osbot.rs07.event.ScriptExecutor.onStart(lj:110)
	at org.osbot.rs07.event.ScriptExecutor.start(lj:194)
	at org.osbot.prN.run(cp:367)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Last time I fixed it by deleting everything and making a new project, but now even if I clean all the class files and rebuild the project I still get this error. 

 

Here is the src folder: http://www.mediafire.com/download/ljcgco1kwmro75z/New_Compressed_%28zipped%29_Folder.zip

 

Not sure what to do anymore :/

Are you using notepad++ to compile or something? Your IDE should be giving you some pretty big hints as to what method doesn't exist.

  • Author

Are you using notepad++ to compile or something? Your IDE should be giving you some pretty big hints as to what method doesn't exist.

 

That error log is from osbot when I run the script, and Im using eclpise, which is showing no errors, not even warnings.

Ah, didn't see it was an uncaught exception. Are you sure you are compiling against the latest version of OSBot (not using against, compiling against)?

 

 

  • Author

Ah, didn't see it was an uncaught exception. Are you sure you are compiling against the latest version of OSBot (not using against, compiling against)?

 

Im using the latest version (2.3.114) in my build path

It also shows you which lines:

at tasks.ClickSafe.<init>(ClickSafe.java:14)
at core.SafeCracker.onStart(SafeCracker.java:59)

What methods are you using on those lines?

  • Author

It also shows you which lines:

at tasks.ClickSafe.<init>(ClickSafe.java:14)

at core.SafeCracker.onStart(SafeCracker.java:59)

What methods are you using on those lines?

13  public ClickSafe(SafeCracker sA) {
14		super(sA);
15  }
59  Collections.addAll(nodes, new ClickSafe(this), new EatFood(this), new CloseBank(this), 
60  new DepositGems(this), new OpenBank(this), new ReturnToCracking(this), new WithdrawFood(this));

I posted the src folder link btw

 

EDIT: btw if I remove the clicksafe object, the error will just show for EatFood instead at the same place

Edited by Chicken Wing

I'm taking it that you didn't write that task system yourself? You might want to look into using enum states until you get a little more familiar with Java.

 

In the meantime check out some of this stuff:

https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html

https://docs.oracle.com/javase/tutorial/java/IandI/super.html

https://docs.oracle.com/javase/tutorial/java/concepts/interface.html

  • Author

I'm taking it that you didn't write that task system yourself?

 

Well, I used this tutorial to write it: http://osbot.org/forum/topic/48284-javatutorial-how-to-get-a-single-stage-node-framework-intermediate/ , and it works, I have a script on the sdn which uses it and it works fine, in fact the code was working fine before, its just when I copied it over from another project into a new eclipse project

 

The comparator stuff was just something I was trying out, Its not used 

re-create the project and move over the class files

 

Move which class files to where?

You should show your workspace hierarchy.

When this happens due to relocating, there's a good chance another Task binary file is interfering (one which does not have that constructor, but maybe a constructor which accepts a different script or maybe has no parameters).

Since a ClassNotFoundException was not thrown, there is definitely a Task type, it just doesn't contain the constructor you need. Do you have any other Task files in the workspac/project that you moved the script to?

Edited by fixthissite

  • Author

You should show your workspace hierarchy.

When this happens due to relocating, there's a good chance another Task binary file is interfering (one which does not have that constructor, but maybe a constructor which accepts a different script or maybe has no parameters).

Since a ClassNotFoundException was not thrown, there is definitely a Task type, it just doesn't contain the constructor you need. Do you have any other Task files in the workspac/project that you moved the script to?

 

This is all thats in the workspace now and it still gives the error 

 

a1b7d0948c9f8600e389c8c436367b0a.png

I'm taking it that you didn't write that task system yourself? You might want to look into using enum states until you get a little more familiar with Java.

 

In the meantime check out some of this stuff:

https://docs.oracle.com/javase/tutorial/java/IandI/subclasses.html

https://docs.oracle.com/javase/tutorial/java/IandI/super.html

https://docs.oracle.com/javase/tutorial/java/concepts/interface.html

 

 

I understand all those stuff, I understand how the task system works, not sure what you mean by enum states though so ill check that out, thank you for your help though I appreciate it smile.png

Edited by Chicken Wing

That's really strange. I'm not sure how the client handles classloading for scripts, so this is a long shot, but:

Is this a local script?

Do you have other local scripts?

Do those other local scripts use the same package hierachy as this one, and possibly contain a core.Task?

Try temporarily removing any other local scripts you may have. This is just to make sure that in the case of the classloader loading types of other local scripts, none of those script's types conflict with the one you are testing.

It would also be helpful to elaborate more on the situation. Do you happen to run any other scripts before running this one? Has this happened to you before (your title says again, so...), and if so what was the issue and was it with this same script? It's easier to help if you give as much detail as possible

  • Author

That's really strange. I'm not sure how the client handles classloading for scripts, so this is a long shot, but:

Is this a local script?

Do you have other local scripts?

Do those other local scripts use the same package hierachy as this one, and possibly contain a core.Task?

Try temporarily removing any other local scripts you may have. This is just to make sure that in the case of the classloader loading types of other local scripts, none of those script's types conflict with the one you are testing.

It would also be helpful to elaborate more on the situation. Do you happen to run any other scripts before running this one? Has this happened to you before (your title says again, so...), and if so what was the issue and was it with this same script? It's easier to help if you give as much detail as possible

 

I have just fixed this whole problem by deleting all my workspaces (and projects), and re-downloading eclipse, the script runs fine now as it should...

 

But to answer your questions, it was a local script, and there were other scripts containing a core.task, but the other core.task's had different constructors

 

Ill see if adding more projects now breaks anything

 

EDIT: It doesnt. 

 

I don't know why this happened but its fixed now and I have no (exact) idea why

Edited by Chicken Wing

I have just fixed this whole problem by deleting all my workspaces (and projects), and re-downloading eclipse, the script runs fine now as it should...

But to answer your questions, it was a local script, and there were other scripts containing a core.task, but the other core.task's had different constructors

Ill see if adding more projects now breaks anything

Yes, the other Tasks having different constructors could have caused the problem. If one of those tasks had higher priority in the classpath than the Task you wanted (assuming they were both loaded in for some reason), you would get that error, since they do not contain the constructor you want (instead, they contain one for a different script)

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.