RHINO USAGE WARNING: Missed Context.javaToJS() conversion | Community
Skip to main content
RashidJorvee
Level 4
August 19, 2024

RHINO USAGE WARNING: Missed Context.javaToJS() conversion

  • August 19, 2024
  • 3 replies
  • 1531 views

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.

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

h_kataria
Community Advisor
Community Advisor
August 19, 2024

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. 

RashidJorvee
Level 4
August 23, 2024

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.

 

MukeshYadav_
Community Advisor
Community Advisor
August 19, 2024

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

 

 

kautuk_sahni
Community Manager
Community Manager
August 21, 2024

@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