Search code examples
magnolia

JS Model Detailed Errors


I am using a JavaScript model to call a Java class and return results from a database. When there is an error eg. DB server down, I can see the error details in the tomcat output screen on windows but the errors are not stored in Catalina.out or Magnolia-debug log files.

On linux where tomcat runs as a service, there is no output screen so I cannot see the exact error. I can only see invalid reference exception or cannot instantiate JS model.

How / where is it possible to see the exact errors encountered by the model? eg. could not establish DB connection, expired passowrd or whatever detailed error there is?


Solution

  • It could have many causes, eg issue with logs after log rotation (known problem of log4j), printing exception from JS instead of from java, the java code not logging it correctly, etc. Also check that your model follows wiki.openjdk.org/display/Nashorn/Nashorn+extensions and encapsulates errors properly and prints them out to logs correctly.