Skip to content

java.lang.IllegalAccessError: failed to access class com.linecorp.armeria.server.AbstractContextPathServicesBuilder #21797

Closed
@chungonn

Description

@chungonn

Compiler version

Scala version 3.3.3 and 3.5.1

Minimized code

The code below runs in Java. But in Scala, it throws an IllegalAccessError exception.

package experiment

import com.linecorp.armeria.common.HttpResponse
import com.linecorp.armeria.server.Server

@main def hello(): Unit =
  val server = Server.builder()
    .contextPath("/v1")
    .service("/", (ctx, req) => HttpResponse.of("Hello, world"))
    .and()
    .build()
    .start()

  println(s"server started = ${server}")

build.sbt

val scala3Version = "3.5.1"

lazy val root = project
  .in(file("."))
  .settings(
    name := "test-armeria",
    version := "0.1.0-SNAPSHOT",

    scalaVersion := scala3Version,

    libraryDependencies ++= Seq(
      "com.linecorp.armeria" % "armeria" % "1.30.1",
    )
  )

Output

Exception in thread "main" java.lang.IllegalAccessError: failed to access class com.linecorp.armeria.server.AbstractContextPathServicesBuilder from class experiment.Main$package$ (com.linecorp.armeria.server.AbstractContextPathServicesBuilder and experiment.Main$package$ are in unnamed module of loader 'app')
	at experiment.Main$package$.hello(Main.scala:9)
	at experiment.hello.main(Main.scala:6)

Expectation

The code should run without error.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions