Share data between interceptor and service gRPC

Let’s imagine that we need to pass data between the interceptor and the service (or we need to sharedata between the interceptor and the service, or we need to exchange data between the interceptor and the service). We have a service: We have the code for starting the gRPC server: In your Interceptor class, in […]

READ MORE

Get client IP address from request gRPC

Let’s imagine that we need to get the client’s ip address from the request.  We have a service:  And the code for starting the gRPC server:  Let’s create a new class:  And register a new interceptor in the gRPC server launch code:  Done. If you need to pass the ip address from the interceptor to the […]

READ MORE

Failed to deploy artifacts: Could not find artifact Maven

When you try to execute the mvn deploy command, you may encounter the error: The error could actually means (thanks to randomsimon):  That is, maven cannot find the repository at the specified url. Check, that the url of the repository is correct, and in general it exists and specified.  A repository url can be specified via […]

READ MORE

ZooKeeper x509 certificates ACL

The documentation states that setting an ACL via the ZooKeeper CLI usually works like this: In the case of the x509 scheme, the Authenticated ID for the user is the DN string of their certificate. In confirmation of this, when a user connects via a certificate, there is a line in the server log: Now, […]

READ MORE

HBase client 1.x with gRPC

Imagine, that you need to use the HBase client 1.x and gRPC in the same Java application. The code for connecting dependencies to Maven will look something like this: If you run the application and execute the request through the HBase client, there will be an exception: The problem is that hbase-client 1.x uses an earlier […]

READ MORE

VisualVM redefinition failed with error 62

Error: This occurs when you try to profile a Java application through JVisualVM. This is a bug. A workaround can be found here. The application you want to profile must be launched with the flag: Example for regular jar: An example for Spring Boot Yarn is below. The application.yml file for AppMaster: After that, profiling […]

READ MORE

Can’t open file Spring Boot Yarn

Suppose, that we need to read the file from the Spring Boot Yarn application. We seem to have done everything right: placed the file next to the Yarn-client, Yarn-container and Yarn-appmaster jars; have used the File class, Files class, FileInputStream class and others. But for some reason we see exceptions like below: The problem is […]

READ MORE

Exclude package from Maven-PMD and Findbugs

Suppose, that you need to exclude the package from the maven-pmd-plugin, or you need to exclude the package from findbugs-maven-plugin.  maven-pmd-plugin Pmd definition in project pom.xml: Pmd configuration file pmd-exclude.xml: findbugs-maven-plugin Findbugs definition in project pom.xml: Findbugs configuration file findbugs-exclude.xml:

READ MORE

Unrecognized field JSON

Exception text: Most likely the code looks like this: The error is that the names of getter and setter are not consistent with the corresponding field. getVar2() and setVar2() should be named getVar1() and setVar1():

READ MORE

Spring Boot REST vs gRPC compatibility

Suppose you are using Spring Boot and you have a REST controller: At some point you need to connect the gRPC to the project without disabling REST controller. The gRPC code looks something like this: Then you find out that you can’t start REST server together with gRPC. gRPC will start, but REST will not. […]

READ MORE