The type com.google.protobuf.GeneratedMessageV3$Builder cannot be resolved. It is indirectly referenced from required .class files

Viewed 5052

I have been doing my project and all the sudden eclipse started to give this error saying

The type com.google.protobuf.GeneratedMessageV3$Builder cannot be resolved. 

It is indirectly referenced from required .class files where we declare the package. I have tried adding com.google.protobuf-2.4.0.jar to build path but it did not work. Please help and here's the screenshot.

enter image description here

4 Answers

com.mysql.cj.x.protobuf.MysqlxSql.StmtExecute is not on the classpath so remove this import

If you are expecting Protobuf generated files to be available, then ensure that you have added the Protobuf library to your project.

Gradle example:

implementation group: 'com.google.protobuf', name: 'protobuf-java', version: googleProtobufVersion

Maven example:

<dependency>
    <groupId>com.google.protobuf</groupId>
    <artifactId>protobuf-java</artifactId>
    <version>${googleProtobufVersion}</version>
</dependency>

Not sure if this helps at such a later date. But i also faced something similar.

I found that I imported this by mistake

import com.mysql.cj.x.protobuf.MysqlxDatatypes.Array;

After removing this line, it works fine.

In your case you need to remove the import

com.mysql.cj.x.protobuf.MysqlxSql.StmtExecute

Replace it with the relevant import.

This is due to the missing dependency of gRPC protobuf. Add this dependency to your pom.xml and this should solve your problem.

    <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-protobuf</artifactId>
        <version>1.16.1</version>
    </dependency>

Lastly, do maven -> project update

Related