3 Replies Latest reply on Oct 29, 2003 4:43 PM by Frank Griffin

    Jetty Init fails under JBoss 3.2.1 on IBM z/OS USS

    Frank Griffin Novice

      In trying to run JBoss on IBM's z/OS Unix System Services, Jetty startup is failing because of ASCII/EBCDIC conflicts. USS uses a native filesystem encoding of Cp1047 (EBCDIC), and the JBoss distribution files are in ASCII.

      For the most part, this works. The bin/*.sh and bin/run.conf have to be translated to EBCDIC because they are read by the shell, but Xerces seems to handle the ASCII (UTF-8) XML files in server/default/conf correctly (in fact it fails if you pre-translate them to EBCDIC).

      The error appears to be in org.jboss.jetty.Jetty. The code in setConfigurationElement() uses an XSLT transform to create a StreamResult based on a ByteOutputArrayStream. When it's done, it converts the bytes to a String using ByteArrayOutputStream.toString(). The problem is that the conversion assumes that the bytes use the default platform encoding, which is Cp1047. In fact, they are (probably) UTF-8, so the conversion produces garbage.

      There are two ways to approach this. I don't understand why the code doesn't just base the StreamResult on a String directly, since the ByteArrayOutputStream doesn't appear to be used for anything other than conversion to a String. This would keep everything in the UTF-8/Unicode "family", i.e.
      instead of
      ByteArrayOutputStream stream = new ByteArrayOutputStream();
      StreamResult result = new StreamResult (stream);
      transformer.transform (source, result);
      _xmlConfigString = stream.toString();
      StreamResult result = new StreamResult( _xmlConfigString );
      transformer.transform( source, result );

      But if there is some reason to want to use the bytestream, the toString() should be replaced with a toString( "UTF8" ), since that is what the transform is producing.

      I'd like to get this to work, since my company is interested in using JBoss on z/OS with DB2 as a JDBC DataSource. I'll try my suggested fix, and post the results. Is this the proper forum to get this addressed ?