You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot convert "1682293037722628098'(1anguage: Java, type: com.oracle.truffle.api.strings.Trufflestring) to Java type "java.lang .0bject[]':Unsupported target type
#9438
Open
dandelion2 opened this issue
Aug 2, 2024
· 3 comments
While compiling a JavaScript script using GraalVM, we've encountered an intermittent issue when calling a Java interface with variable arguments defined as follows:
java
public Object queryForMap(final String sql, Object ... args);
The corresponding JavaScript call to the method is structured like this:
javascript
const selectSql = "select code, product_id as productId, ts_storage_id as tsStorageId from device where id = ?";
const deviceInfo = jdbcClient.queryForMap(selectSql, "1682293037722628098");
Initially, the script execution occasionally results in the error: "Cannot convert '1682293037722628098' to Java type 'java.lang.Object[]': Unsupported target type." Interestingly, after several attempts, the issue does not consistently manifest, making it difficult to reproduce.
The text was updated successfully, but these errors were encountered:
Thank you for reaching out to us.
Could you please share the version of GraalVM you're using, your OS, your system's architecture and a concise reproducer alongside the steps needed to reproduce the issue?
I understand that the execution of the script multiple times may end up leading to the issue not manifesting consistently but we still need it to test nevertheless.
The version of GraalVM I am using is graalvm-ce-java11-linux-amd64-22.3.1. The reproduction script, with business processing logic removed, is as follows:
Java code:
// Query the database
public Map<String, Object> queryForMap(final String sql, Object ... args) {
if (StringUtils.isBlank(sql)){
throw new DandelionException("mysql queryForMap error, SQL must not be null");
}
// SQL validation
checkSql(sql);
try {
return jdbcTemplate.queryForMap(sql, args);
} catch (EmptyResultDataAccessException e){
return null;
} catch (Exception e) {
throw new DandelionException("mysql queryForMap error," e.getMessage(), e);
}
}
// Register Java object
context.eval("js", "var jdbcClient = Java.type('com.example.JsJdbc').create()");
JavaScript code:
const selectSql = "SELECT code, product_id as productId, ts_storage_id as tsStorageId FROM device WHERE id = ?";
const deviceInfo = jdbcClient.queryForMap(selectSql, "1682293037722628098");
While compiling a JavaScript script using GraalVM, we've encountered an intermittent issue when calling a Java interface with variable arguments defined as follows:
java
public Object queryForMap(final String sql, Object ... args);
The corresponding JavaScript call to the method is structured like this:
javascript
const selectSql = "select code, product_id as productId, ts_storage_id as tsStorageId from device where id = ?";
const deviceInfo = jdbcClient.queryForMap(selectSql, "1682293037722628098");
Initially, the script execution occasionally results in the error: "Cannot convert '1682293037722628098' to Java type 'java.lang.Object[]': Unsupported target type." Interestingly, after several attempts, the issue does not consistently manifest, making it difficult to reproduce.
The text was updated successfully, but these errors were encountered: