Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1. WIth Java version 11, change to 17 is fixed #1635

Open
Touutae-lab opened this issue Jan 22, 2024 · 21 comments

Comments

@Touutae-lab
Copy link

Got a question? Please see https://scalapb.github.io/docs/contact first.

If you have found a bug or have a feature request, please
search our open Github issues at https://github.com/scalapb/ScalaPB/issues

When posting a new issue, please describe what are you trying to do, what you expect it to do,
and what unexpected things happen. Provide as much detail as possible and
include all relevant code so it is possible for us to reproduce the issue.

I enbled debug mode for sbt and extract this error at run time can you please help investigate the issue

--jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1.
[error] java.lang.RuntimeException: protoc returned exit code: 1
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at sbtprotoc.ProtocPlugin$.compile(ProtocPlugin.scala:464)
[error]         at sbtprotoc.ProtocPlugin$.compileProto$1(ProtocPlugin.scala:674)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$17(ProtocPlugin.scala:697)
[error]         at sbt.util.Difference.apply(Tracked.scala:415)
[error]         at sbt.util.Difference.apply(Tracked.scala:395)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$16(ProtocPlugin.scala:686)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$16$adapted(ProtocPlugin.scala:682)
[error]         at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:220)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$1(ProtocPlugin.scala:710)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[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] (Compile / protocGenerate) protoc returned exit code: 1
[error] Total time: 2 s, completed Jan 22, 2024, 10:20:15 AM
@Touutae-lab
Copy link
Author

Touutae-lab commented Jan 22, 2024

syntax = "proto3";


/*
 * Ping Services Definition.
 * ////// Send a Ping /////
 * //     Ping         //
 * ///////////////////////
 */
/*
  *
 */
service Ping {
  rpc Ping (PingRequest) returns (PongReply) {}
}


message PingRequest {
  string message = 1;
}

message PongReply {
  string message = 1;
}

@Touutae-lab
Copy link
Author

ThisBuild / version := "0.1.0-SNAPSHOT"

ThisBuild / scalaVersion := "3.3.1"

lazy val root = (project in file("."))
  .settings(
    name := "protobuf"
  )

libraryDependencies ++= Seq(
  "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
)


enablePlugins(PekkoGrpcPlugin)


Compile / PB.targets := Seq(
  scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)

@Touutae-lab
Copy link
Author

Touutae-lab commented Jan 22, 2024

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.11"

@Touutae-lab
Copy link
Author

Touutae-lab commented Jan 22, 2024

addSbtPlugin("org.apache.pekko" % "pekko-grpc-sbt-plugin" % "1.0.2")

@thesamet
Copy link
Contributor

thesamet commented Jan 22, 2024 via email

@Touutae-lab
Copy link
Author

Touutae-lab commented Jan 22, 2024

sbt compile                        
[info] welcome to sbt 1.9.8 (Eclipse Adoptium Java 11.0.21)
[info] loading settings for project protobuf-build from plugin.sbt,protoc.sbt ...
[info] loading project definition from C:\Users\myuser.any\Project\protobuf\project
[info] loading settings for project root from build.sbt ...
[info] set current project to protobuf (in build file:/C:/Users/myuser.any/Project/protobuf/)
[info] Executing in batch mode. For better performance use sbt's shell
[info] Compiling 2 protobuf files to C:\Users\myuser.any\Project\protobuf\target\scala-3.3.1\src_managed\main\scalapb
The system cannot find the path specified.
--jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1.
[error] java.lang.RuntimeException: protoc returned exit code: 1
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at sbtprotoc.ProtocPlugin$.compile(ProtocPlugin.scala:464)
[error]         at sbtprotoc.ProtocPlugin$.compileProto$1(ProtocPlugin.scala:674)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$17(ProtocPlugin.scala:697)
[error]         at sbt.util.Difference.apply(Tracked.scala:415)
[error]         at sbt.util.Difference.apply(Tracked.scala:395)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$16(ProtocPlugin.scala:686)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$16$adapted(ProtocPlugin.scala:682)
[error]         at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:220)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$1(ProtocPlugin.scala:710)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[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] (Compile / protocGenerate) protoc returned exit code: 1
[error] Total time: 2 s, completed Jan 22, 2024, 11:10:42 AM

@Touutae-lab
Copy link
Author

@thesamet I have try comment out enablePlugin(PekkoGrpcPlugin) and correct the version of all dependency the issue still insist

@Touutae-lab
Copy link
Author

it return error in sub-command
image

@Touutae-lab
Copy link
Author

Touutae-lab commented Jan 22, 2024

Current scala library that used for cross build is scala 2.13.10, and my version for implementation is 3.3.1

@thesamet
Copy link
Contributor

  1. Can you try creating a fresh project using sbt new scalapb/scalapb-template.g8 ?
  2. Which version of Windows are you using? Anything system specific that could be causing this? In the past, we had a few cases where users had special characters in their project directory which caused issues.

@Touutae-lab
Copy link
Author

I can't even with template, currently run on Window 11, with Intelij Ultimate
image

