Cannot get past "paranamer" error with JlinkPlugin in sbt-native-packager - scala

We're trying to include a minimal JDK as part of a Windows installer for a Play 2.8.8 application, using the version of sbt-native-packager included with Play.
Alas, when packaging the application, we get the following error.
[error] Exception in thread "main" java.lang.module.FindException: Module paranamer not found, required by com.fasterxml.jackson.module.paranamer
[error] at java.base/java.lang.module.Resolver.findFail(Resolver.java:877)
[error] at java.base/java.lang.module.Resolver.resolve(Resolver.java:191)
[error] at java.base/java.lang.module.Resolver.resolve(Resolver.java:140)
[error] at java.base/java.lang.module.Configuration.resolve(Configuration.java:422)
[error] at java.base/java.lang.module.Configuration.resolve(Configuration.java:256)
[error] at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:564)
[error] at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:603)
[error] at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:557)
[error] at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:533)
[error] at jdk.jdeps/com.sun.tools.jdeps.Main.run(Main.java:64)
[error] at jdk.jdeps/com.sun.tools.jdeps.Main$JDepsToolProvider.run(Main.java:73)
[error] at java.base/java.util.spi.ToolProvider.run(ToolProvider.java:137)
[error] at ru.eldis.toollauncher.ToolLauncher.runTool(ToolLauncher.java:68)
[error] at ru.eldis.toollauncher.ToolLauncher.lambda$main$1(ToolLauncher.java:33)
[error] at ru.eldis.toollauncher.ToolLauncher.main(ToolLauncher.java:48)
[error] java.lang.RuntimeException: Nonzero exit value: 1
[error] at scala.sys.package$.error(package.scala:30)
[error] at com.typesafe.sbt.packager.archetypes.jlink.JlinkPlugin$.runForOutput(JlinkPlugin.scala:212)
[error] at com.typesafe.sbt.packager.archetypes.jlink.JlinkPlugin$.$anonfun$runJavaTool$2(JlinkPlugin.scala:197
[error] at sbt.io.IO$.withTemporaryFile(IO.scala:534)
[error] at sbt.io.IO$.withTemporaryFile(IO.scala:544)
[error] at com.typesafe.sbt.packager.archetypes.jlink.JlinkPlugin$.runJavaTool(JlinkPlugin.scala:191)
[error] at com.typesafe.sbt.packager.archetypes.jlink.JlinkPlugin$.$anonfun$projectSettings$11(JlinkPlugin.scala:53)
[error] at com.typesafe.sbt.packager.archetypes.jlink.JlinkPlugin$.$anonfun$projectSettings$9(JlinkPlugin.scala:74)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62)
[error] at sbt.std.Transform$$anon$4.work(Transform.scala:68)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:282)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
[error] at sbt.Execute.work(Execute.scala:291)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:282)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:64)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
[error] at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
[error] at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
[error] at java.base/java.lang.Thread.run(Thread.java:829)
[error] (jlinkModules) Nonzero exit value: 1
[error] Total time: 1 s, completed Sep 23, 2021, 11:57:58 AM
This error is a known problem with the JlinkPlugin, but we have already applied the recommended "fix" (the definition of the jlinkModulePath setting—see below) and it doesn't appear to resolve the problem. Running show jlinkModulePath within SBT results in the following:
[info] * C:\Users\Me\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thoughtworks\paranamer\paranamer\2.8\paranamer-2.8.jar
so that looks OK.
Any suggestions?
Here's the relevant portions of our build.sbt file:
// Enable the Windows installer plugin.
//
// Note: This plugin requires that WiX Toolkit be installed to create the Windows installation
// script.
enablePlugins(WindowsPlugin)
// Enable the Java JLink plugin.
//
// This adds a Java installation to the web-application's installer file.
enablePlugins(JlinkPlugin)
// Package installation settings for Windows.
maintainer := "Me <me#emycompany.com>"
Windows / name := "MyProduct-" + version.value
Windows / packageSummary := "My web app"
Windows / packageDescription := """Windows installer for the My Web-Application."""
// WiX Toolkit product and upgrade GUIDs.
//
// DO NOT CHANGE THESE VALUES!
//
// NOTE: These are not the actual values. Doh!
wixProductId := "someproductguid"
wixProductUpgradeId := "someproductupgradeguid"
// Configure the Windows BAT file's JVM configuration file location.
batScriptConfigLocation := Some("%APP_HOME%\\conf\\jvmopts-bat")
// Configure JLink so that it knows where to find the "paranamer" module (that is not a typo: it really is "paranamer",
// not "parameter").
jlinkModulePath := {
// Get the full classpath with all the resolved dependencies.
fullClasspath.in(jlinkBuildImage).value
// Find the ones that have `paranamer` as their names.
.filter { item =>
item.get(moduleID.key).exists { modId =>
modId.name == "paranamer"
}
}
// Get raw `File` objects.
.map(_.data)
}
// Make jLink output a little smaller, by removing elements we do not require.
jlinkOptions ++= Seq(
"--no-header-files",
"--no-man-pages",
"--compress=2"
)

