Guys,
Appreciate the help.
I did more testing trying to confirm the root cause of the issue. I
was able to replicate it locally by pointing the iPhone application to
my local machine (Windows based). I am getting similar issue but with
different error (see bottom for full exception log) "Caused by:
org.apache.ibatis.builder.BuilderException: Error creating document
instance. Cause: org.xml.sax.SAXParseException: The document type
declaration for root element type "
configurations.apache.org" must end
with '>'."
See below my config file, where ever you see "?" instead of a proper
string it means i replaced it to protect my client identity.
*****************Config start **********************
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration PUBLIC "-//
ibatis.apache.org//DTD Config 3.0//
EN" "
http://ibatis.apache.org/dtd/ibatis-3-config.dtd">
<configuration>
<typeAliases>
<typeAlias alias="User" type="com.?.model.User"/>
<typeAlias alias="Address" type="com.?.model.Address"/>
<typeAlias alias="OpeningHours" type="com.?.model.OpeningHours"/>
<typeAlias alias="Application" type="com.?.model.Application"/>
<typeAlias alias="Session" type="com.?.model.Session"/>
<typeAlias alias="UserBusiness" type="com.?.model.UserBusiness"/>
<typeAlias alias="Country" type="com.?.model.Country"/>
<typeAlias alias="Business" type="com.?.model.Business"/>
<typeAlias alias="BusinessProfile"
type="com.?.model.BusinessProfile"/>
<typeAlias alias="Branch" type="com.?.model.Branch"/>
<typeAlias alias="ServiceCategory"
type="com.?.model.ServiceCategory"/>
<typeAlias alias="Product" type="com.?.model.Product"/>
<typeAlias alias="ProductCategory"
type="com.?.model.ProductCategory"/>
<typeAlias alias="ProductMessage" type="com.?.model.ProductMessage"/
>
<typeAlias alias="UserMessage" type="com.?.model.UserMessage"/>
<typeAlias alias="UserProfile" type="com.?.model.UserProfile"/>
<typeAlias alias="Card" type="com.?.model.Card"/>
<typeAlias alias="Message" type="com.?.model.Message"/>
<typeAlias alias="Exchange" type="com.?.model.Exchange"/>
<typeAlias alias="FeaturedBusiness"
type="com.?.model.FeaturedBusiness"/>
</typeAliases>
<mappers>
<mapper resource="com/?/data/UserMapper.xml"/>
<mapper resource="com/?/data/ApplicationMapper.xml"/>
<mapper resource="com/?/data/SessionMapper.xml"/>
<mapper resource="com/?/data/LocationMapper.xml"/>
<mapper resource="com/?/data/BusinessMapper.xml"/>
<mapper resource="com/?/data/CategoryMapper.xml"/>
<mapper resource="com/?/data/AddressMapper.xml"/>
<mapper resource="com/?/data/MessageMapper.xml"/>
<mapper resource="com/?/data/ProductMapper.xml"/>
</mappers>
</configuration>
*****************Config end **********************
here is a sample mapper (took the simplest i could find)
*****************Mapper Start ***********************
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//
ibatis.apache.org//DTD Mapper 3.0//EN"
"
http://ibatis.apache.org/dtd/ibatis-3-mapper.dtd">
<mapper namespace="com.?.data.mapper.SessionMapper">
<sql id="sessionColumns"> id,application_id as
applicationId,expiry,session_key as sessionKey </sql>
<select id="isValidSessionKey" parameterType="java.util.Map"
resultType="boolean">
SELECT COUNT(*) FROM Session where session_key=#{session_key} and
user_id=#{user_id}
</select>
<select id="selectActiveSession" parameterType="java.lang.String"
resultType="Session">
SELECT COUNT(*) FROM Session where session_key=#{sessionKey} and
expiry>current_timestamp
</select>
<insert id="insertSession" parameterType="Session" flushCache="true"
statementType="PREPARED" useGeneratedKeys="true" keyProperty="id"
timeout="20000">
insert into Session (
<if test="applicationId != null">
application_id,
</if>
<if test="deviceId != null">
device_id,
</if>
creation_date,
last_modified_date,
<if test="createdByCompanyId != null">
created_by_company_id,
</if>
<if test="createdByUserId != null">
created_by_user_id,
</if>
<if test="lastModifiedByUserId != null">
last_modified_by_user_id,
</if>
is_active,
<if test="expiry != null">
expiry,
</if>
<if test="sessionKey != null">
session_key,
</if>
<if test="userId != null">
user_id
</if>
)
values (
<if test="applicationId != null">
#{applicationId},
</if>
<if test="deviceId != null">
#{deviceId},
</if>
CURRENT_TIMESTAMP,
CURRENT_TIMESTAMP,
<if test="createdByCompanyId != null">
#{createdByCompanyId},
</if>
<if test="createdByUserId != null">
#{createdByUserId},
</if>
<if test="lastModifiedByUserId != null">
#{lastModifiedByUserId},
</if>
#{isActive},
<if test="expiry != null">
#{expiry},
</if>
<if test="sessionKey != null">
#{sessionKey},
</if>
<if test="userId != null">
#{userId}
</if>
)
</insert>
</mapper>
*****************Mapper End ************************
*****************Exception start **********************
### Error building SqlSession.
### The error may exist in SQL Mapper Configuration
### Cause: org.apache.ibatis.builder.BuilderException: Error creating
document instance. Cause: org.xml.sax.SAXParseException: The document
type declaration for root element type "
configurations.apache.org"
must end with '>'.
at
org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:
8)
at
org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:
32)
at
org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:
15)
at
com.alon.ibatis.config.IbatisAppConfigImpl.sqlSessionFactoryBuilder(IbatisAppConfigImpl.java:
48)
at
com.alon.ibatis.config.IbatisAppConfigImpl.sqlSession(IbatisAppConfigImpl.java:
59)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.xmlrpc.server.ReflectiveXmlRpcHandler.invoke(ReflectiveXmlRpcHandler.java:
115)
... 38 more
Caused by: org.apache.ibatis.builder.BuilderException: Error creating
document instance. Cause: org.xml.sax.SAXParseException: The document
type declaration for root element type "
configurations.apache.org"
must end with '>'.
at
org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:
136)
at
org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:32)
at
org.apache.ibatis.builder.xml.XMLConfigBuilder.<init>(XMLConfigBuilder.java:
47)
at
org.apache.ibatis.session.SqlSessionFactoryBuilder.build(SqlSessionFactoryBuilder.java:
28)
... 48 more
Caused by: org.xml.sax.SAXParseException: The document type
declaration for root element type "
configurations.apache.org" must end
with '>'.
at
org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown
Source)
at
org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown
Source)
at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown
Source)
at
org.apache.xerces.impl.XMLDocumentScannerImpl.scanDoctypeDecl(Unknown
Source)
at org.apache.xerces.impl.XMLDocumentScannerImpl
$PrologDispatcher.dispatch(Unknown Source)
at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown
Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
Source)
at
org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:
134)
... 51 more
Caused by:
org.apache.ibatis.exceptions.IbatisException:
*****************Exception end *************************
On Sep 5, 7:46 pm, François Schiettecatte <
fschietteca...@gmail.com>
wrote:
> I would be very curious to take a look at your mybatis config file and one of your mapper files, they maybe some weird characters in there, would you mind posting them?
>
> François
>
> On Sep 5, 2011, at 2:31 PM, sanjeev kumar wrote:
>
>
>
>
>
>
>
> > I know it should not make difference, but seems me could be the
> > problem with the OS system, though I am not 100 % sure. Would like to
> > consider that if OS doing anything thing or not. As I believe API
> > written in java, and java is independent of OS, and we seen things are
> > very strange, which I think OS can be causing that, for which I am not
> > very much sure of, but thought if it can be try on the same OS where
> > in iPhone is running. What do you think?
>
> > Just curious to know, how you are calling an API? you are making the
> > n/w which call the API's functions right?
>