@Touutae-lab
Copy link
Author

@thesamet I found the root cause, after i change java to java 17, it fixed, i don't know if java 11 lts has issue in concurrent package

@Touutae-lab
Copy link
Author

image

@Touutae-lab Touutae-lab changed the title --jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1. java.lang.RuntimeException: protoc returned exit code: 1 --jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1. WIth Java version 11, change to 17 is fixed Jan 22, 2024
@Touutae-lab
Copy link
Author

I hope this Bug report help anyone who are using SBT with java 11 JDK

@Catlickfish
Copy link

Catlickfish commented Feb 4, 2024

I encountered the same problem, and upgrading from Java 11 to Java 17 did not solve it. Any help is appreciated.
The OS is Windows 10, my build.sbt file:

scalaVersion := "2.12.11"

version := "1.0"

Compile / PB.targets := Seq(
  scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
)

// (optional) If you need scalapb/scalapb.proto or anything from
// google/protobuf/*.proto
libraryDependencies ++= Seq(
  "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion % "protobuf"
)

My scalapb.sbt file:

addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")

libraryDependencies += "com.thesamet.scalapb" %% "compilerplugin" % "0.11.11"

The console output:

PS C:\Users\Vetch\Desktop\Hello> sbt
[info] welcome to sbt 1.9.7 (Eclipse Adoptium Java 17.0.10)
[info] loading settings for project hello-build from scalapb.sbt ...
[info] loading project definition from C:\Users\Vetch\Desktop\Hello\project
[info] loading settings for project hello from build.sbt ...
[info] set current project to hello (in build file:/C:/Users/Vetch/Desktop/Hello/)
[info] sbt server started at local:sbt-server-0be5c496be180df267d0
[info] started sbt server

sbt:hello> last Compile / protocGenerate
[debug] Invalidating cache (input changed)
[info] Compiling 1 protobuf files to C:\Users\Vetch\Desktop\Hello\target\scala-2.12\src_managed\main\scalapb
[debug] protoc options:
[debug] Compiling schema C:\Users\Vetch\Desktop\Hello\src\main\protobuf\trading_order.proto
[error] java.lang.RuntimeException: protoc returned exit code: 1
[error]         at scala.sys.package$.error(package.scala:30)
[error]         at sbtprotoc.ProtocPlugin$.compile(ProtocPlugin.scala:464)
[error]         at sbtprotoc.ProtocPlugin$.compileProto$1(ProtocPlugin.scala:674)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$17(ProtocPlugin.scala:697)
[error]         at sbt.util.Difference.apply(Tracked.scala:415)
[error]         at sbt.util.Difference.apply(Tracked.scala:395)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$16(ProtocPlugin.scala:686)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$16$adapted(ProtocPlugin.scala:682)
[error]         at sbt.util.Tracked$.$anonfun$inputChangedW$1(Tracked.scala:220)
[error]         at sbtprotoc.ProtocPlugin$.$anonfun$sourceGeneratorTask$1(ProtocPlugin.scala:710)
[error]         at scala.Function1.$anonfun$compose$1(Function1.scala:49)
[error]         at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:63)
[error]         at sbt.std.Transform$$anon$4.work(Transform.scala:69)
[error]         at sbt.Execute.$anonfun$submit$2(Execute.scala:283)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:24)
[error]         at sbt.Execute.work(Execute.scala:292)
[error]         at sbt.Execute.$anonfun$submit$1(Execute.scala:283)
[error]         at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:265)
[error]         at sbt.CompletionService$$anon$2.call(CompletionService.scala:65)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
[error]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
[error]         at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
[error]         at java.base/java.lang.Thread.run(Thread.java:840)
[error] (Compile / protocGenerate) protoc returned exit code: 1

@thesamet
Copy link
Contributor

thesamet commented Feb 4, 2024

Hi @Catlickfish, can you share the full output within sbt of the following:

clean
debug
compile

@thesamet thesamet reopened this Feb 4, 2024
@Catlickfish
Copy link

Catlickfish commented Feb 5, 2024

@thesamet The full output is here:

