Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to start crawler using Java 17 #322

Open
aayushL opened this issue Jan 16, 2023 · 4 comments
Open

Unable to start crawler using Java 17 #322

aayushL opened this issue Jan 16, 2023 · 4 comments

Comments

@aayushL
Copy link

aayushL commented Jan 16, 2023

Hello, I am trying to run ache crawler and dump data in my elasticsearch database. But I am getting this error

`[2023-01-16 10:52:19,001]ERROR [main] (Main.java:261) - Crawler execution failed: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Object[] java.util.Arrays$ArrayList.a accessible: module java.base does not "opens java.util" to unnamed module @6fa4fbe3

java.lang.RuntimeException: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Object[] java.util.Arrays$ArrayList.a accessible: module java.base does not "opens java.util" to unnamed module @6fa4fbe3
at de.javakaffee.kryoserializers.ArraysAsListSerializer.(ArraysAsListSerializer.java:47)
at achecrawler.util.Kryos.registerDeserializers(Kryos.java:36)
at achecrawler.util.Kryos.access$000(Kryos.java:24)
at achecrawler.util.Kryos$1.initialValue(Kryos.java:29)
at achecrawler.util.Kryos$1.initialValue(Kryos.java:26)
at java.base/java.lang.ThreadLocal.setInitialValue(ThreadLocal.java:195)
at java.base/java.lang.ThreadLocal.get(ThreadLocal.java:172)
at achecrawler.util.Kryos.serializeObject(Kryos.java:58)
at achecrawler.util.persistence.rocksdb.StringObjectHashtable.put(StringObjectHashtable.java:20)
at achecrawler.util.persistence.PersistentHashtable.commit(PersistentHashtable.java:122)
at achecrawler.link.frontier.Frontier.commit(Frontier.java:28)
at achecrawler.link.frontier.FrontierManager.addSeeds(FrontierManager.java:254)
at achecrawler.link.frontier.FrontierManagerFactory.create(FrontierManagerFactory.java:44)
at achecrawler.link.LinkStorage.create(LinkStorage.java:169)
at achecrawler.crawler.async.AsyncCrawler.create(AsyncCrawler.java:114)
at achecrawler.crawler.CrawlersManager.createCrawler(CrawlersManager.java:104)
at achecrawler.Main$StartCrawl.run(Main.java:247)
at achecrawler.Main.main(Main.java:59)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.lang.Object[] java.util.Arrays$ArrayList.a accessible: module java.base does not "opens java.util" to unnamed module @6fa4fbe3
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:180)
at java.base/java.lang.reflect.Field.setAccessible(Field.java:174)
at de.javakaffee.kryoserializers.ArraysAsListSerializer.(ArraysAsListSerializer.java:45)
... 17 common frames omitted
`
I am running following command:
ache startCrawl -c ./config/ache.yml -s ./config/sample.seeds -o ../data/ -e http://localhost:9200

@aecio
Copy link
Member

aecio commented Jan 20, 2023

It looks like you are using a recent Java version and not exporting the proper modules required by some crawler dependencies.

@aayushL
Copy link
Author

aayushL commented Jan 21, 2023

Thank you for your reply.
For fixing this shall I downgrade my Java version? which version would be suitable?
or
Is there any other fix without downgrading Java?

@aecio
Copy link
Member

aecio commented Jan 23, 2023

I would expect it to work fine on Java 11 (the Docker version uses it). On recent Java versions, you can make modules accessible by adding flags --add-opens or --add-exports with the desired arguments to the java command. However, I'm not sure which values need to be passed as arguments to fix the specific problem you are reporting.

In ACHE, you can add these flags by setting the environment variable JAVA_OPTS before running the crawler. For example, in the Dockerfile we currently set JAVA_OPTS='-XX:+UseContainerSupport -XX:MaxRAMPercentage=80' to configure memory usage.

@aayushL
Copy link
Author

aayushL commented Jan 26, 2023

Solved it by downgrading my java to java 11. Now its running perfectly fine.

@aecio aecio changed the title Unable to start crawler Unable to start crawler using Java 17 Mar 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants