Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 91425 invoked from network); 9 Aug 2005 12:23:06 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 9 Aug 2005 12:23:06 -0000 Received: (qmail 17311 invoked by uid 500); 9 Aug 2005 12:23:04 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 17294 invoked by uid 500); 9 Aug 2005 12:23:04 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 17281 invoked by uid 99); 9 Aug 2005 12:23:04 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Aug 2005 05:23:04 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [198.136.201.198] (HELO dnsmail3.umb.com) (198.136.201.198) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Aug 2005 05:23:26 -0700 Received: from y8107a.umb.corp.umb.com (viruswall2.umb.com [192.168.3.213]) by dnsmail3.umb.com (8.12.10+Sun/8.12.11) with ESMTP id j79CN045010699 for ; Tue, 9 Aug 2005 07:23:00 -0500 (CDT) Received: from y6005a.umb.corp.umb.com ([172.19.43.34]) by y8107a.umb.corp.umb.com with InterScan Messaging Security Suite; Tue, 09 Aug 2005 07:22:59 -0500 X-MimeOLE: Produced By Microsoft Exchange V6.0.6603.0 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Subject: FW: Content is not allowed in prolog Date: Tue, 9 Aug 2005 07:22:59 -0500 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Content is not allowed in prolog Thread-Index: AcV3Q9tzEa8lGQTSSiCAXyMcCmD9ZAll5Ftw From: "Mitchell, Steven C" To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N The cause of the "Content is not allowed in prolog" error we had on AIX turned out to be a bad application properties file on that box. The property specifying the location of the sql mapping config file got run together with a comment line above it. My theory is that when the property value was unsuccessfully substituted in the dao.xml file, the bad sql mapping config file location was given to the parser which resulted in the misleading "Content is not allowed in prolog" error. It was not that it couldn't parse the sql config mapping file, it actually couldn't find it. I don't know why we didn't see a different error message. We opened a ticket with IBM while we tried to figure this out. IBM had the following say about the iBatis code. Although IBM was mistaken about the cause of the error, they pointed out some things about the iBatis code that might be worth looking into: "I've taken a deeper look and it appears that iBatis is at fault.=20 In the PMR log I noticed the following trace:=20 [6/21/05 9:33:41:994 CDT] 53749a3f WebGroup E SRVE0026E: [Servlet=20 Error]-[Error while configuring DaoManager. Cause:=20 com.ibatis.common.exception.NestedRuntimeException: Error occurred.=20 Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.=20 Cause: org.xml.sax.SAXParseException: Content is not allowed in prolog.=20 Caused by: org.xml.sax.SAXParseException: Content is not allowed in=20 prolog.=20 Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Content is not allowed in prolog.=20 .=20 6/22/05 13:27:46:202 CDT] 55951fa2 RequestProces W=20 org.apache.struts.action.RequestProcessor Unhandled Exception thrown:=20 class com.ibatis.dao.client.DaoException=20 and then found the source (in Apache) in the com.ibatis.common.xml.NodeletParser [1] class which throws the com.ibatis.common.xml.NodeletException [2]. NodeletParser, specifically the method NodeletParser.createDocument(Reader) passes a java.io.Reader to the parser as an input. This is the problem. When the parser reads from an InputStream or from a URL it determines the encoding of the document from the XML declaration (i.e. ) and then chooses the appropriate = java.io.Reader to use for that encoding. iBatis doesn't give the parser the chance to pick the proper java.io.Reader for the document since it provides the Reader directly.=20 The java.io.Reader which is passed to the parser is a java.io.InputStreamReader created by com.ibatis.common.resources.Resources [3] from SqlMapConfigParser.addSqlMapNodelets() [4]. The javadoc for the constructor of InputStreamReader [5] which the Resources class uses says: "Create an InputStreamReader that uses the default charset." I guess this is working on Windows because the default encoding just happens to be the same as (or is compatible with) the encoding of the document. On AIX it would seem like this is not the case, so it fails. Because the default encoding varies from platform to platform creating an InputStreamReader with the default encoding is always a bug waiting to happen.=20 [1] http://svn.apache.org/viewcvs.cgi/ibatis/trunk/java/mapper/mapper2/src/c om/ibatis/common/xml/NodeletParser.java?rev=3D180318&view=3Dmarkup=20 [2] http://svn.apache.org/viewcvs.cgi/ibatis/trunk/java/mapper/mapper2/src/c om/ibatis/common/xml/NodeletException.java?rev=3D180318&view=3Dmarkup=20 [3] http://svn.apache.org/viewcvs.cgi/ibatis/trunk/java/mapper/mapper2/src/c om/ibatis/common/resources/Resources.java?rev=3D180318&view=3Dmarkup=20 [4] http://svn.apache.org/viewcvs.cgi/ibatis/trunk/java/mapper/mapper2/src/c om/ibatis/sqlmap/engine/builder/xml/SqlMapConfigParser.java?rev=3D180318&= v iew=3Dmarkup=20 [5] http://java.sun.com/j2se/1.4.2/docs/api/java/io/InputStreamReader.html#I nputStreamReader(java.io.InputStream)=20 Thanks, Paul McAdams=20 IBM WebSphere Application Server Support" -----Original Message----- From: Larry Meadors [mailto:larry.meadors@gmail.com]=20 Sent: Wednesday, June 22, 2005 11:03 AM To: user-java@ibatis.apache.org Subject: Re: Content is not allowed in prolog This really is not an iBATIS issue, but I suspect you must need to somehow edit the XML in a plain text editor, and make sure there are no unicode charaters in it, and that the very first line begins with wrote: > =20 > We recently starting developing with iBatis (I have used it before at=20 > other sites). It runs fine on a WebSphere 5.1 under Rational=20 > Application Developer 6.0 on Windows XP; however, when we try to=20 > deploy to WebSphere 5.1 on AIX iBatis will not load and we get the=20 > following error: > =20 >=20 > Error 500: Error while configuring DaoManager. Cause: > com.iBatis.common.exception.NestedRuntimeException: Error occurred.=20 > Cause: com.ibatis.common.xml.NodeletException: > Error parsing XML. Cause: org.xml.sax.SAXParseException: Content is=20 > not allowed in prolog. Caused by: org.xml.sax.SAXParseException:=20 > Content is not allowed in prolog. Caused by: > com.ibatis.common.xml.NodeletException: Error parsing XML. > Cause: org.xml.sax.SAXParseException: Content is not allowed in=20 > prolog. Caused by: org.xml.sax.SAXParseException: Content is not=20 > allowed in prolog. One of my team members found this link about a bug=20 > in RAD 6.0 where it writes a bad Byte Offset Mark (BOM) in XML files=20 > (http://forum.java.sun.com/thread.jspa?threadID=3D567285&tstart=3D90), > so we implemented the recommended circumvention on all the iBatis XML=20 > files and switched from UTF-8 to ISO-8859-1 encoding. We still get the > error. > =20 > Has anybody else had this problem? Any suggestions?