asciidoctor / asciidoctor-maven-plugin

A Maven plugin that uses Asciidoctor via JRuby to process AsciiDoc source files within the project.
http://asciidoctor.org
Apache License 2.0
318 stars 122 forks source link

load error: jruby/java/java_ext/java.lang -- java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible #517

Closed advancedwebdeveloper closed 3 years ago

advancedwebdeveloper commented 3 years ago

I was trying to build Apache NiFi of version

$ git log -1 commit 3508b5b12f0c29c74d6902c1d6f851f990a21498 (HEAD -> main, origin/main, origin/HEAD) Author: Karthick Narendran karthick.narendran@gmail.com Date: Thu Mar 18 12:43:01 2021 +0000

NIFI-7850 Adds nifi.cluster.protocol.is.secure to Docker secure.sh

This closes #4896

Signed-off-by: Joey Frazee <jfrazee@apache.org>

and got such an error:

[INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 04:21 min (Wall Clock) [INFO] Finished at: 2021-03-21T22:55:45Z [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:1.5.2:process-asciidoc (output-html) on project nifi-docs: Execution output-html of goal org.asciidoctor:asciidoctor-maven-plugin:1.5.2:process-asciidoc failed: (LoadError) load error: jruby/java/java_ext/java.lang -- java.lang.reflect.InaccessibleObjectException: Unable to make protected java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException >accessible: module java.base does not "opens java.lang" to unnamed module @fd2fdd38

I was building using

$ mvn -version Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f) Maven home: /home/oceanfish81/apache-maven-3.6.3 Java version: 16-ea, vendor: AdoptOpenJDK, runtime: /usr/lib/jvm/adoptopenjdk-16-openj9-arm64 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.4.0-40-generic", arch: "aarch64", family: "unix"

with

$ java -version openjdk version "16-ea" 2021-03-16 OpenJDK Runtime Environment AdoptOpenJDK (build 16-ea+36) Eclipse OpenJ9 VM AdoptOpenJDK (build openj9-0.25.0, JRE 16 Linux aarch64-64-Bit Compressed References 20210311_79 (JIT enabled, AOT enabled) OpenJ9 - 022d65424 OMR - 09514431e JCL - 0c11227a21 based on jdk-16+36)

$ javac -version ajavac 16-ea

on

$ uname -a Linux ams1-c2-large-arm-01 5.4.0-40-generic #44-Ubuntu SMP Mon Jun 22 23:59:48 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

.

CC @tspannhw @smlambert

abelsromero commented 3 years ago

I suspect may be related with the changes in Java16, need to investigate more.

advancedwebdeveloper commented 3 years ago

OK, let me know if you would require more investigations on an Aarch64 server.

I might configure a specific server as a workload node, for the CI. Also something like https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners , on Aarch64, could be possible.

abelsromero commented 3 years ago

Good new, is easy to fix as far as I could see. Note I focused on the docs project, any other issue is out of my scope. I could reproduce the same issue (see below) and build the docs project with mvn -am -pl nifi-docs clean package.

Just add the latest jruby to the plugin runtime as in this example.

            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>1.5.2</version>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <sourceDirectory>${project.build.directory}/asciidoc</sourceDirectory>
                    <backend>html5</backend>
                    <attributes>
                        <imagesdir>./images</imagesdir>
                        <icons>font</icons>
                        <toc>true</toc>
                        <toclevels>3</toclevels>
                        <docVersion>${project.version}</docVersion>
                        <sectanchors>true</sectanchors>
                        <idprefix />
                        <idseparator>-</idseparator>
                        <docinfo1>true</docinfo1>
                        <stylesheet>asciidoc-mod.css</stylesheet>
                    </attributes>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.jruby</groupId>
                        <artifactId>jruby-complete</artifactId>
                        <version>${jruby.version}</version>
                    </dependency>
                </dependencies>
            </plugin>

On another note, I saw few things that could be improved:

My environment and error:

/temp/nifi >>> mvn -v
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/asalgadr/.sdkman/candidates/maven/current
Java version: 16, vendor: AdoptOpenJDK, runtime: /home/asalgadr/.sdkman/candidates/java/16.0.0.hs-adpt
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "5.11.6-1-manjaro", arch: "amd64", family: "unix"
[ERROR] Failed to execute goal org.asciidoctor:asciidoctor-maven-plugin:1.5.2:process-asciidoc (output-html) on project nifi-docs: Execution output-html of goal org.asciidoctor:asciidoctor-maven-plugin:1.5.2:process-asciidoc failed: (LoadError) load error: jruby/java/java_ext/java.lang -- java.lang.reflect.InaccessibleObjectException: Unable to make protected native java.lang.Object java.lang.Object.clone() throws java.lang.CloneNotSupportedException accessible: module java.base does not "opens java.lang" to unnamed module @3c5044fa -> [Help 1]
abelsromero commented 3 years ago

I am closing this, if you encounter any related issue feel free to re-open.

If you need assistance upgrading Apache NiFi asciidoctor settings, please do not hesitate to "at" me from the repo. I'll be happy to help.