5

I am encountering the above error in production environment whereas the process went fine in UAT.

I was wondering whether this error is related to jar file loading. We are using webmethods and the above error occurred for a java service.

abhijith501
  • 79
  • 1
  • 1
  • 7
  • Can you please give more information? Perhaps a complete stack trace, maybe some code, maybe a sample file? Also if you could figure out where in the sample file the invalid character is detected... Finally try to propagate the production file to UAT and see if the error persists – durron597 Oct 26 '12 at 17:14
  • ah kom craquelé turq 12cm The above xml is parsed in UAT while the same file is failing in Production... – abhijith501 Oct 30 '12 at 14:35
  • 1
    I have found the exact cause of this issue.. The thing is the locales and default character present in production and the acceptance is different.. I have used this String deEncoding= ""+Charset.defaultCharset();String locale=""+Locale.getDefault(); to find the locales .. The encodings and locales are different.. i have hardcoded the value UTF-8 in byteArray = inputInXML.getBytes("UTF-8"); and the result is success – abhijith501 Nov 14 '12 at 10:17
  • http://stackoverflow.com/q/15545720/923560 – Abdull Feb 03 '16 at 15:01

2 Answers2

7

The most likely scenario is that the file is ISO-8859-1 encoded and contains extended ASCII (characters between 0x80 and 0xff inclusive). The parser is expecting UTF-8 and one of the extended characters is being interpreted as the start of a 3-byte sequence, but is not followed by a byte that is valid in that position.

Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
  • 3
    I have found the exact cause of this issue.. The thing is the locales and default character present in production and the acceptance is different.. I have used this String deEncoding= ""+Charset.defaultCharset();String locale=""+Locale.getDefault(); to find the locales .. The encodings and locales are different.. i have hardcoded the value UTF-8 in byteArray = inputInXML.getBytes("UTF-8"); and the result is success – abhijith501 Nov 14 '12 at 10:16
0

The xml file you load is not correctly encoded: take a look at the production environment files, at least one is not UTF-8.

Aubin
  • 14,617
  • 9
  • 61
  • 84
  • Thanks for the reply.. i have checked all the files and all are UTF-8 encoded... I have a doubt regarding jar files.. Does this exception relate to jars.. – abhijith501 Oct 26 '12 at 17:14
  • Are the jars the same in production and in test? Look at the differences between two envs. A jar may contains an XML file parsed at run-time. – Aubin Oct 26 '12 at 18:39
  • castor-xml-schema-1.2.jar what is the use of this jar file. – abhijith501 Oct 30 '12 at 14:49
  • Castor provides Java-to-XML binding, Java-to-SQL persistence, and more. – Aubin Oct 30 '12 at 15:52
  • Extract its contents in a directory, add it to classpath, remove the jar from classpath, run again and paste the full exception stack and perhaps we may help you... – Aubin Oct 30 '12 at 18:03
  • I have found the exact cause of this issue.. The thing is the locales and default character present in production and the acceptance is different.. I have used this String deEncoding= ""+Charset.defaultCharset();String locale=""+Locale.getDefault(); to find the locales .. The encodings and locales are different.. i have hardcoded the value UTF-8 in byteArray = inputInXML.getBytes("UTF-8"); and the result is success – abhijith501 Nov 14 '12 at 10:11