1

I have tried to make a project that connects to a DB and takes information and outputes them in a desktop application through grpc. But, when I compile it I get "Error:(20,18) java: cannot find symbol" in a target file( which is auto-generated by protoc. I can't understand the issue with this. I have tried to change the compiler of mvn, to change the version on protoc, to setup a different JDK, everything just gets worse that it already is.

My project can be viewed here : https://github.com/Diana-Ioana/grpc My db and error with the generated target files that crashes is : https://i.stack.imgur.com/7U1zB.jpg

I have no idea what to do now. Any help would be greate, thank you!

Diana G
  • 261
  • 3
  • 15

1 Answers1

5

It looks like the "cannot find symbol" is referring to javax.annotation.Generated. In that case you can add a dependency on annotations-api:

    <dependency>
        <groupId>org.apache.tomcat</groupId>
        <artifactId>annotations-api</artifactId>
        <version>6.0.53</version>
        <!-- Generated has @Retention(SOURCE), so not needed at runtime -->
        <scope>provided</scope>
    </dependency>

Originally this answer suggested javax.annotation-api, but that library is licensed CDDL so gRPC changed its recommendation.

    <!-- The old suggestion. Uses CDDL-licensed library -->
    <dependency>
        <groupId>javax.annotation</groupId>
        <artifactId>javax.annotation-api</artifactId>
        <version>1.2</version>
    </dependency>
Eric Anderson
  • 24,057
  • 5
  • 55
  • 76
  • Thank you! Because maven wouldn't redden the line with the issue I couldn't understand why it wasn't working. – Diana G Nov 28 '19 at 07:14