javax.annotation classes and Java 11 JDK

When migrating up ahead 3 releases of Java, the first thing one should consider is to update all the major dependencies. maven-compiler-plugin -> current version is 3.8.1, 2.5.1 is 7 years old. Try the following to resolve this error: java.lang.NoSuchMethodError: javax.annotation.Resource.lookup()Ljava/lang/String; Keep the dependency: <dependency> <groupId>javax.annotation</groupId> <artifactId>javax.annotation-api</artifactId> <version>1.3.1</version> </dependency> And explicitly add it as a … Read more

How to log request/response using java.net.http.HttpClient?

You can log request and responses by specifying-Djdk.httpclient.HttpClient.log=requests on the Java command line. As for testing/mocking you might want to have a look at the offline test: http://hg.openjdk.java.net/jdk/jdk/file/tip/test/jdk/java/net/httpclient/offline/ Depending on what you are looking to achieve you could use a “DelegatingHttpClient” to intercept and log requests and responses too. Besides the Java API documentation there’s … Read more

Allow insecure HTTPS connection for Java JDK 11 HttpClient

As suggested already you need an SSLContext which ignores the bad certificates. The exact code which obtains the SSLContext in one of the links in the question should work by basically creating a null TrustManager which doesn’t look at the certs: private static TrustManager[] trustAllCerts = new TrustManager[]{ new X509TrustManager() { public java.security.cert.X509Certificate[] getAcceptedIssuers() { … Read more

Eclipse 4.12 – java.lang.ClassNotFoundException: com.sun.xml.internal.bind.v2.ContextFactory

Sun people have remove directly access to jaxb package in java 11. These dependency will work instead of it. Same fix if you are facing hibernate NullPointerException issue. <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> <version>2.3.0.1</version> </dependency> <dependency> <groupId>javax.xml.bind</groupId> <artifactId>jaxb-api</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> <version>2.3.1</version> </dependency> <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.25.0-GA</version> </dependency>

Springboot: org.hibernate.MappingException: Could not get constructor for org.hibernate.persister.entity.SingleTableEntityPersister

The problem is with Jdk 11 and javassist. Add this in your pom.xml: <dependency> <groupId>org.javassist</groupId> <artifactId>javassist</artifactId> <version>3.23.1-GA</version> </dependency> Info taken from: here One needs to be careful when migration from Java 8 to Java 11, many things don’t work out of the box.

Difference between isEmpty() and isBlank() Method in java 11

isEmpty() The java string isEmpty() method checks if this string is empty. It returns true, if the length of the string is 0 otherwise false e.g. System.out.println(“”.isEmpty()); // Prints – True System.out.println(” “.isEmpty()); //Prints – False Java 11 – isBlank() The new instance method java.lang.String.isBlank() returns true if the string is empty or contains only … Read more

File not found.