gazbert / bxbot

A simple Bitcoin trading bot written in Java.
MIT License
779 stars 275 forks source link

Build Fails - IllegalAccessError #87

Closed mikehfauzy closed 6 years ago

mikehfauzy commented 6 years ago

The build fails with both master and version 8.5.0.

There are several errors. This issue is specifically for the IllegalAccessError. There are other build errors as well (e.g. certain poms are missing jaxb, and there are PowerMock/Mockito errors), but I suspect that I just need to clone the correct branch, because travis-ci.org indicates that the build is working, so I'm only creating 1 issue.

What branch should I clone to fix the build? If it is not fixed already, I'm happy to work on it.

Example Error: com.gazbert.bxbot.exchanges.TestKrakenExchangeAdapter > initializationError FAILED org.objenesis.ObjenesisException Caused by: java.lang.reflect.InvocationTargetException Caused by: java.lang.IllegalAccessError

Reproduction steps: In eclipse 4.7.2, 1 Open the Gradel Tasks view. 2 right click on bxbot-parent/build/build 3 Select "Run Gradle Tasks"

Gradle Version: 4.4.1 Java Home: [path redacted]jdk-9.0.1 JVM Arguments: None Program Arguments: None Build Scans Enabled: false Offline Mode Enabled: false Gradle Tasks: build OS: Linux

gazbert commented 6 years ago

Hi @mikehfauzy - looks like you're trying to build/run on Java 9 - the bot is only supported (master + Releases) on Java 8 at the moment.

We've started the migration work on the bxbot-java9 branch (#80) but I've not had time to finish this yet - this is the branch to clone to fix Java 9 issues.

The main problems - as you rightly point out - are jaxb being removed in Java 9 (we've fixed this by using explicit dependency on the bxbot-java9 branch) and Powermock - https://github.com/powermock/powermock/issues/783 - looks like a beta release might be available....

Thanks for offering to help out - I'm hoping it's just the Powermock tests left to fix... Go for it!

mikehfauzy commented 6 years ago

On it.

mikehfauzy commented 6 years ago

I'm seeing build.gradle and pom.xml files. Are we trying to keep both working, or just 1?

mikehfauzy commented 6 years ago

Powermock issue #864 [1] is blocking with no estimate for completion. Apparently, there is a wonky workaround [2], but at this point, I recommend waiting for them to deal and keeping bxbot's support at 1.8 for now.

I'm going to switch to jdk 1.8 and start over.

To reproduce: bxbot-parent/build.gradle powermock_junit: dependencies.create("org.powermock:powermock-module-junit4:2.0.0-beta.5"), powermock_api_easymock: dependencies.create("org.powermock:powermock-api-easymock:2.0.0-beta.5"),

References: [1] Powermock issue #864 https://github.com/powermock/powermock/issues/864

[2] Quoting Workaround: This could be hotfixed by passing --add-opens java.xml/jdk.xml.internal=ALL-UNNAMED

mikehfauzy commented 6 years ago

Confirmed. Rolling back to jdk 1.8 is sufficient. There is already a java9 issue, so I'm closing this issue as a duplicate.

gazbert commented 6 years ago

@mikehfauzy - thanks for looking into this. I've been busy with the day job and catching up tonight!

Hmm, looks like we need to wait a little longer, or folks can disable the tests if they really need Java 9 for now.

As an aside, I'll review the use of Powermock; we might be able to get away with not using it with some crafty refactoring or rework of the tests - I think it's mainly the adapter tests that use it. I was a bit lazy writing the unit tests at the time ;-)