Skip to content

Comments

CARDS-2820: Move to Java 21#2155

Open
sdumitriu wants to merge 2 commits intodevfrom
CARDS-2820-java-21
Open

CARDS-2820: Move to Java 21#2155
sdumitriu wants to merge 2 commits intodevfrom
CARDS-2820-java-21

Conversation

@sdumitriu
Copy link
Member

@sdumitriu sdumitriu commented Jan 3, 2026

To test:

  • upgrade to Java 21 or 24
  • upgrade Maven to 3.8.7
  • build
  • run
  • make sure it starts correctly
  • check that backend computed answers work

@sdumitriu sdumitriu requested a review from a team January 3, 2026 23:38
@acrowthe
Copy link
Contributor

acrowthe commented Jan 5, 2026

Backend computed answer are not working reliably for me:
On the Backend Computed Test - Invalid Names test form, the first 4 computed questions do not work in the backend and there are a lot of logged warning and error messages including:

05.01.2026 14:29:52.492 *WARN* [127.0.0.1 [1767641392386] POST /Forms/cbae45fb-e7b0-4493-a2ce-f30844f2b3c4 HTTP/1.1] io.uhndata.cards.forms.internal.ExpressionUtilsImpl Evaluating the expression for question Node[NodeDelegate{tree=/Questionnaires/BackendComputedTest/computedquestions/question4c_computed: { jcr:primaryType = cards:Question, jcr:createdBy = sling-jcr-content-loader, expression = return "The first value from Question 4 is " + @{question4_multi?};, minAnswers = 0, entryMode = computed, jcr:created = 2026-01-05T14:24:05.143-05:00, text = Question 4c Computed. Displays "The first value from Question 4 is " and the first value, if any, sling:resourceSuperType = cards/ResourcePart, maxAnswers = 1, jcr:uuid = af68f199-879f-4621-bb0b-82515be87255, sling:resourceType = cards/Question, displayMode = formatted, dataType = text}}] failed: Failure running script NO_SCRIPT_NAME: ReferenceError: "arg0" is not defined. (NO_SCRIPT_NAME#1)
javax.script.ScriptException: Failure running script NO_SCRIPT_NAME: ReferenceError: "arg0" is not defined. (NO_SCRIPT_NAME#1)
	at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine$SlingCompiledScript.eval(RhinoJavaScriptEngine.java:320) [org.apache.sling.scripting.javascript:3.1.4]
	at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine.eval(RhinoJavaScriptEngine.java:155) [org.apache.sling.scripting.javascript:3.1.4]
	at org.apache.sling.scripting.api.AbstractSlingScriptEngine.eval(AbstractSlingScriptEngine.java:44) [org.apache.sling.scripting.api:2.2.0]
	at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:231)
	at io.uhndata.cards.forms.internal.ExpressionUtilsImpl.evaluate(ExpressionUtilsImpl.java:109) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	at io.uhndata.cards.forms.internal.ComputedAnswersEditor.computeAnswer(ComputedAnswersEditor.java:183) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	at io.uhndata.cards.forms.internal.ComputedAnswersEditor.lambda$handleLeave$3(ComputedAnswersEditor.java:169) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	...
05.01.2026 14:29:52.505 *WARN* [127.0.0.1 [1767641392386] POST /Forms/cbae45fb-e7b0-4493-a2ce-f30844f2b3c4 HTTP/1.1] io.uhndata.cards.forms.internal.ExpressionUtilsImpl Parsing Object [] to JSObject failed: Failure running script NO_SCRIPT_NAME: ReferenceError: "Java" is not defined. (NO_SCRIPT_NAME#1)
javax.script.ScriptException: Failure running script NO_SCRIPT_NAME: ReferenceError: "Java" is not defined. (NO_SCRIPT_NAME#1)
	at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine$SlingCompiledScript.eval(RhinoJavaScriptEngine.java:320) [org.apache.sling.scripting.javascript:3.1.4]
	at org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine.eval(RhinoJavaScriptEngine.java:155) [org.apache.sling.scripting.javascript:3.1.4]
	at org.apache.sling.scripting.api.AbstractSlingScriptEngine.eval(AbstractSlingScriptEngine.java:44) [org.apache.sling.scripting.api:2.2.0]
	at java.scripting/javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:231)
	at io.uhndata.cards.forms.internal.ExpressionUtilsImpl.toJavaScriptObject(ExpressionUtilsImpl.java:79) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	at io.uhndata.cards.forms.internal.ExpressionUtilsImpl.lambda$evaluate$0(ExpressionUtilsImpl.java:104) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	at java.base/java.util.HashMap.forEach(HashMap.java:1429)
	at io.uhndata.cards.forms.internal.ExpressionUtilsImpl.evaluate(ExpressionUtilsImpl.java:103) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	at io.uhndata.cards.forms.internal.ComputedAnswersEditor.computeAnswer(ComputedAnswersEditor.java:183) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	at io.uhndata.cards.forms.internal.ComputedAnswersEditor.lambda$handleLeave$3(ComputedAnswersEditor.java:169) [io.uhndata.cards.data-model-forms-impl:0.9.36.SNAPSHOT]
	...

05.01.2026 14:30:04.127 *ERROR* [127.0.0.1 [1767641403924] POST /Forms/cbae45fb-e7b0-4493-a2ce-f30844f2b3c4 HTTP/1.1] io.uhndata.cards.forms.internal.ExpressionUtilsImpl Could not parse Long from class org.mozilla.javascript.NativeNumber
05.01.2026 14:30:04.128 *ERROR* [127.0.0.1 [1767641403924] POST /Forms/cbae45fb-e7b0-4493-a2ce-f30844f2b3c4 HTTP/1.1] io.uhndata.cards.forms.internal.ExpressionUtilsImpl Could not parse Long from class org.mozilla.javascript.NativeNumber
05.01.2026 14:30:04.132 *ERROR* [127.0.0.1 [1767641403924] POST /Forms/cbae45fb-e7b0-4493-a2ce-f30844f2b3c4 HTTP/1.1] io.uhndata.cards.forms.internal.ExpressionUtilsImpl Could not parse Long from class org.mozilla.javascript.NativeNumber

@veronikaslc
Copy link
Contributor

ReadME file prereqs has to be adjusted: Java and Maven versions

@sdumitriu sdumitriu force-pushed the CARDS-2820-java-21 branch 2 times, most recently from 133e9a6 to 58f7581 Compare January 6, 2026 00:40
@sdumitriu sdumitriu force-pushed the CARDS-2820-java-21 branch 4 times, most recently from da950a4 to 065acdf Compare January 12, 2026 21:26
Convert code relying on Nashorn to run on Rhino
Copy link
Contributor

@acrowthe acrowthe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Tested:

  • Docker builds
  • Your Experience Inpatient patient portal
  • Data import
  • Emails
  • Backend computed questions (including additional tests from #2200)
  • Locking
  • Vocabularies

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants