Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dependency on sun.misc.SignalHandler causing NoClassDefFoundError #9240

@monktastic

Description

@monktastic

I notice that ZIO uses the deprecated sun.misc.SignalHandler:

  final def addSignalHandler(signal: String, action: () => Unit)(implicit unsafe: zio.Unsafe): Unit = {
    import sun.misc.Signal
    import sun.misc.SignalHandler

I'm building a plugin (written in ZIO) that conforms to the Smithy plugin SPI, but when it's loaded by a Java 17 JVM and executed, it crashes:

Projection api-gw-transformer failed: java.lang.NoClassDefFoundError: sun/misc/SignalHandler
java.lang.NoClassDefFoundError: sun/misc/SignalHandler
	at zio.VersionSpecific.$init$(VersionSpecific.scala:78)
	at zio.package$.<clinit>(package.scala:24)
	at zio.ZLogger$.<clinit>(ZLogger.scala:108)
	at zio.RuntimePlatformSpecific.$init$(RuntimePlatformSpecific.scala:35)
	at zio.Runtime$.<clinit>(Runtime.scala:213)

The stack trace doesn't match, but I'm pretty sure the above code in PlatformSpecific is the problem.

All my plugin code does for now is:

    zio.Unsafe.unsafe { implicit u =>
      zio.Runtime.default.unsafe.run(ZIO.log("Test")).getOrThrowFiberFailure()
    }

I've even tried building with nearly the exact same version of Java (Corretto-17.0.12, whereas Smithy uses Corretto-17.0.12.7.1).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions