IBM Support

Getting error sun.io.MalformedInputException when entering accented characters to HTTPPOST sample from MQ V7 Bridge for HTTP, using Linux

Troubleshooting


Problem

You are using a Linux system and you have installed the WebSphere MQ V7 Bridge for HTTP servlet in an application server. Then you run the HTTPPOST sample using English characters and it works fine. However, when you run it again and try to enter accented characters (áÁ-ñ-ü-¡!-¿?), you get an error:

Symptom

$ cd /opt/mqm/java/http/samples
$ java -classpath . HTTPPOST  HTTPTESTQ hostname.x.com:9080 mq
HTTP POST Sample start
Target server       is 'hostname.x.com:9080'
Target queue        is 'HTTPTESTQ'
Target context-root is 'mq'
áÁ-ñ-ü-¡!-¿?
Failed to POST a message to
http://hostname.x.com:9080/mq/msg/queue/HTTPTESTQ sun.io.MalformedInputException at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java(Compiled Code)) at sun.nio.cs.StreamDecoder$ConverterSD.convertInto(StreamDecoder.java:287) at sun.nio.cs.StreamDecoder$ConverterSD.implRead(StreamDecoder.java:337) at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:223) at java.io.InputStreamReader.read(InputStreamReader.java:208) at java.io.BufferedReader.fill(BufferedReader.java:153) at java.io.BufferedReader.readLine(BufferedReader.java:316) at java.io.BufferedReader.readLine(BufferedReader.java:379) at HTTPPOST.readLine(Unknown Source) at HTTPPOST.sendMessagesFromConsole(Unknown Source) at HTTPPOST.main(Unknown Source)

Cause

You are using Java™ 1.4.2 and the locale is: en_US.UTF-8:

$ java -version
java version "1.4.2"

$ locale
LANG=en_US.UTF-8

Resolving The Problem

This section offers a workaround and a permanent solution:

a) Workaround - you can keep Java 1.4.2, but you have to modify the locale as follows:


$ export LANG=en_US
$ locale
LANG=en_US

b) Permanent solution: you need to upgrade your Java from 1.4.2 to a most recent version, such as 1.6.
To download the IBM Java, visit:
http://www.ibm.com/developerworks/java/jdk/
IBM developer kits

+ Running the sample without exceptions

$ java -classpath . HTTPPOST  HTTPTESTQ hostname.x.com:9080 mq
HTTP POST Sample start
Target server       is 'hostname.x.com:9080'
Target queue        is 'HTTPTESTQ'
Target context-root is 'mq'
áÁ-ñ-ü-¡!-¿?

HTTP POST Sample end

[{"Product":{"code":"SSFKSJ","label":"WebSphere MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Java","Platform":[{"code":"PF016","label":"Linux"}],"Version":"9.0;8.0;7.5;7.1;7.0","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}},{"Product":{"code":"SSYHRD","label":"IBM MQ"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":" ","Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Product Synonym

IBMMQ WebSphere MQ WMQ

Document Information

Modified date:
15 June 2018

UID

swg21567375