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

"java.lang.ExceptionInInitializerError ... java.lang.ArrayIndexOutOfBoundsException: 1 at org.codehaus.plexus.archiver.zip.AbstractZipArchiver" when using Java 9 #163

Closed
kamilgregorczyk opened this Issue Apr 4, 2018 · 9 comments

Comments

Projects
None yet
3 participants
@kamilgregorczyk
Copy link

kamilgregorczyk commented Apr 4, 2018

Hi everyone, I'm using spring boot 2.0 with java 9. I wanted to use this plugin but without any luck so far. When I'm calling: mvn dockerfile:build I get nulls (java.lang.ExceptionInInitializerError: null)

Here's my full error: https://pastebin.com/BZwmHMrB
Full error with debug flag (-e -X): https://pastebin.com/rvyiEz1h

Here's my POM file

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.posts</groupId>
    <artifactId>posts</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>posts</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.0.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>9</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb-reactive</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.20</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>io.projectreactor</groupId>
            <artifactId>reactor-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>com.spotify</groupId>
                <artifactId>dockerfile-maven-plugin</artifactId>
                <version>1.4.0</version>
                <executions>
                    <execution>
                        <id>default</id>
                        <goals>
                            <goal>build</goal>
                            <goal>push</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <repository>uniqe15/posts</repository>
                    <tag>${project.version}</tag>
                    <buildArgs>
                        <JAR_FILE>${project.build.finalName}.jar</JAR_FILE>
                    </buildArgs>
                </configuration>
            </plugin>

        </plugins>
    </build>


</project>

Here's my mvn -v

Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T20:49:05+01:00)
Maven home: /usr/local/Cellar/maven/3.5.3/libexec
Java version: 9, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
Default locale: pl_PL, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.3", arch: "x86_64", family: "Mac"
@mattnworb

This comment has been minimized.

Copy link
Member

mattnworb commented Apr 4, 2018

Thanks for the report. In the future, please post the exception messages / output in the issue itself, as anyone searching for similar issues on Github in the future won't be able to find anything behind a pastebin link.

This seems to be the relevant part of the stacktrace:

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
    at org.codehaus.plexus.archiver.zip.AbstractZipArchiver.<clinit> (AbstractZipArchiver.java:116)
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method)
    at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance (NativeConstructorAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance (DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance (Constructor.java:488)

From searching for that class and exception, I found mojohaus/nbm-maven-plugin#24 which pointed me towards https://cwiki.apache.org/confluence/display/MAVEN/Java+9+-+Jigsaw - it seems like a fair number of core Maven plugins are not yet ready for Java 9, or require updates to the version that this library pulls in in order to be compatible.

@mattnworb mattnworb changed the title java.lang.ExceptionInInitializerError "java.lang.ExceptionInInitializerError ... java.lang.ArrayIndexOutOfBoundsException: 1 at org.codehaus.plexus.archiver.zip.AbstractZipArchiver" when using Java 9 Apr 4, 2018

@mattnworb

This comment has been minimized.

Copy link
Member

mattnworb commented Apr 4, 2018

in particular some of these dependencies might need updating to Java 9 compatible versions: https://github.com/spotify/dockerfile-maven/blob/v1.4.0/plugin/pom.xml#L54-L82

@kamilgregorczyk

This comment has been minimized.

Copy link
Author

kamilgregorczyk commented Apr 4, 2018

Thanks for your response, I assume no quick fix is possible?

@mattnworb

This comment has been minimized.

Copy link
Member

mattnworb commented Apr 4, 2018

I haven't looked into it yet besides the comments above. We aren't using Java 9 ourselves much yet, so might not have an opportunity to figure it out right away - would definitely welcome any PRs or more investigation here. I'd start with trying to find the latest versions of the mentioned dependencies.

@Laures

This comment has been minimized.

Copy link

Laures commented Apr 9, 2018

i had the same stacktrace, following the advice from another issue fixed everything for me
#77

tl;dr: add the following to your plugin configuration

                <dependencies>
                    <dependency>
                        <groupId>org.codehaus.plexus</groupId>
                        <artifactId>plexus-archiver</artifactId>
                        <version>3.4</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.activation</groupId>
                        <artifactId>javax.activation-api</artifactId>
                        <version>1.2.0</version>
                    </dependency>
                </dependencies>
@stale

This comment has been minimized.

Copy link

stale bot commented Sep 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 24, 2018

@mattnworb

This comment has been minimized.

Copy link
Member

mattnworb commented Oct 1, 2018

this isn't stale; the comment in #163 (comment) should fix it, someone just needs to make a PR

@stale stale bot removed the stale label Oct 1, 2018

@mattnworb mattnworb added the pinned label Oct 1, 2018

@mattnworb

This comment has been minimized.

Copy link
Member

mattnworb commented Oct 3, 2018

docker-client also needs to be updated to work with Java 9+, see spotify/docker-client#1068

@mattnworb

This comment has been minimized.

Copy link
Member

mattnworb commented Oct 5, 2018

Did not realize this was already reported in #77, but this can be closed now too: see #77 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment