Getting exception "Illegal character(s) in message header value" while using camel route

Solution Verified - Updated -

Issue

  • I am migrating from fuse 6.1 to 6.3. When I am loading properties file in camel route header and calling the restful web service, I am ending with following exception

  • Code

 exchange.getIn().setHeader("MESSAGES", new Properties().load(new FileInputStream("filepath.properties"));
  • Exception
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:1.8.0_111]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[:1.8.0_111]
Caused by: java.lang.IllegalArgumentException: Illegal character(s) in message header value: {rol.ussd.msg.confirmoffence=1 Confirm
2 Another ticket}
    at sun.net.www.protocol.http.HttpURLConnection.checkMessageHeader(HttpURLConnection.java:541)[:1.8.0_111]
    at sun.net.www.protocol.http.HttpURLConnection.isExternalMessageHeaderAllowed(HttpURLConnection.java:492)[:1.8.0_111]
    at sun.net.www.protocol.http.HttpURLConnection.setRequestProperty(HttpURLConnection.java:3057)[:1.8.0_111]
    at org.apache.cxf.transport.http.Headers.transferProtocolHeadersToURLConnection(Headers.java:385)

Environment

  • Red Hat JBoss Fuse
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.