Related

com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING

when i try to sbt build :
sbt run -Dhttps.port=9443 -Dhttp.port=disabled -Dhttps.keyStore.type="JKS" -Dhttps.keyStore.password="password" -Dhttps.keyStore.path=/cert/https-example.jks
it shows error :
--- (Running the application, auto-reloading is enabled) ---
[error] p.c.s.AkkaHttpServer - Cannot load SSL context
java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
at play.core.server.AkkaHttpServer.sslContext$lzycompute(AkkaHttpServer.scala:245)
at play.core.server.AkkaHttpServer.sslContext(AkkaHttpServer.scala:244)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding$1(AkkaHttpServer.scala:260)
at play.core.server.AkkaHttpServer.$anonfun$httpsServerBinding$1$adapted(AkkaHttpServer.scala:255)
Caused by: com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:164)
at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:251)
at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:37)
at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:30)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[info] p.c.s.AkkaHttpServer - Listening for HTTPS on /0:0:0:0:0:0:0:0:9443
[error] com.typesafe.config.ConfigException$WrongType: system properties: path has type OBJECT rather than STRING
[error] at com.typesafe.config.impl.SimpleConfig.findKeyOrNull(SimpleConfig.java:164)
[error] at com.typesafe.config.impl.SimpleConfig.findOrNull(SimpleConfig.java:175)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:189)
[error] at com.typesafe.config.impl.SimpleConfig.find(SimpleConfig.java:194)
[error] at com.typesafe.config.impl.SimpleConfig.getString(SimpleConfig.java:251)
[error] at play.core.server.ssl.DefaultSSLEngineProvider.createSSLContext(DefaultSSLEngineProvider.scala:37)
[error] at play.core.server.ssl.DefaultSSLEngineProvider.<init>(DefaultSSLEngineProvider.scala:30)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[error] at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
[error] at play.core.server.ssl.ServerSSLEngine$.createScalaSSLEngineProvider(ServerSSLEngine.scala:116)
[error] at play.core.server.ssl.ServerSSLEngine$.createSSLEngineProvider(ServerSSLEngine.scala:39)
[error] at play.core.server.AkkaHttpServer.sslContext$lzycompute(AkkaHttpServer.scala:245)
[error] at play.core.server.AkkaHttpServer.sslContext(AkkaHttpServer.scala:244)
[error] at play.core.server.AkkaHttpServer.$anonfun$Http1Encrypted$2(AkkaHttpServer.scala:530)
[error] at scala.Option.map(Option.scala:242)
[error] at play.core.server.AkkaHttpServer.Http1Encrypted$lzycompute(AkkaHttpServer.scala:522)
[error] at play.core.server.AkkaHttpServer.Http1Encrypted(AkkaHttpServer.scala:520)
[error] at play.core.server.AkkaHttpServer.<init>(AkkaHttpServer.scala:564)
[error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:665)
[error] at play.core.server.AkkaHttpServerProvider.createServer(AkkaHttpServer.scala:663)
[error] at play.core.server.DevServerStart$.$anonfun$mainDev$1(DevServerStart.scala:311)
[error] at play.utils.Threads$.withContextClassLoader(Threads.scala:22)
[error] at play.core.server.DevServerStart$.mainDev(DevServerStart.scala:76)
[error] at play.core.server.DevServerStart$.mainDevOnlyHttpsMode(DevServerStart.scala:40)
[error] at play.core.server.DevServerStart.mainDevOnlyHttpsMode(DevServerStart.scala)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error] at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error] at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error] at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[error] at play.runsupport.Reloader$.startDevMode(Reloader.scala:311)
[error] at play.sbt.run.PlayRun$.devModeServer$lzycompute$1(PlayRun.scala:100)
[error] at play.sbt.run.PlayRun$.devModeServer$1(PlayRun.scala:83)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask$3(PlayRun.scala:107)
[error] at play.sbt.run.PlayRun$.$anonfun$playRunTask$3$adapted(PlayRun.scala:67)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) java.lang.reflect.InvocationTargetException
[error] Total time: 5 s, completed 06-Apr-2022, 10:10:14 PM
[info] p.c.s.AkkaHttpServer - Stopping Akka HTTP server...
[info] p.c.s.AkkaHttpServer - Terminating server binding for /0:0:0:0:0:0:0:0:9443
[info] p.c.s.AkkaHttpServer - Running provided shutdown stop hooks
I tried what i know but i can't find the correct answer. if you know anything about it please help me..!. why it doesn't take the path? is I did anything wrong?
I've finally found the correct way to do this, i don't know why application.conf not working but adding the data in build.sbt helped me to solve this error.
PlayKeys.devSettings += "play.server.https.port" -> "9443"
PlayKeys.devSettings += "play.server.http.port" -> "disabled"
PlayKeys.devSettings += "play.server.https.keyStore.type" -> "JKS"
PlayKeys.devSettings += "play.server.https.keyStore.password" -> "password"
PlayKeys.devSettings += "play.server.https.keyStore.path" -> "https-example.jks"
The data added build.sbt so there is no need to add data in sbt run

