Does GraalVM JVM support java 11? - java

How build GraalVM JVM for Java 11?
(I don't see any official distributives only java 8)

Not currently.
From this GitHub issue, it seems that it will be ready around the end of February, 2019. However, Java 11 does include support for the Graal compiler, which can be enabled with the following flags:
-XX:+UnlockExperimentalVMOptions -XX:+UseJVMCICompiler
Edit: According to that GitHub issue, it looks like Graal 19.3 will be released on November 19, 2019, which should include Java 11 support.

Yes the new version of GraalVM 19.3.0 supports Java 11.
please go to the below link for more information
https://medium.com/graalvm/graalvm-19-3-0-dfdb6f4ec8ed

I am using java12 and i just added these dependencies to my project and it works fine
<dependency>
<groupId>org.graalvm.sdk</groupId>
<artifactId>graal-sdk</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.js/js -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.js/js-scriptengine -->
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>19.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.graalvm.compiler/compiler -->
<dependency>
<groupId>org.graalvm.compiler</groupId>
<artifactId>compiler</artifactId>
<version>19.1.1</version>
</dependency>
</dependencies>

Related

Why does Java 11 gives TaskExecutionException in Android Studio?

So, I'm working on one large existing company project, where things are old / deprecated and I'm trying to improve it step by step.
Right now I'm trying to update JDK version from Java 1.8 to Java 11. So I made changes from Android Studio preference settings.
Also I made this changes as well: https://developer.android.com/studio/releases/gradle-plugin#java-11
About my project:
targetSDKVersion: 30
Android Studio: Latest stable release
Project codeing: 50% code Java and 50% code Kotlin
So, when I made above 2 change and sync the project, it got successfully sync and when I try to run this this exception is coming.
java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException
at java.base/java.lang.Class.getDeclaredConstructors0(Native Method)
at java.base/java.lang.Class.privateGetDeclaredConstructors(Class.java:3137)
at java.base/java.lang.Class.getConstructor0(Class.java:3342)
at java.base/java.lang.Class.newInstance(Class.java:556)
Execution failed for task ':app:kaptPlaystoreDebugKotlin'.
> Internal compiler error. See log for more details
* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:kaptPlaystoreDebugKotlin'
NOTE: playstoreDebug is a build variant name.
Answer: Upon upgrading from java8 to java11 there are some libraries that have been removed. If one wants to use them they need to be specifically added as dependencies.
This question has already been answered:
javax.xml.bind.JAXBException Implementation of JAXB-API has not been found on module path or classpath
Replacements for deprecated JPMS modules with Java EE APIs
Add these dependencies into your pom/gradle:
Gradle:
compile('javax.xml.bind:jaxb-api:2.3.0')
compile('javax.activation:activation:1.1')
compile('org.glassfish.jaxb:jaxb-runtime:2.3.0')
Pom:
<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0-b170201.1204</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.activation/activation -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-runtime -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.0-b170127.1453</version>
</dependency>

Keycloak-Admin-Client in a JPMS/Jigsaw Java 11 Maven application - Dependency Problems

maybe someone has already figured that out or has some tips, I would be really thankful.
I'm trying to use the Keycloak-Admin-Client maven dependency in a modularized Java 11 application. The Application is modularized via JPMS/Jigsaw.
I'm using the version 9.0.2 of the Keycloak-Admin-Client.
<keycloak-admin-client.version>9.0.2</keycloak-admin-client.version>
<groupId>org.keycloak</groupId>
<artifactId>keycloak-admin-client</artifactId>
<version>${keycloak-admin-client.version}</version>
My current Problem:
java.lang.module.FindException: Module javax.ws.rs.api not found, required by com.fasterxml.jackson.jaxrs.base
But I already have this in my module-info and POM:
requires java.ws.rs;
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
</dependency>
The javax.ws.rs-api jar is also in my libs folder (module-path):
module-path lib folder
Some additional informations from the jackson-jaxrs-providers GitHub-Repo:
requires static javax.ws.rs.api;
requires static java.ws.rs;
requires static jakarta.ws.rs.api;
https://github.com/FasterXML/jackson-jaxrs-providers/blob/master/json/src/moditect/module-info.java
I hope my problem is understandable, please ask if more details are needed.
Thanks a lot and best regards.
Pierre
The problem was that the javax.ws.rs-api artifact Version 2.1 has a different artifact-id "java.ws.rs-api" not "javax.ws.rs-api".
In Version 2.0.1. are packages missing.
Version 2.1-m08 works.
<dependency>
<groupId>javax.ws.rs</groupId>
<!-- pwi: JAX-RS 2.x has different artifact-id, "javax.ws.rs-api" and Version 2.0.1 has missing packages -->
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1-m08</version>
</dependency>

Junit tests not working with Drools 5.4.0.Final and JDK 8

I recently started upgrading my application JDK version from jdk1.7.0_121_x64 to jdk1.8.0_202_x64. I have some legacy code using Drools 5.4.0.Final. This code is working with JDK version jdk1.7.0_121_x64 without any issue.
Maven dependencies are:
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>5.4.0.Final</version>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>5.4.0.Final</version>
</dependency>
DRL files are loaded as:
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
kbuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
I was aware that there are issues using Drools with JDK 8. I referrred to other SO thread to start with.
When I built my application and executed Junit tests using JDK 8, tests failed with error:
testRunRule(com.company.app.RuleTest) Time elapsed: 0.073 sec <<< ERROR!
java.lang.RuntimeException: java.lang.RuntimeException: wrong class format
at org.eclipse.jdt.internal.compiler.classfmt.ClassFileReader.<init>(ClassFileReader.java:372)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.createNameEnvironmentAnswer(EclipseJavaCompiler.java:287)
at org.drools.commons.jci.compilers.EclipseJavaCompiler$2.findType(EclipseJavaCompiler.java:258)
As mentioned in SO thread, I found reference to this bugfix ticket DROOLS-329.
Based on approaches mentioned in this bugfix ticket, I tried to use JANINO compiler:
Added following maven dependency:
<dependency>
<groupId>org.codehaus.janino</groupId>
<artifactId>janino</artifactId>
<version>2.5.16</version>
</dependency>
I added following VM argument (I was running tests from eclipse, so in eclipse launch configuration in JRE VM argument added the argument):
-Ddrools.dialect.java.compiler=JANINO
I could still see the wrong class format error. So I modified my code to load DRL files as:
final KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
final Properties props = new Properties();
props.setProperty("drools.dialect.java.compiler", "JANINO");
final KnowledgeBuilderConfiguration config = KnowledgeBuilderFactory.newKnowledgeBuilderConfiguration(props, null);
final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(config);
kbuilder.add(resource, ResourceType.DRL);
knowledgeBase.addKnowledgePackages(kbuilder.getKnowledgePackages());
It didn't help. I could still see the wrong class format error.
I followed another apprroach mentioned in this external link. I updated added/updated maven dependencies as:
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
<version>5.4.0.Final</version>
<exclusions>
<exclusion>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-decisiontables</artifactId>
<version>5.4.0.Final</version>
<exclusions>
<exclusion>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
</exclusion>
<exclusion>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.mvel</groupId>
<artifactId>mvel2</artifactId>
<version>2.1.9.Final</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.6.1</version>
</dependency>
mvel2 patch is built using:
https://github.com/mkornipati/mvel/tree/2.1.9.Final.Patch
With this wrong class format error is gone. But my tests are now failing with following error:
testRunRule(com.company.app.RuleTest)) Time elapsed: 4.684 sec <<< ERROR!
java.lang.RuntimeException: org.drools.rule.InvalidRulePackage: Rule Compilation error : [Rule name='ruleCheck']
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (2:80) : Only a type can be imported. java.util.Map resolves to a package
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (2:101) : Only a type can be imported. java.util.HashMap resolves to a package
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (6:299) : org.drools.spi.KnowledgeHelper cannot be resolved to a type
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (6:339) : org.drools.template.parser.Row cannot be resolved to a type
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (6:373) : org.drools.FactHandle cannot be resolved to a type
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (6:411) : org.drools.template.parser.DefaultGenerator cannot be resolved to a type
org/drools/template/parser/Rule_ruleCheck_8eb4621227714a36b7b84c8b764527e4.java (6:487) : org.drools.runtime.rule.RuleContext cannot be resolved to a type
at org.drools.rule.Package.checkValidity(Package.java:445)
I don't know how to proceed further. Please let me know if you are able to make Drools 5.4 work with JDK 8.
I used Drools 7.7.0 with Java 8 and worked great for me. I am not sure what is the oldest Drools version that is compatible with Java 8. That said, Drools 5.4.0 was released in 2011. Java 8 was released in 2014, so you can assume it won't be compatible. Java 7 was released in July 2011. Depending on when 5.4.0 was released it might or might not be. Based on that, I expect Drools 5.4.0 to be compatible with Java 6 or earlier. If you want to use Java 8 with Drools, I don't see how you can without upgrading. I think the earliest compatible version is 6.1.0 download.jboss.org/drools/release.
In summary: Either downgrade your project to Java 6 to use Drools 5.4.0 or Upgrade Drools to use 6.1.0. Better yet, upgrade to latest Drools and then figure out what is the latest Java version it supports.

Clickhouse JDBC driver class name

Has anyone used Spring JDBC with Clickhouse? What is the driver class name?
spring.datasource.driver-class-name=<what is it?>
I guess it could be it, even though it doesn't look like any other driver class names that I have seen.
spring.datasource.driver-class-name=ru.yandex.clickhouse.ClickHouseDriver
There is also lighter and faster alternative to the official driver version - clickhouse4j. (fork of the official driver with some improvements)
You can use it like this:
spring.datasource.driver-class-name=cc.blynk.clickhouse.ClickHouseDriver
Driver was renamed due to moving vom yandex to clickhouse.com.
Clickhouse Driver
spring.datasource.driver-class-name=com.clickhouse.jdbc.ClickHouseDriver
See https://github.com/ClickHouse/clickhouse-jdbc
Also note Java Client and JDBC Driver MVN dependencies changed as well:
Maven Clickhouse Java Client
<dependency>
<groupId>com.clickhouse</groupId>
<!-- or clickhouse-grpc-client if you prefer gRPC -->
<artifactId>clickhouse-http-client</artifactId>
<version>0.3.2-patch11</version>
</dependency>
Maven Clickhouse JDBC Driver
<dependency>
<!-- please stop using ru.yandex.clickhouse as it's been deprecated -->
<groupId>com.clickhouse</groupId>
<artifactId>clickhouse-jdbc</artifactId>
<version>0.3.2-patch11</version>
<!-- use uber jar with all dependencies included, change classifier to http for smaller jar -->
<classifier>all</classifier>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
Starting 4.0.0 yandex packages will be removed and be non functional!

Compile error with OptionsBuilder for jmh-core version > 1.9

Options opt = new OptionsBuilder()
.include(this.getClass().getSimpleName())
.forks(1)
.build();
Compilation fine with jmh-core version 1.9, failed with jmh-core version > 1.9
Error:java: java.lang.IllegalStateException: Unable to parse the line: PerformanceBenchmark.benchmark1===,===PerformanceBenchmark_benchmark1.benchmark1===,===Throughput===,===1====,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]===,===[]
Java version : 1.8.0_74
Can anyone tell me what went wrong.. ?
Thank you.
<!--Benchmarking framework-->
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.9.3</version>
<scope>test</scope>
</dependency>
In my case jmh-core and jmh-generator-annprocess versions matched, but the build still failed. It happened after JMH version was increased. I resolved it by cleaning and rebuilding the project in IntelliJ.
There are two dependencies usually involved: jmh-core and jmh-generator-annprocess. Their versions should agree. If they don't, then generator may produce the benchmark list in a format that core cannot understand. This most probably is such case.

Categories