Sbt 在尝试 运行 时在通用包装器错误中没有给出匹配的架构

Sbt giving no matching architecture in universal wrapper error when trying to run it

该项目正在编译,但每当我尝试 运行 它时,都会出现以下错误:

[error] java.lang.UnsatisfiedLinkError: /Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp: dlopen(/Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp, 1): no suitable image found.  Did find:
[error]     /Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp: no matching architecture in universal wrapper
[error]     /Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp: no matching architecture in universal wrapper
[error]     at java.base/jdk.internal.loader.NativeLibraries.load(Native Method)
[error]     at java.base/jdk.internal.loader.NativeLibraries$NativeLibraryImpl.open(NativeLibraries.java:383)
[error]     at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:227)
[error]     at java.base/jdk.internal.loader.NativeLibraries.loadLibrary(NativeLibraries.java:169)
[error]     at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2383)
[error]     at java.base/java.lang.Runtime.load0(Runtime.java:746)
[error]     at java.base/java.lang.System.load(System.java:1857)
[error]     at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
[error]     at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
[error]     at com.sun.jna.Native.<clinit>(Native.java:195)
[error]     at io.methvin.watchservice.jna.CarbonAPI.<clinit>(CarbonAPI.java:20)
[error]     at io.methvin.watchservice.jna.CFStringRef.toCFString(CFStringRef.java:23)
[error]     at io.methvin.watchservice.MacOSXListeningWatchService.register(MacOSXListeningWatchService.java:128)
[error]     at io.methvin.watchservice.WatchablePath.register(WatchablePath.java:50)
[error]     at io.methvin.watcher.DirectoryWatcher.register(DirectoryWatcher.java:341)
[error]     at io.methvin.watcher.DirectoryWatcher.registerAll(DirectoryWatcher.java:315)
[error]     at io.methvin.watcher.DirectoryWatcher.<init>(DirectoryWatcher.java:176)
[error]     at io.methvin.watcher.DirectoryWatcher$Builder.build(DirectoryWatcher.java:117)
[error]     at play.dev.filewatch.DefaultFileWatchService.watch(DefaultFileWatchService.scala:38)
[error]     at play.dev.filewatch.FileWatchService$$anon.watch(FileWatchService.scala:87)
[error]     at play.runsupport.Reloader.<init>(Reloader.scala:443)
[error]     at play.runsupport.Reloader$.reloader$lzycompute(Reloader.scala:283)
[error]     at play.runsupport.Reloader$.play$runsupport$Reloader$$reloader(Reloader.scala:275)
[error]     at play.runsupport.Reloader$.startDevMode(Reloader.scala:306)
[error]     at play.sbt.run.PlayRun$.devModeServer$lzycompute(PlayRun.scala:98)
[error]     at play.sbt.run.PlayRun$.devModeServer(PlayRun.scala:81)
[error]     at play.sbt.run.PlayRun$.$anonfun$playRunTask(PlayRun.scala:105)
[error]     at play.sbt.run.PlayRun$.$anonfun$playRunTask$adapted(PlayRun.scala:67)
[error]     at scala.Function1.$anonfun$compose(Function1.scala:49)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) java.lang.UnsatisfiedLinkError: /Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp: dlopen(/Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp, 1): no suitable image found.  Did find:
[error]     /Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp: no matching architecture in universal wrapper
[error]     /Users/archit/Library/Caches/JNA/temp/jna5239527790698670766.tmp: no matching architecture in universal wrapper

我不知道该怎么办。 我正在使用 sbt 1.3.13 版本。我也尝试过升级和降级它。

下面添加了 Build.sbt 的代码供您参考:

name := """cm-play"""
organization := "archit"

version := "1.0-SNAPSHOT"

lazy val root = (project in file(".")).enablePlugins(PlayScala)

scalaVersion := "2.13.3"

libraryDependencies ++= Seq(
  filters,
  jdbc,
  cacheApi,
  ws,
  guice,
  "mysql" % "mysql-connector-java" % "8.0.17",
  "com.typesafe.play" %% "play-slick" % "5.0.0",
  "com.typesafe.slick" %% "slick" % "3.3.2",
  "com.github.tototoshi" %% "slick-joda-mapper" % "2.4.2",
  "joda-time" % "joda-time" % "2.7",
  "org.joda" % "joda-convert" % "1.7",
  "com.github.nscala-time" %% "nscala-time" % "2.24.0",
  "com.github.mumoshu" %% "play2-memcached-play28" % "0.11.0",
  "org.playframework.anorm" %% "anorm" % "2.6.7",
  "com.enragedginger" %% "akka-quartz-scheduler" % "1.8.5-akka-2.6.x",
  "org.scalatestplus.play" %% "scalatestplus-play" % "5.0.0" % Test
)

// Adds additional packages into Twirl
//TwirlKeys.templateImports += "in.netpharm.controllers._"

// Adds additional packages into conf/routes
// play.sbt.routes.RoutesKeys.routesImport += "in.netpharm.binders._"

我一直在寻找这个问题并尝试了不同的解决方案,但没有任何效果。

将以下行添加到 build.sbt,以强制文件观察器服务的不同实现,对我有用:

PlayKeys.fileWatchService := play.dev.filewatch.FileWatchService.jdk7(play.sbt.run.toLoggerProxy(sLog.value))

从以下位置获得此解决方案:https://discuss.lightbend.com/t/apple-silicon-m1-playframework-broken-on-apple-silicon/7924