platonai / PulsarRPA

Automate webpages at scale, scrape web data completely and accurately with high performance, distributed AI-RPA.
Apache License 2.0
778 stars 119 forks source link

InaccessibleObjectException: Unable to make field private final long java.time.Duration.seconds accessible #28

Closed platonai closed 3 weeks ago

platonai commented 1 year ago

bin/build-run.sh // OK 2023-02-16 22:12:09.736 INFO [main] a.p.p.a.m.PulsarMasterKt - Starting PulsarMasterKt v1.10.10-SNAPSHOT using Java 17.0.5 on regulus with PID 21576 (/home/vincent/workspace/pulsar-1.10.x/pulsar-app/pulsar-master/target/pulsar-master-1.10.10-SNAPSHOT.jar started by vincent in /home/vincent/workspace/pulsar-1.10.x)

And then we issue an X-SQL to scrape:

bin/scrape.sh // The server issues the warning message

... ... ...

2023-02-16 22:14:14.929 WARN [r-worker-2] a.p.p.c.i.StreamingCrawler - [Unexpected]

java.lang.reflect.InaccessibleObjectException: Unable to make field private final long java.time.Duration.seconds accessible: module java.base does not "opens java.time" to unnamed module @62bd2070 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:178) at java.base/java.lang.reflect.Field.setAccessible(Field.java:172) at com.google.gson.internal.reflect.UnsafeReflectionAccessor.makeAccessible(UnsafeReflectionAccessor.java:44) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:159) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:489) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.createBoundField(ReflectiveTypeAdapterFactory.java:117) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.getBoundFields(ReflectiveTypeAdapterFactory.java:166) at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory.create(ReflectiveTypeAdapterFactory.java:102) at com.google.gson.Gson.getAdapter(Gson.java:489) at com.google.gson.Gson.toJson(Gson.java:727) at com.google.gson.Gson.toJson(Gson.java:714) at com.google.gson.Gson.toJson(Gson.java:669) at com.google.gson.Gson.toJson(Gson.java:649) at ai.platon.pulsar.browser.common.InteractSettings.overrideConfiguration(BrowserSettings.kt:391) at ai.platon.pulsar.common.options.LoadOptions.overrideConfiguration(LoadOptions.kt:691) at ai.platon.pulsar.common.options.LoadOptions.overrideConfiguration(LoadOptions.kt:671) at ai.platon.pulsar.common.urls.CombinedUrlNormalizer.createLoadOptions(CombinedUrlNormalizer.kt:49) at ai.platon.pulsar.common.urls.CombinedUrlNormalizer.normalize(CombinedUrlNormalizer.kt:21) at ai.platon.pulsar.context.support.AbstractPulsarContext.normalize(AbstractPulsarContext.kt:209) at ai.platon.pulsar.session.AbstractPulsarSession.normalize(AbstractPulsarSession.kt:132) at ai.platon.pulsar.session.PulsarSession$DefaultImpls.normalize$default(PulsarSession.kt:187) at ai.platon.pulsar.session.AbstractPulsarSession.loadDeferred$suspendImpl(AbstractPulsarSession.kt:185) at ai.platon.pulsar.session.AbstractPulsarSession.loadDeferred(AbstractPulsarSession.kt) at ai.platon.pulsar.crawl.impl.StreamingCrawler.loadWithMinorExceptionHandled(StreamingCrawler.kt:475) at ai.platon.pulsar.crawl.impl.StreamingCrawler.access$loadWithMinorExceptionHandled(StreamingCrawler.kt:66) at ai.platon.pulsar.crawl.impl.StreamingCrawler$loadWithTimeout$2.invokeSuspend(StreamingCrawler.kt:395) at ai.platon.pulsar.crawl.impl.StreamingCrawler$loadWithTimeout$2.invoke(StreamingCrawler.kt) at ai.platon.pulsar.crawl.impl.StreamingCrawler$loadWithTimeout$2.invoke(StreamingCrawler.kt) at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturnIgnoreTimeout(Undispatched.kt:100) at kotlinx.coroutines.TimeoutKt.setupTimeout(Timeout.kt:146) at kotlinx.coroutines.TimeoutKt.withTimeout(Timeout.kt:44) at ai.platon.pulsar.crawl.impl.StreamingCrawler.loadWithTimeout(StreamingCrawler.kt:394) at ai.platon.pulsar.crawl.impl.StreamingCrawler.runLoadTaskWithEventHandlers(StreamingCrawler.kt:376) at ai.platon.pulsar.crawl.impl.StreamingCrawler.access$runLoadTaskWithEventHandlers(StreamingCrawler.kt:66) at ai.platon.pulsar.crawl.impl.StreamingCrawler$runWithStatusCheck$2.invokeSuspend(StreamingCrawler.kt:354) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:570) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:750) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:677) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:664)

platonai commented 1 year ago

It's OK with JDK-11, failed with JDK-17.

platonai commented 1 year ago

Solution:

  1. allow the user specify the JAVA_HOME
  2. fix Gson/Java8-datatime serialization problem with JDK-17
  3. run all tests with JDK-17

see also: https://bugs.chromium.org/p/gerrit/issues/detail?id=15502