Check the tomcat app.log in case of unexpected error

If you encounter some unexpected error with your web app, the best place to check what’s wrong is Tomcat’s app.log file.

1. Firstly, ssh to the server containing your app:

$ssh -A xxx.dev.XXX ( you can set shortcuts like in this file  ~/.ssh/config)

2. Get the root access

$sudo su –

3. Get the tail of the log. Tail command is useful to see the latest log entries and -f helps to keep refreshing it.

$tail -f app.log

Then replicate the bug, you should see the error message there. It can be null pointer exception for instance.

Advertisements

2 ways of binding data to JSP

There are 2 ways of binding data to the JSP.

  1. Using JSTL. JSTL can help to retrieve the data from the server and populate it in the JSP. But the issue is that we can’t dynamically add the html elements inside the JSP.
  2. Using Handlebars. We can get the data from ajax calls inside the JS, then add it to handlebar then append the handlebar to JSP. This way allows us to add multiple elements and make the page dynamic. Remember to compile the handlebar inside the JS

 

tags: jsp, javascript, jsp data binding

Resetting and repopulating the elastic search on local

  1. vagrant up – this will start vagrant vm
  2. vagrant ssh – this will connect to the image
  3. sudo salt-call state.sls elasticsearch.reset_es_data – this will reset all data in elastic search
  4. go to http://local-ccpm.sls.ufinity.com/elasticsearch/reindex – and then click all the link. this will repopulate all the elastic search data on the local image.

The reason this might be needed is that you can get I/O exception while trying to test the assign activity