SBT publish is not uploading jar file to artifactory (publish) java.io.IOException: PUT operation to URL failed with status code 400: Bad Request

I've below build.sbt file
name := "tads-akka-cluster-events"
organization := "technorati"
version := "0.0.3"
scalaVersion := "2.11.12"
crossScalaVersions := Seq("2.12.9", "2.13.0")
publishMavenStyle := true
PB.targets in Compile := Seq(
scalapb.gen() -> (sourceManaged in Compile).value
)
libraryDependencies += "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
credentials += Credentials("Artifactory Realm", "artifactory.svcs.opal.synacor.com", "admin", "password")
publishTo := {
val nexus = "http://artifactory.svcs.opal.synacor.com/"
if (isSnapshot.value)
Some("repository.synacor.com-snapshots" at nexus + "artifactory/synacor-local")
else
Some("repository.synacor.com-releases" at nexus + "artifactory/synacor-local")
}
When I did sbt publish, I get below error -
sbt:tads-akka-cluster-events> publish
[info] Packaging /Users/rajkumar.natarajan/Documents/Coding/misc/tads-akka-cluster-events/target/scala-2.11/tads-akka-cluster-events_2.11-0.0.3-sources.jar ...
[info] Done packaging.
[info] Wrote /Users/rajkumar.natarajan/Documents/Coding/misc/tads-akka-cluster-events/target/scala-2.11/tads-akka-cluster-events_2.11-0.0.3.pom
[info] Updating ...
[info] Done updating.
[info] Packaging /Users/rajkumar.natarajan/Documents/Coding/misc/tads-akka-cluster-events/target/scala-2.11/tads-akka-cluster-events_2.11-0.0.3.jar ...
[info] Packaging /Users/rajkumar.natarajan/Documents/Coding/misc/tads-akka-cluster-events/target/scala-2.11/tads-akka-cluster-events_2.11-0.0.3-javadoc.jar ...
[info] Done packaging.
[info] Done packaging.
[info] published tads-akka-cluster-events_2.11 to http://artifactory.svcs.opal.synacor.com/artifactory/synacor-local/technorati/tads-akka-cluster-events_2.11/0.0.3/tads-akka-cluster-events_2.11-0.0.3.pom
[error] java.io.IOException: PUT operation to URL http://artifactory.svcs.opal.synacor.com/artifactory/synacor-local/technorati/tads-akka-cluster-events_2.11/0.0.3/tads-akka-cluster-events_2.11-0.0.3.jar failed with status code 400: Bad Request
[error] at org.apache.ivy.util.url.AbstractURLHandler.validatePutStatusCode(AbstractURLHandler.java:82)
[error] at sbt.internal.librarymanagement.ivyint.GigahorseUrlHandler.upload(GigahorseUrlHandler.scala:191)
[error] at org.apache.ivy.util.url.URLHandlerDispatcher.upload(URLHandlerDispatcher.java:82)
[error] at org.apache.ivy.util.FileUtil.copy(FileUtil.java:150)
[error] at org.apache.ivy.plugins.repository.url.URLRepository.put(URLRepository.java:84)
[error] at sbt.internal.librarymanagement.ConvertResolver$LocalIfFileRepo.put(ConvertResolver.scala:366)
[error] at org.apache.ivy.plugins.repository.AbstractRepository.put(AbstractRepository.java:130)
[error] at sbt.internal.librarymanagement.ConvertResolver$ChecksumFriendlyURLResolver.put(ConvertResolver.scala:118)
[error] at sbt.internal.librarymanagement.ConvertResolver$ChecksumFriendlyURLResolver.put$(ConvertResolver.scala:105)
[error] at sbt.internal.librarymanagement.ConvertResolver$$anonfun$defaultConvert$lzycompute$1$PluginCapableResolver$1.put(ConvertResolver.scala:165)
[error] at org.apache.ivy.plugins.resolver.RepositoryResolver.publish(RepositoryResolver.java:216)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5(IvyActions.scala:497)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$5$adapted(IvyActions.scala:496)
[error] at scala.collection.TraversableLike$WithFilter.$anonfun$foreach$1(TraversableLike.scala:788)
[error] at scala.collection.Iterator.foreach(Iterator.scala:937)
[error] at scala.collection.Iterator.foreach$(Iterator.scala:937)
[error] at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
[error] at scala.collection.IterableLike.foreach(IterableLike.scala:70)
[error] at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
[error] at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
[error] at scala.collection.TraversableLike$WithFilter.foreach(TraversableLike.scala:787)
[error] at sbt.internal.librarymanagement.IvyActions$.publish(IvyActions.scala:496)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$3(IvyActions.scala:144)
[error] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
[error] at sbt.internal.librarymanagement.IvyActions$.withChecksums(IvyActions.scala:157)
[error] at sbt.internal.librarymanagement.IvyActions$.withChecksums(IvyActions.scala:151)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$1(IvyActions.scala:144)
[error] at sbt.internal.librarymanagement.IvyActions$.$anonfun$publish$1$adapted(IvyActions.scala:134)
[error] at sbt.internal.librarymanagement.IvySbt$Module.$anonfun$withModule$1(Ivy.scala:239)
[error] at sbt.internal.librarymanagement.IvySbt.$anonfun$withIvy$1(Ivy.scala:204)
[error] at sbt.internal.librarymanagement.IvySbt.sbt$internal$librarymanagement$IvySbt$$action$1(Ivy.scala:70)
[error] at sbt.internal.librarymanagement.IvySbt$$anon$3.call(Ivy.scala:77)
[error] at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:95)
[error] at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:80)
[error] at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:99)
[error] at xsbt.boot.Using$.withResource(Using.scala:10)
[error] at xsbt.boot.Using$.apply(Using.scala:9)
[error] at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:60)
[error] at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:50)
[error] at xsbt.boot.Locks$.apply0(Locks.scala:31)
[error] at xsbt.boot.Locks$.apply(Locks.scala:28)
[error] at sbt.internal.librarymanagement.IvySbt.withDefaultLogger(Ivy.scala:77)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:199)
[error] at sbt.internal.librarymanagement.IvySbt.withIvy(Ivy.scala:196)
[error] at sbt.internal.librarymanagement.IvySbt$Module.withModule(Ivy.scala:238)
[error] at sbt.internal.librarymanagement.IvyActions$.publish(IvyActions.scala:134)
[error] at sbt.Classpaths$.$anonfun$publishTask$4(Defaults.scala:2416)
[error] at sbt.Classpaths$.$anonfun$publishTask$4$adapted(Defaults.scala:2416)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:40)
[error] at sbt.std.Transform$$anon$4.work(System.scala:67)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:269)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:278)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:269)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (publish) java.io.IOException: PUT operation to URL http://artifactory.svcs.opal.synacor.com/artifactory/synacor-local/technorati/tads-akka-cluster-events_2.11/0.0.3/tads-akka-cluster-events_2.11-0.0.3.jar failed with status code 400: Bad Request
[error] Total time: 2 s, completed Sep 3, 2019 4:12:46 PM
sbt:tads-akka-cluster-events>
When I checked the repository I see pom, pom.md5 and pom.sha1.
But it is missing jar, jar.md5 and jar.sha1.
Why I'm getting this error? What I'm missing and how can I fix this issue?
I've to add the setting updateOptions := updateOptions.value.withGigahorse(false) or run sbt like sbt -Dsbt.gigahorse=false clean publish.
For more details please see this github sbt issue.

