I need to access an internal class from nashorn inside a web application running in WildFly.
The following code is working fine in my machine:
public class NashornTest {
public static void main(String[] args) throws ClassNotFoundException {
Class<?> cls = Class.forName("jdk.nashorn.internal.objects.ScriptFunctionImpl");
System.out.println(cls);
}
}
But the following servlet is throwing a ClassNotFoundException when I run inside WildFly:
@WebServlet("/nashorn")
public class NashornServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Class<?> cls = null;
try {
cls = Class.forName("jdk.nashorn.internal.objects.ScriptFunctionImpl");
} catch (ClassNotFoundException e) {
throw new ServletException(e);
}
}
}
Here's the server log: https://gist.github.com/csokol/b81633bdbfa09bb55e2b