Search This Blog

Friday, February 5, 2016

Character Encoding Changes in Tomcat 8 for GET Requests

HTTP GET requests (url+parameters) are treated as ASCII characters by default. Non-ASCII values, however, need to be converted to ASCII by using escape sequences. 

This conversion behavior has been changed in Tomcat 8:
  • Before Tomcat 8 the default character encoding of the entire GET request was ISO-8859-1, so if your request contains UTF-8 characters (which is very common) you need to manually decode the escaped (ASCII) text back to UTF-8.
  • Starting with Tomcat 8 the entire GET request is treated as UTF-8 by default but this can be changed to conform with the servlet specification.

Friday, January 22, 2016

Quick and Dirty jstatd Setup on Linux

What is jstatd?


"The jstatd tool is an RMI server application that monitors for the creation and termination of instrumented HotSpot Java virtual machines (JVMs) and provides a interface to allow remote monitoring tools to attach to JVMs running on the local host." [source]

NOTE: jstatd is not required for JMX connections;

How to setup jstatd on a Linux server?

A) login as root (told you - it's dirty)

B) create the jstatd.all.policy file in the home folder (/root) with the following content: 

   grant codebase "file:/opt/jdk1.8.0_45/lib/tools.jar" {

     NOTE: don't forget to change the path of the JDK

C) run jstatd:

   ./jstatd -p 1099

      -p                                         listen port for jstat daemon             policy file to use (created above)     use IPv4 (optional if IPv6 not used)
      java.rmi.server.hostname    listen on this interface (optional)

      NOTE: add & to run jstatd in background 

D) now you should be able to monitor this server using VisualVM.