What does mean the message `Failing because of negative scalastyle result`?

I was editing my Spark+Kafka application in Scala and when I tried to compile again I keep receiving the message Failing because of negative scalastyle result. When I change back my editions I still receive the same message.
What is this? How do I solve this error?
[success] created output: /home/felipe/workspace-scala-eclipse/scala-kafka-spark-demo/target
[error] java.lang.RuntimeException: Failing because of negative scalastyle result
[error] at scala.sys.package$.error(package.scala:27)
[error] at org.scalastyle.sbt.Tasks$.handleResult$1(Plugin.scala:132)
[error] at org.scalastyle.sbt.Tasks$.doScalastyleWithConfig$1(Plugin.scala:187)
[error] at org.scalastyle.sbt.Tasks$.doScalastyle(Plugin.scala:192)
[error] at org.scalastyle.sbt.ScalastylePlugin$.$anonfun$rawScalastyleSettings$3(Plugin.scala:81)
[error] at org.scalastyle.sbt.ScalastylePlugin$.$anonfun$rawScalastyleSettings$3$adapted(Plugin.scala:68)
[error] at scala.Function1.$anonfun$compose$1(Function1.scala:44)
[error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:42)
[error] at sbt.std.Transform$$anon$4.work(System.scala:64)
[error] at sbt.Execute.$anonfun$submit$2(Execute.scala:257)
[error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:16)
[error] at sbt.Execute.work(Execute.scala:266)
[error] at sbt.Execute.$anonfun$submit$1(Execute.scala:257)
[error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:167)
[error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:32)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
[error] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] at java.lang.Thread.run(Thread.java:748)
[error] (*:compileScalastyle) Failing because of negative scalastyle result
[error] Total time: 1 s, completed Jan 9, 2018 10:20:46 PM
You can usually find the cause of this error in a file called scalastyle-result.xml, there you can find all the warnings and the possible errors causing this issue
it was because my project has these configurations on the build.sbt
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
lazy val root = (project in file("."))
.settings(commonSettings)
.settings(scalacOptions ++= customScalacOptions)
.settings(libraryDependencies ++= customLibraryDependencies)
.settings(excludeDependencies ++= commonExcludeDependencies)
.settings(fork in run := true)
.settings(connectInput in run := true)
.settings(javaOptions in run ++= customJavaOptions)
.settings(
scalastyleFailOnError := true,
compileScalastyle := scalastyle.in(Compile).toTask("").value,
(compile in Compile) := ((compile in Compile) dependsOn compileScalastyle).value,
testScalastyle := scalastyle.in(Test).toTask("").value,
(test in Test) := ((test in Test) dependsOn testScalastyle).value)
I removed and the error is no longer stoping the compilation.

