Java invalid or corrupt jarfile

Suppose you have an error: Or related one: The first thing you need to do is to check your main class defined in manifest. If you’re 100% sure that everything is all right, then check any running JVM processes, associated with that file and kill them. The thing is that you probably ran the old […]

READ MORE

Opencensus GCP class tried to access private field

If you getting these opencensus errors in GCP from time to time: It worth to recheck dependency version of each opencensus component, that actually presented in your final jar: You may have opencensus-api version 0.19.2, and opencensus-impl version 0.15.0. Thus solution is to equalize all these versions. You can review your dependency versions with following […]

READ MORE

Spring NoClassDefFoundError: JAXBException

If you facing this error: Then the reason is Java XML Binding, it is a tool for mapping between XML documents and Java objects. These classes has been removed from internal of JDK since 11 version and moved to Jakarta EE. This transition was happened with replacing javax to jakarta in package names. javax in your stacktrace tells us that […]

READ MORE

Testcontainers timed out waiting for URL to be accessible | Mockserver Mac M1 compatibility

Exception looks like this: Suppose you want to start mockserver docker image on Mac M1. Probably you doing something like this: Most likely this error happens because of poor docker x86-64 image compatibility with the ARM (M1) CPU architecture. If you see carefully, then you can find out that some versions of mockserver images (including […]

READ MORE

Accessing Spring Boot Actuator metrics programmatically

Suppose you have Spring Boot actuator in your application, and you want to access metrics programmatically. Or you want to gather a lot of system/application metrics initially. After you enable the Spring Boot actuator in your application (https://www.baeldung.com/spring-boot-actuators), just autowire all actuator auto wire candidates: You can use them like this: That’s all.

READ MORE

Building tdlight natives for aarch64

If you trying to build your project with tdlib on MacOS M1 (Apple Silicon chip), you probably are gonna face this error: You need to compile these natives for aarch64 architecture. The final artifact will be named as: tdlight-natives-osx-aarch64. NOTE: If you want to take compiled artifact, just download it from my repo, then put into […]

READ MORE

Java 8 date/time type not supported

Suppose you want to serialize some object to JSON. You may encounter the exception: We need to do two steps: Firstly, let’s add dependency from https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-datatype-jsr310. Next, let’s register JavaTimeModule within ObjectMapper: If you working with Spring or with some other framework, ObjectMapper can be instantiated implicitly. You need to override instantiation by yourself. For […]

READ MORE

No implementation of L32X64MixRandom

You may encounter exception, that states: The reason is JDK/JRE version and vendor. I noticed, that at least JBR-17 (JetBrains Runtime) hasn’t got L32X64MixRandom algorithm. You may want to switch to Azul-17 (Azul Zulu) to make it works again. If you build/run your application with Gradle, don’t forget to change Gradle JVM version in IntelliJ […]

READ MORE

Maven dependency exclusion not working

This article helps you in such cases: There are at list two reasons of such problems: 1. This dependency is transitive for other dependency, not that one, where you made exclusion. Thus you need to add exclusion tag somewhere else (if your exclusion is located in section, not plugin-level). mvn dependency:tree is very useful for […]

READ MORE

log4j 1.x to log4j 2.x bridge migration

Even though you may want to merely copy & paste the code below, I suggest you firstly explore carefully the article describing how Java logging works, what is slf4j, what is log4j, what is bridge and how it works: https://mchesnavsky.tech/how-the-java-logging-should-works/, and then return back. In this article you’ll find the answers for these questions: Suppose […]

READ MORE