ClassCastException NativeRegExpExecResult cannot be cast to NativeArray
Jim Laskey (Oracle)
james.laskey at oracle.com
Tue Dec 15 16:24:58 UTC 2015
At first glance it doesn’t seem to be thread related. We’ll poke at it but it would be helpful if you reduced the problem.
> On Dec 15, 2015, at 11:53 AM, Stijn de Witt <stijndewitt at hotmail.com> wrote:
> Dear fellow developers,
> I have two concrete questions and a problem (which caused the questions):
> 1. Can a Nashorn engine be used across threads (using ScriptContext or Bindings for isolation)?2. Is there a good example of using Nashorn from a Servlet Filter?
> My problem:
> I am struggling with server-side rendering of React components using Nashorn. I am deploying to OpenShift and whenever I try to make my app listen to the rout route, I run into a weird ClassCastException somewhere inside the Nashorn code. I now think this is due to a heartbeat request OpenShift's haproxy is doing on my app that is causing (relatively) high load and triggering a concurrency problem... This leads me to believe I am doing something wrong in the way I create the script engine and using script contexts in a ThreadLocal to isolate the different threads.
> I have formulated my question, including logs and relevant code, on StackOverflow.com.http://stackoverflow.com/questions/34276136/classcastexception-nativeregexpexecresult-cannot-be-cast-to-nativearray
> Could one of you maybe have a look at my situation, specifically my servlet filter code and tell me if I am doing it wrong and if so, what I should change?(I tried instantiating a different engine per thread and saving them in a ThreadLocal, but this leads to OutOfMemory errors quickly)
> Thank you for any tips, pointers to docs etc that you could spare.
> With kind regards,
> Stijn de Witthttp://stijndewitt.wordpress.com
More information about the nashorn-dev