CMDBuild Forum

Stacktrace when creating a new card

Dear tecnoteca team,

I’ve upgraded my cmdbuild ready2use installation to the latest version available on SourceForge READY2USE 2.3-a-4.1.0).

Whenever the system needs to retrieve cards from a different class (domains) using webservices it fails with a stacktrace.

I’m not sure what I’m missing here.

I’m attaching the stacktrace I find in cmdbuild.log file.

I’m running
Ubuntu 24.04
OpenJDK 17
READY2USE 2.3-a-4.1.0

Many thanks in advance

Alex
stacktrace.txt (108.7 KB)

Dear team,

after some testing I found that the problem is related to filters specified on attributes in classes, e.g.

from Floor where Id in (/(select filter_cql_floor(0{client:Complex.Id},0{client:Building.Id}))/)

(to retrieve only the floors that belong to a given Complex and Building)

As soon as there is such a filter the edit form fails because the requests send to the backend contain a filter part:
/cmdbuild/services/rest/v3/classes/Floor/cards?_dc=1762433517373&attrs=Id%2CDescription%2CCode&positionOf=98564
&filter=%7B%22ecql%22%3A%7B%22id%22%3A%221kpo50n3y230ezume2pywttnt8b%22%2C%22context%22%3A%22%7B%5C%22client%5C%22%3A%7B%5C%22Complex.Id%5C%22%3A97920%2C%5C%22Building.Id%5C%22%3A98224%7D%2C%5C%22server%5C%22%3A%7B%7D%7D%22%7D%7D
&page=1&start=0&limit=500&sort=%5B%7B%22property%22%3A%22Building%22%2C%22direction%22%3A%22ASC%22%7D%2C%7B%22property%22%3A%22Level%22%2C%22direction%22%3A%22ASC%22%7D%5D

when I remove the filter part from the request, it works fine.

So, is there a new approach to specify the filters for the attributes or what is needed to add support for com.oracle.truffle.js.scriptengine.GraalJSScriptEngine to the environment?

Many thanks in advance

Alex

Dear team,

so in order to figure out what the problem is, I went ahead and installed a clean VM:
Ubuntu 24.04
OpenJDK 17
PostgreSQL 17
Tomcat 10

I downloaded the ready2use-2.4-4.1.0.war file and installed/configured it using the browser.
I pointed it to the database, I picked DEMO as type and then I logged in to cmdbuild.

In a clean install, with a sample DEMO database the problem also occurs, e.g. on the Room card.

On the floor attribute in the Room card there is filter:
from Floor where Id in (/(select filter_cql_floor(0{client:Complex.Id},0{client:Building.Id}))/)

and this filters causes the problem.

I suppose, I’m not the first one to migrate to 2.4-4.1.0 and I suppose I’m not the only one in the world using filters on class attributes. So this problem must already have been identified and solved I suppose.

Could anyone please, provide a walkaround or fix for the problem? Something must be configured to get rid on the
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.truffle.js.scriptengine.GraalJSScriptEngine
exception.

When I look in the WEB-INF/lib folder in the deployed webapp, I sell (all?) jar files that I would relate to:
-rw-r----- 1 tomcat tomcat 121973 Jan 31 2025 collections-24.1.2.jar
-rw-r----- 1 tomcat tomcat 17696710 Jan 31 2025 icu4j-24.1.2.jar
-rw-r----- 1 tomcat tomcat 275640 Jan 31 2025 jniutils-24.1.2.jar
-rw-r----- 1 tomcat tomcat 26174568 Jan 31 2025 js-language-24.1.2.jar
-rw-r----- 1 tomcat tomcat 70011 Jan 31 2025 js-scriptengine-24.1.2.jar
-rw-r----- 1 tomcat tomcat 226628 Jan 31 2025 nativeimage-24.1.2.jar
-rw-r----- 1 tomcat tomcat 479963 Jan 31 2025 polyglot-24.1.2.jar
-rw-r----- 1 tomcat tomcat 3565453 Jan 31 2025 regex-24.1.2.jar
-rw-r----- 1 tomcat tomcat 12855659 Jan 31 2025 truffle-api-24.1.2.jar
-rw-r----- 1 tomcat tomcat 62013 Jan 31 2025 truffle-compiler-24.1.2.jar
-rw-r----- 1 tomcat tomcat 1160432 Jan 31 2025 truffle-runtime-24.1.2.jar

I can’t find any indication in a documentation explaining what to do.

Many thanks in advance,

Alex

Hello,

please check the log files to better understand the cause of the error.
You can look in:

  • the cmdbuild.log file inside the logs directory of your Tomcat installation
  • the catalina.out log for any Java-related stack traces

It’s also very important to verify which Java version is used to run Tomcat, since using an unsupported or incompatible Java version may cause errors like this.

Best regards,
Tecnoteca Team

Hello,

I did check the log files (cmdbuild.log) where I extracted the stacktrace from my initial posting and where I found the message about:
Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.oracle.truffle.js.scriptengine.GraalJSScriptEngine

As I noted, I’m also using Java 17 as indicated in the requirements for ready2use-2.4-4.1.0 together with a tomcat 10.

Saturday evening I ran a clean install using
java -jar cmdbuild.war install
on a clean VM at home.
It turned out that this installation failed because of the the Java module system, so I figured out I needed to add
–add-opens=java.base/java.nio=ALL-UNNAMED
to make the installer run.

After installation it turned out that the clean cmdbuild worked fine (using demo DB), the filters were not failing.

I then noticed that when you install tomcat, you are setting CATALINA_OPTS in setenv.sh
CATALINA_OPTS="$CATALINA_OPTS --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED"
that are also related to Java modules.

I then tried to transpose those options to my tomcat server running as a service and it seems that I had to add those options as JAVA_OPTS in tomcat.service
Environment=“JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom --add-opens=java.base/java.nio=ALL-UNNAMED --add-opens=java.base/sun.reflect.generics.reflectiveObjects=ALL-UNNAMED --add-opens=java.base/java.util.stream=ALL-UNNAMED --add-opens=java.base/jdk.internal.loader=ALL-UNNAMED”

in addition to all the other JAVA_OPTS already set in catalina.sh in order to make everything work fine.
Apparently, when running tomcat as service, the options do not work when they are added to CATALINA_OPTS.

As of this writing, everything seems to work fine, here is my setup:
Ubuntu 24.04 (6.8.0-85-generic)
Tomcat 10.1.48
OpenJDK 17.0.16+8
postgresql 17.6 (Ubuntu 17.6-2.pgdg24.04+1) with postgis
ready2use-2.4-4.1.0.war
Alfresco Content Services Community 25.3.0-A.13

Cheers,

Alex

Hello,

finally, there is one more thing you need to pay attention to … if you run tomcat as a service, the user that runs the service (usually tomcat) MUST have a home directory because the
com.oracle.truffle.js.scriptengine.GraalJSScriptEngine

stuff seems to write a cache folder (.cache) into the home folder of the user running tomcat. Actually there are 2 folders being created:
.cache
.java

If you defined the user without home directory (and shell) the system will look for a /nonexistent directory and of course that directory does not exist.

Of course you can also create a “nonexistent” folder at the root of the FS and chown that folder to user who runs tomcat …

Alex