Skip to main content

GlassFish 3.1.1 - Encoding error

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2013-09-09

I have an error with the encoding of Glassfish 3.1.1, maybe someone can help me.

I have created restful web services with EJB stateless session beans and then I deployed those at glassfish. I have created some services that can add, update or delete objects.

The problem is that the service fails when I try to add or update content of the database that has accents or other specials characters.

And the same error happens when I call an external web service. If I call that external web service from soapui, for example, it returns all the special characters ok, but if I call that external web service from my web service deployed at glassfish (which only behavies like a pass through) it returns those special characters badly encoded, these show up as a question mark inside of a black diamond.

I have checked that each web service has charset=utf-8:
@Consumes({"application/json; charset=utf-8","application/xml; charset=utf-8"})
@Produces({"application/json; charset=utf-8","application/xml; charset=utf-8"})

And the MySQL database has utf-8 set as default.

I put -Dfile.encoding = UTF8 at the JVM settings, but the problem persists.

I appreciate any suggestion.