2
votes

I am running httpd + mod_jk + 2 tomcat servers in Ubuntu. When I submit a form in a non-Latin language I get garbage in the DB. If I submit the same form through Tomcat directly bypassing httpd everything looks good. following is my configuration:

/etc/apache2/conf.d/charset:

AddDefaultCharset UTF-8

tomcat1:

< Connector port="8080" protocol="AJP/1.3" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" />

tomcat2:

< Connector port="9080" protocol="AJP/1.3" connectionTimeout="20000" redirectPort="9443" URIEncoding="UTF-8" />

JDBC connection:

jdbc:mysql://localhost:3306/myapp?useEncoding=true&characterEncoding=UTF-8

/etc/apache2/mods-available/jk.conf (the same file I set up my loadbalancer)

JkOptions +ForwardURICompatUnparsed

Am I missing something? Thank You!

2
The problem appears only when I use doGet http calls, If I use doPost the character encoding seems to work fine.Meir Winston

2 Answers

4
votes

I found my problem, I mixed up the HTTP connector with the AJP connector which was declared twice in Tomcat's server.xml . The second declaration did not even include the attribute URIEncoding.

2
votes
<Connector URIEncoding="UTF-8" port="8009" protocol="AJP/1.3" connectionTimeout="10000" keepAliveTimeout="10000" redirectPort="8443"/>

work fine for me