Posts

Showing posts from August, 2014

Web app root system property already set to different value: 'webapp.root'

<context-param>     <param-name>webAppRootKey</param-name>     <param-value>{project name and version}</param-value>    </context-param> Add this to Web.xml and this will fix the issue. Replace the value with project name and version number. Happy Coding.

Illegal character(s) in message header value

Recently was trying to consume a Rest Web Service by passing AES256 encrypted values in header Params and hit the above exception. java.lang.IllegalArgumentException: Illegal character(s) in message header value: After a little bit of resaerch i found that it is a bug with java while using BASE64 Encoded String.If the string length exceeds 76 characters, the Base64Encoder adds a "\n" character. While trying to sent it in header it fails complaining about the "\n" in the Base64 encoded string. This is actually a bug with JAVA http://bugs.java.com/bugdatabase/view_bug.do?bug_id=6459815 The fix is String encodeMe = m_username + ":" + m_sToken; BASE64Encoder encoder = new BASE64Encoder(); String base64Encoded = encoder.encode(encodeMe.getBytes()); //!Important! - Get rid of any newline characters erroneously // added by the Base64Encoder base64Encoded = base64Encoded.replaceAll(...