PS C:\Users\Vetch\Desktop\Hello> sbt
[info] welcome to sbt 1.9.7 (Eclipse Adoptium Java 17.0.10)
[info] loading settings for project hello-build from scalapb.sbt ...
[info] loading project definition from C:\Users\Vetch\Desktop\Hello\project
[info] loading settings for project hello from build.sbt ...
[info] set current project to hello (in build file:/C:/Users/Vetch/Desktop/Hello/)
[info] sbt server started at local:sbt-server-0be5c496be180df267d0
[info] started sbt server
sbt:hello> clean
[success] Total time: 0 s, completed 2024骞???涓婂崍9:43:33
sbt:hello> debug
sbt:hello> compile
[debug] not up to date. inChanged = true, force = false
[debug] Updating ...
[debug] Done updating
[debug] Extracted from C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\scalapb-runtime_2.12\0.11.11\scalapb-runtime_2.12-0.11.11.jar:
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\scalapb\scalapb.proto
[debug] Extracted from C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\google\protobuf\protobuf-java\3.19.2\protobuf-java-3.19.2.jar:
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\duration.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\any.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\empty.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\timestamp.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\wrappers.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\compiler\plugin.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\source_context.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\type.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\descriptor.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\struct.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\api.proto
[debug]  * C:\Users\Vetch\Desktop\Hello\target\protobuf_external\google\protobuf\field_mask.proto
[debug] Attempting to fetch com.thesamet.scalapb % compilerplugin_2.12 % 0.11.11. This operation may fail.
[debug] Files retrieved for com.thesamet.scalapb % compilerplugin_2.12 % 0.11.11:
[debug] C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\compilerplugin_2.12\0.11.11\compilerplugin_2.12-0.11.11.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-library\2.12.11\scala-library-2.12.11.jar, C:
\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\google\protobuf\protobuf-java\3.19.2\protobuf-java-3.19.2.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\org\scala-lang\modules\scala-collection-compat_2.12\2.7.0\scala-collection-compat_2.12-2.7.
0.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\protoc-gen_2.12\0.9.5\protoc-gen_2.12-0.9.5.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\protoc-bridge_2.12\0.9.5\protoc-bridge_2.12-0.9.5.jar, C:\
Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\dev\dirs\directories\26\directories-26.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\compilerplugin_2.12\0.11.11\compilerplugin_2.12-0.11.11.jar, C:\Users\Vetch\AppData\Local\Cour
sier\Cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-library\2.12.11\scala-library-2.12.11.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\google\protobuf\protobuf-java\3.19.2\protobuf-java-3.19.2.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1
.maven.org\maven2\org\scala-lang\modules\scala-collection-compat_2.12\2.7.0\scala-collection-compat_2.12-2.7.0.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\protoc-gen_2.12\0.9.5\protoc-gen_2.12-0.9.5.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1
\https\repo1.maven.org\maven2\com\thesamet\scalapb\protoc-bridge_2.12\0.9.5\protoc-bridge_2.12-0.9.5.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\dev\dirs\directories\26\directories-26.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\th
esamet\scalapb\compilerplugin_2.12\0.11.11\compilerplugin_2.12-0.11.11.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\org\scala-lang\scala-library\2.12.11\scala-library-2.12.11.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\google\proto
buf\protobuf-java\3.19.2\protobuf-java-3.19.2.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\org\scala-lang\modules\scala-collection-compat_2.12\2.7.0\scala-collection-compat_2.12-2.7.0.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\the
samet\scalapb\protoc-gen_2.12\0.9.5\protoc-gen_2.12-0.9.5.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\com\thesamet\scalapb\protoc-bridge_2.12\0.9.5\protoc-bridge_2.12-0.9.5.jar, C:\Users\Vetch\AppData\Local\Coursier\Cache\v1\https\repo1.maven.org\maven2\dev\dirs\director
ies\26\directories-26.jar
[debug] Invalidating cache (input changed)
[info] Compiling 1 protobuf files to C:\Users\Vetch\Desktop\Hello\target\scala-2.12\src_managed\main\scalapb
[debug] protoc options:
[debug] Compiling schema C:\Users\Vetch\Desktop\Hello\src\main\protobuf\trading_order.proto
[debug] Executing protoc with [--plugin=protoc-gen-jvm_0=C:\Users\Vetch\AppData\Local\Temp\protocbridge5320668601932244396.bat, --jvm_0_out=C:\Users\Vetch\Desktop\Hello\target\scala-2.12\src_managed\main\scalapb, --jvm_0_opt=grpc, -IC:\Users\Vetch\Desktop\Hello\src\main\protobuf, -IC:\Users\Vetch\Desktop\He
llo\target\protobuf_external, C:\Users\Vetch\Desktop\Hello\src\main\protobuf\trading_order.proto] and extraEnv=Vector((SCALAPB_SECONDARY_OUTPUT_DIR,C:\Users\Vetch\AppData\Local\Temp\protocbridge-secondary2831422922203680269))
系统找不到指定的路径。
--jvm_0_out: protoc-gen-jvm_0: Plugin failed with status code 1.
[error] stack trace is suppressed; run last Compile / protocGenerate for the full output
[error] (Compile / protocGenerate) protoc returned exit code: 1
[error] Total time: 4 s, completed 2024骞???涓婂崍9:43:48
sbt:hello>
[info] shutting down sbt server
PS C:\Users\Vetch\Desktop\Hello> 

"系统找不到指定的路径" means "The system cannot find the path specified."

@Touutae-lab
Copy link
Author

@Catlickfish can you try delete cached ?

@Catlickfish
Copy link

@Catlickfish can you try delete cached ?

What do you mean by that?

@Catlickfish
Copy link

@thesamet @Touutae-lab Sorry to bother you, but I still don't find a solution for this problem.

@thesamet
Copy link
Contributor

I am currently ooo and will be able to provide more help early March. Since I am not able to reproduce the problem, it will be great if you can set up and provide me access to an environment where the problem happens, for example a VM image or remote access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants