Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

RHINO USAGE WARNING: Missed Context.javaToJS() conversion

Avatar

Level 5

In AEM 6.5 publisher instance, stdout.log file has millions on entries "RHINO Usage" as below. In general it means any value that are coming from Java object is directly use in JavaScript. But, here my question is, how to identify the code in our repository that is causing this issue? there is no hint or linenumber, class name, function name from where this is getting fired.  Any suggestion or input will be highly appreciated. Thank you!

 

RHINO USAGE WARNING: Missed Context.javaToJS() conversion:
Rhino runtime detected object [Ljava.lang.Object;@435ab8dc of class [Ljava.lang.Object; where it expected String, Number, Boolean or Scriptable instance. Please check your code for missing Context.javaToJS() call.

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

4 Replies

Avatar

Community Advisor

Can you check your error logs as well ? There might be some more details present there.
Otherwise, you can try enabling debug log for org.apache.sling.scripting.javascript on some lower environment where the issue is reproducible.
That should ideally give you all the details you need. 

Avatar

Level 5

There is no related entry in error log. But when I enable the log for package I could see these entries.

23.08.2024 13:20:47.351 *DEBUG* [ [] GET /content/en/login.html HTTP/1.1] org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine Detected cached script for /libs/wcm/foundation/components/image/image.js.
23.08.2024 13:20:47.351 *DEBUG* [ [] GET /content/en/login.html HTTP/1.1] org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine Detected cached script for /libs/wcm/foundation/components/utils/AuthoringUtils.js.
23.08.2024 13:20:47.352 *DEBUG* [ [] GET /content/en/login.html HTTP/1.1] org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine Detected cached script for /libs/wcm/foundation/components/utils/Image.js.
23.08.2024 13:20:47.352 *DEBUG* [ [] GET /content/en/login.html HTTP/1.1] org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine Detected cached script for /libs/sightly/js/3rd-party/q.js.
23.08.2024 13:20:47.355 *DEBUG* [ [] GET /content/en/login.html HTTP/1.1] org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine Detected cached script for /libs/wcm/foundation/components/utils/ResourceUtils.js.
23.08.2024 13:20:47.356 *DEBUG* [ [] GET /content/en/login.html HTTP/1.1] org.apache.sling.scripting.javascript.internal.RhinoJavaScriptEngine Detected cached script for /libs/sightly/js/3rd-party/q.js.

Then I clear the all cache script using console [http://localhost:4503/system/console/scriptcache], then, these files again got cached and I am still seeing the same this in logs. No change in behavior.

Now, one things is sure, these are not error. But how we can restrict the system to stop appending this log in stdout.log file? @kautuk_sahni could you look or check internally.

 

Avatar

Community Advisor

Hi,

As error suggest Rhino is expecting a String, Number, Boolean, or Scriptable instance, but it received an array of objects ([Ljava.lang.Object;) instead.

You may try to search javaToJS or Scriptable or Rhino in repo and check where  Object[] arrayObj = { "s1", 42, true }; i.e. Array of object is passed

 

Thanks

 

 

Avatar

Administrator

@RashidJorvee Did you find the suggestions from users helpful? Please let us know if you require more information. Otherwise, please mark the answer as correct for posterity. If you've discovered a solution yourself, we would appreciate it if you could share it with the community. Thank you!



Kautuk Sahni