Hi fellow Grails devs, has anyone used Grails 6.0 ...
# questions
j
Hi fellow Grails devs, has anyone used Grails 6.0 or newer with a newer Java version as 11, at least 15? I am using “sdk default java 11.0.21-amzn”, but since I included Algorand
Copy code
// ALGORAND BLOCKCHAIN
// <https://mvnrepository.com/artifact/com.algorand/algosdk>
implementation group: 'com.algorand', name: 'algosdk', version: '2.4.0'
new cryptographic capabilites for creating an account from public/private key, namely
Copy code
Ed25519
are needed, that seem to not be part of Java 11, so the Algorand SDK complains with java.security.NoSuchAlgorithmException: Ed25519 KeyPairGenerator not available at java.base/java.security.KeyPairGenerator.getInstance(KeyPairGenerator.java:236) Now, ChatGPT says Ed25519 it’s delivered as default in Java 15, but when I tried sdk default java 17.0.10-amzn with my Grails grailsVersion=6.0.0 app, that failed. Even the latest Grails version 6.2 seems to be building on java 1.11, b/c sourceCompatibility = “1.11" targetCompatibility = “1.11” in https://github.com/grails/grails-core/blob/6.2.x/build.gradle How can I use Ed25519 in Grails App 6.0.0 or up (can upgrade, no problem)? The Grails release notes seem to be telling me, that Grails 7 will start to build on JDK 17, but cannot wait that long. Any help, as always, very much appreciated. Have a nice day! addition: this solution (by chatGPT) doesn’t work either, because somewhere in my GSPs I now get security errors:
Copy code
// Using BouncyCastleProvider for Ed25518 workaround (needed for Algorand) also in Java 11 with Grails 6 (normally only comes since Java 15)
implementation 'org.bouncycastle:bcprov-jdk15on:1.68'
Have this in my AlgorandBlockchainService.groovy
Copy code
static {
    if (Security.getProvider(BouncyCastleProvider.PROVIDER_NAME) == null) {
        Security.addProvider(new BouncyCastleProvider());
    }
}
m
Hi, Java 11 is the minimum (or baseline) version needed to run Grails 6. You can always go higher as long as you (or your dependencies) don't use any features that were removed. This Grails 6 is built with Java 17 and runs on Java 21: https://github.com/matrei/pingcrm-grails
🙏 1
g
Try Oracle Java, Their JVM suppose having most cryptographic algorithms
🙏 1
a
That bouncycastle library isn't for JDK 15+, it's for JDK 1.5+ (Java 5). There's a newer one for Java 8 onward, which is 'org.bouncycastlebcprov jdk18on1.77'. I don't know if that will have any bearing on your issue, but it's not a bad example of why StackOverflow doesn't allow answers from ChatGPT.
🙏 1
j
Thanks very much for your valuable answers guys. I chose to update to Oracle java 17 “sdk use java 17.0.10-oracle” but now in many of my GSPs I get this error, having no clue where it is originating from. Algorand SDK 2.4 works with Oracle Java 17. The reason I chose Amazon Java 11 was because it will then run on Amazon Elastic Beanstalk server (with a Amazon Java version): groovy.lang.MissingMethodException: No signature of method: static grails.plugin.springsecurity.SpringSecurityUtils.getPrincipal() is applicable for argument types: () values: []
Fixed that error, so now I run Grails 6 on Oracle Java 17, with Algorand working. I hope that Amazon Java will do the Job on AWS then, or that I can chose Oracle Java version from Elastic Beanstalk in production then.
👍 1