Java + Maven for org.eclipse.jetty Error: failed to access class org.eclipse.jetty.util.ArrayTernaryTrie

Viewed 285

I'm attempting to add the following jetty dependencies to an existing Java project:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-alpn-server</artifactId>
    <version>11.0.8</version>
</dependency>
    <dependency>
        <groupId>org.eclipse.jetty</groupId>
        <artifactId>jetty-alpn-conscrypt-server</artifactId>
        <version>11.0.8</version>
    </dependency>
<dependency>
    <groupId>org.eclipse.jetty.http2</groupId>
    <artifactId>http2-server</artifactId>
    <version>11.0.8</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-server</artifactId>
    <version>11.0.8</version>
</dependency>
<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-util</artifactId>
    <version>11.0.8</version>
</dependency>

and getting the following error on running the project (mvn spring-boot:run):

Caused by: java.lang.IllegalAccessError: failed to access class org.eclipse.jetty.util.ArrayTernaryTrie from 
class org.eclipse.jetty.http.PathMap (org.eclipse.jetty.util.ArrayTernaryTrie and org.eclipse.jetty.http.PathMap are in unnamed module of loader 'app')

        at org.eclipse.jetty.http.PathMap.<init>(PathMap.java:96)
        at org.eclipse.jetty.http.PathMap.<init>(PathMap.java:117)
        at org.eclipse.jetty.http.PathMap.<init>(PathMap.java:107)
        at org.eclipse.jetty.security.ConstraintSecurityHandler.<init>(ConstraintSecurityHandler.java:68)
        ... 25 more

I did mvn dependency tree on it and not seeing any overlapping libraries. Again, I see this error on attempt to run the project (mvn spring-boot:run), it builds fine. I've tried the 11.0.9 versions as well, but still getting this error. It appears to be related to jetty-util package, but without it I get this error:

java.lang.ClassNotFoundException: org.eclipse.jetty.util.Index$Builder

I'm hoping someone knows what this is about.

1 Answers

Try adding the jetty-security dependency

Related