Geotools JAI fatjar causing problems in native dependencies

I have a scala project using geotools / JAI dependencies in order to process ESRi ASCII Grid files to WKT in java. When deploying a fat-jar, I get a SIGSEV in the native part of the jai code.
It is using the following dependencies:
lazy val geotools = "17.0"
libraryDependencies ++= Seq(
"org.geotools" % "gt-main" % geotools,
"org.geotools" % "gt-arcgrid" % geotools,
"org.geotools" % "gt-process-raster" % geotools)
When creating a fat jar like:
assemblyMergeStrategy in assembly := {
case PathList("META-INF", xs#_*) =>
xs match {
// Concatenate everything in the services directory to keep GeoTools happy.
case ("services" :: _ :: Nil) =>
MergeStrategy.concat
// Concatenate these to keep JAI happy.
case ("javax.media.jai.registryFile.jai" :: Nil) | ("registryFile.jai" :: Nil) | ("registryFile.jaiext" :: Nil) =>
MergeStrategy.concat
case (name :: Nil) => {
// Must exclude META-INF/*.([RD]SA|SF) to avoid "Invalid signature file digest for Manifest main attributes" exception.
if (name.endsWith(".RSA") || name.endsWith(".DSA") || name.endsWith(".SF")) {
MergeStrategy.discard
}
else {
MergeStrategy.deduplicate
}
}
case _ => MergeStrategy.deduplicate
}
case _ => MergeStrategy.deduplicate
}
One of JAIS JNI native C dependencies blows up with a SIGSEV. When instead simply using the (a lot unsafer MergeStrategy.first) like:
assemblyMergeStrategy in assembly := {
// TODO bad strategy, find out why below does not work.
case PathList("org", "datasyslab", xs#_*) => MergeStrategy.singleOrError
case PathList("com", "esotericsoftware", xs#_*) => MergeStrategy.last
case PathList("META-INF", "MANIFEST.MF") => MergeStrategy.discard
case _ => MergeStrategy.first
}
The code works without SIGSEV. When looking at the logs of MergeStrategy.SingleOrError, I cant figure out what is the dependency causing the problems in the native code:
[error] (*:assembly) deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-coverage/jars/gt-coverage-17.0.jar:META-INF/registryFile.jai
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-zonalstats/jars/jt-zonalstats-1.4.0.jar:META-INF/registryFile.jai
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-process-raster/jars/gt-process-raster-17.0.jar:META-INF/registryFile.jai
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-rangelookup/jars/jt-rangelookup-1.4.0.jar:META-INF/registryFile.jai
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-contour/jars/jt-contour-1.4.0.jar:META-INF/registryFile.jai
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-vectorize/jars/jt-vectorize-1.4.0.jar:META-INF/registryFile.jai
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.affine/jt-affine/jars/jt-affine-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.scale/jt-scale/jars/jt-scale-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.vectorbin/jt-vectorbin/jars/jt-vectorbin-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.translate/jt-translate/jars/jt-translate-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.algebra/jt-algebra/jars/jt-algebra-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.bandmerge/jt-bandmerge/jars/jt-bandmerge-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.bandselect/jt-bandselect/jars/jt-bandselect-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.bandcombine/jt-bandcombine/jars/jt-bandcombine-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.border/jt-border/jars/jt-border-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.buffer/jt-buffer/jars/jt-buffer-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.crop/jt-crop/jars/jt-crop-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.mosaic/jt-mosaic/jars/jt-mosaic-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.lookup/jt-lookup/jars/jt-lookup-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.nullop/jt-nullop/jars/jt-nullop-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.rescale/jt-rescale/jars/jt-rescale-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.stats/jt-stats/jars/jt-stats-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.warp/jt-warp/jars/jt-warp-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.zonal/jt-zonal/jars/jt-zonal-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.binarize/jt-binarize/jars/jt-binarize-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.format/jt-format/jars/jt-format-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.colorconvert/jt-colorconvert/jars/jt-colorconvert-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.errordiffusion/jt-errordiffusion/jars/jt-errordiffusion-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.orderdither/jt-orderdither/jars/jt-orderdither-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.colorindexer/jt-colorindexer/jars/jt-colorindexer-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.imagefunction/jt-imagefunction/jars/jt-imagefunction-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.piecewise/jt-piecewise/jars/jt-piecewise-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.classifier/jt-classifier/jars/jt-classifier-1.0.13.jar:META-INF/registryFile.jaiext
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.rlookup/jt-rlookup/jars/jt-rlookup-1.0.13.jar:META-INF/registryFile.jaiext
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/javax.media/jai_imageio/jars/jai_imageio-1.1.jar:META-INF/services/javax.imageio.spi.ImageInputStreamSpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.imageio-ext/imageio-ext-streams/jars/imageio-ext-streams-1.1.17.jar:META-INF/services/javax.imageio.spi.ImageInputStreamSpi
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/javax.media/jai_imageio/jars/jai_imageio-1.1.jar:META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.imageio-ext/imageio-ext-streams/jars/imageio-ext-streams-1.1.17.jar:META-INF/services/javax.imageio.spi.ImageOutputStreamSpi
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/javax.media/jai_imageio/jars/jai_imageio-1.1.jar:META-INF/services/javax.imageio.spi.ImageReaderSpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.imageio-ext/imageio-ext-tiff/jars/imageio-ext-tiff-1.1.17.jar:META-INF/services/javax.imageio.spi.ImageReaderSpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.imageio-ext/imageio-ext-arcgrid/jars/imageio-ext-arcgrid-1.1.17.jar:META-INF/services/javax.imageio.spi.ImageReaderSpi
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/javax.media/jai_imageio/jars/jai_imageio-1.1.jar:META-INF/services/javax.imageio.spi.ImageWriterSpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.imageio-ext/imageio-ext-tiff/jars/imageio-ext-tiff-1.1.17.jar:META-INF/services/javax.imageio.spi.ImageWriterSpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.imageio-ext/imageio-ext-arcgrid/jars/imageio-ext-arcgrid-1.1.17.jar:META-INF/services/javax.imageio.spi.ImageWriterSpi
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/javax.media/jai_imageio/jars/jai_imageio-1.1.jar:META-INF/services/javax.media.jai.OperationRegistrySpi
[error] /Users/geoheil/.ivy2/cache/it.geosolutions.jaiext.crop/jt-crop/jars/jt-crop-1.0.13.jar:META-INF/services/javax.media.jai.OperationRegistrySpi
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-zonalstats/jars/jt-zonalstats-1.4.0.jar:META-INF/services/javax.media.jai.OperationsRegistrySpi
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-process-raster/jars/gt-process-raster-17.0.jar:META-INF/services/javax.media.jai.OperationsRegistrySpi
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-rangelookup/jars/jt-rangelookup-1.4.0.jar:META-INF/services/javax.media.jai.OperationsRegistrySpi
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-contour/jars/jt-contour-1.4.0.jar:META-INF/services/javax.media.jai.OperationsRegistrySpi
[error] /Users/geoheil/.ivy2/cache/org.jaitools/jt-vectorize/jars/jt-vectorize-1.4.0.jar:META-INF/services/javax.media.jai.OperationsRegistrySpi
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-main/jars/gt-main-17.0.jar:META-INF/services/org.geotools.filter.FunctionFactory
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-process/jars/gt-process-17.0.jar:META-INF/services/org.geotools.filter.FunctionFactory
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-main/jars/gt-main-17.0.jar:META-INF/services/org.geotools.util.ConverterFactory
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-process-raster/jars/gt-process-raster-17.0.jar:META-INF/services/org.geotools.util.ConverterFactory
[error] deduplicate: different file contents found in the following:
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-main/jars/gt-main-17.0.jar:META-INF/services/org.opengis.filter.expression.Function
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-coverage/jars/gt-coverage-17.0.jar:META-INF/services/org.opengis.filter.expression.Function
[error] /Users/geoheil/.ivy2/cache/org.geotools/gt-cql/jars/gt-cql-17.0.jar:META-INF/services/org.opengis.filter.expression.Function
and here the sigsev information
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007fd780b9bfe1, pid=21657, tid=0x00007f0674c4a700
#
# JRE version: OpenJDK Runtime Environment (8.0_121-b13) (build 1.8.0_121-8u121-b13-0ubuntu1.16.04.2-b13)
# Java VM: OpenJDK 64-Bit Server VM (25.121-b13 mixed mode linux-amd64 )
# Problematic frame:
# V [libjvm.so+0x8a4fe1]
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /home/vagrant/development/projects/HybridAccess/spark/hs_err_pid21657.log
Compiled method (c1) 6599346 22508 ! 3 java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue::take (203 bytes)
total in heap [0x00007fd76bda5b90,0x00007fd76bda83a8] = 10264
relocation [0x00007fd76bda5cb8,0x00007fd76bda5eb8] = 512
main code [0x00007fd76bda5ec0,0x00007fd76bda7360] = 5280
stub code [0x00007fd76bda7360,0x00007fd76bda7508] = 424
metadata [0x00007fd76bda7508,0x00007fd76bda7560] = 88
scopes data [0x00007fd76bda7560,0x00007fd76bda7d80] = 2080
scopes pcs [0x00007fd76bda7d80,0x00007fd76bda8170] = 1008
dependencies [0x00007fd76bda8170,0x00007fd76bda8188] = 24
handler table [0x00007fd76bda8188,0x00007fd76bda8308] = 384
nul chk table [0x00007fd76bda8308,0x00007fd76bda83a8] = 160
And the links I have found for maven:
JAI dependencies in geotools are hard deploy as a single fat jar (http://docs.geotools.org/latest/userguide/faq.html#how-do-i-create-an-executable-jar-for-my-geotools-app, http://osgeo-org.1560.x6.nabble.com/Building-runnable-jar-file-td4320365.html).

Apache Spark Build error

I'm building Apache spark source code in ubuntu 14.04.4 (spark version: 1.6.0 with Scala code runner version 2.10.4) with command
sudo sbt/sbt assembly
and getting the following error,
[warn] def deleteRecursively(dir: TachyonFile, client: TachyonFS) {
[warn] ^
[error] [error] while compiling:
/home/ashish/spark-apps/spark-1.6.1/core/src/main/scala/org/apache/spark/util/random/package.scala
[error] during phase: jvm [error] library
version: version 2.10.5 [error] compiler version: version
2.10.5 [error] reconstructed args: -deprecation -Xplugin:/home/ashish/.ivy2/cache/org.spark-project/genjavadoc-plugin_2.10.5/jars/genjavadoc-plugin_2.10.5-0.9-spark0.jar
-feature -P:genjavadoc:out=/home/ashish/spark-apps/spark-1.6.1/core/target/java -classpath /home/ashish/spark-apps/spark-1.6.1/core/target/scala-2.10/classes:/home/ashish/spark-apps/spark-1.6.1/launcher/target/scala-2.10/classes:/home/ashish/spark-apps/spark-1.6.1/network/common/target/scala-2.10/classes:/home/ashish/spark-apps/spark-1.6.1/network/shuffle/target/scala-2.10/classes:/home/ashish/spark-apps/spark-1.6.1/unsafe/target/scala-2.10/classes:/home/ashish/.ivy2/cache/org.spark-project.spark/unused/jars/unused-1.0.0.jar:/home/ashish/.ivy2/cache/com.google.guava/guava/bundles/guava-14.0.1.jar:/home/ashish/.ivy2/cache/io.netty/netty-all/jars/netty-all-4.0.29.Final.jar:/home/ashish/.ivy2/cache/org.fusesource.leveldbjni/leveldbjni-all/bundles/leveldbjni-all-1.8.jar:/home/ashish/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.4.4.jar:/home/ashish/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.4.4.jar:/home/ashish/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-......and
many other jars...
[error] [error] last tree to typer:
Literal(Constant(collection.mutable.Map)) [error]
symbol: null [error] symbol definition: null [error]
tpe: Class(classOf[scala.collection.mutable.Map]) [error]
symbol owners: [error] context owners: package package ->
package random [error] [error] == Enclosing template or
block == [error] [error] Template( // val :
in package random,
tree.tpe=org.apache.spark.util.random.package.type [error]
"java.lang.Object" // parents [error] ValDef( [error]
private [error] "_" [error] [error]
[error] ) [error] DefDef( // def ():
org.apache.spark.util.random.package.type in package random
[error] [error] "" [error]
[] [error] List(Nil) [error] //
tree.tpe=org.apache.spark.util.random.package.type [error]
Block( // tree.tpe=Unit [error] Apply( // def ():
Object in class Object, tree.tpe=Object [error]
package.super."" // def (): Object in class Object,
tree.tpe=()Object [error] Nil [error] )
[error] () [error] ) [error] ) [error]
) [error] [error] == Expanded type of tree == [error]
[error] ConstantType(value = Constant(collection.mutable.Map))
[error] [error] uncaught exception during compilation:
java.io.IOException [error] File name too long [warn] 45
warnings found [error] two errors found [error]
(core/compile:compile) Compilation failed [error] Total time:
5598 s, completed 5 Apr, 2016 9:06:50 AM
Where I'm getting wrong?
You should build Spark with Maven...
download the source and run ./bin/mvn clean package
Probably similar to http://apache-spark-user-list.1001560.n3.nabble.com/spark-github-source-build-error-td10532.html
Try sudo sbt/sbt clean assembly