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

java.lang.ClassNotFoundException: scalapb.ScalaPbCodeGenerator since version 0.10.10 #1114

Closed
segfault16 opened this issue Apr 1, 2021 · 1 comment

Comments

@segfault16
Copy link

Hi,

Since version 0.10.10 I'm getting the following error:

protoc --proto_path=api --plugin=/usr/local/bin/protoc-gen-scala --scala_out=scala api/harmonization.proto
Error: Could not find or load main class scalapb.ScalaPbCodeGenerator
Caused by: java.lang.ClassNotFoundException: scalapb.ScalaPbCodeGenerator
--scala_out: protoc-gen-scala: Plugin failed with status code 1.

version 0.10.9 and prior is working fine.

Tested with the following Dockerfile:

FROM adoptopenjdk/openjdk13:debian
WORKDIR /tmp/build

ENV PROTOC_VERSION 3.12.3
ENV SCALAPB_VERSION 0.10.10

RUN apt-get update && apt-get install -y unzip util-linux bsdmainutils

RUN curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip  && \
    unzip protoc-$PROTOC_VERSION-linux-x86_64.zip && \
    cp bin/protoc /usr/local/bin && \
    chmod +x /usr/local/bin/protoc && \
    cp -a include/. /usr/local/include/

RUN curl -LO https://github.com/scalapb/ScalaPB/releases/download/v$SCALAPB_VERSION/protoc-gen-scala-$SCALAPB_VERSION-linux-x86_64.zip && \
    unzip protoc-gen-scala-$SCALAPB_VERSION-linux-x86_64.zip && \
    cp protoc-gen-scala /usr/local/bin/protoc-gen-scala && \
    chmod +x /usr/local/bin/protoc-gen-scala

# Install task
WORKDIR /usr/local
RUN curl -sL https://taskfile.dev/install.sh  | sh 

CMD ["protoc", "--help"]

WORKDIR /tmp
@thesamet
Copy link
Contributor

thesamet commented Apr 1, 2021

Thanks for reporting and providing a way to reproduce. It looks like we've hit some variant of scala/bug#11634 impacting Scala 2.12. I updated to Scala 2.13 and transitioned to sbt-native-image which workarounds additional graalvm issues impacting Scala 2.13.

thesamet added a commit that referenced this issue Apr 2, 2021
thesamet added a commit that referenced this issue Apr 3, 2021
Switch to sbt-native-image for an easier build.

Fixes #1114
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

2 participants