Attribute "namespace" must be declared for element type "mapper"

564 views
Skip to first unread message

Marco

unread,
Mar 13, 2012, 2:47:03 PM3/13/12
to mybatis-user
Hi,
after updating from:
mybatis-3.1.0-SNAPSHOT -> mybatis-3.1.0-bundle
mybatis-spring-1.1.0-SNAPSHOT -> mybatis-spring-1.1.0-bundle

I get following exception:

..... Failed to parse config resource: class path resource [com/xxx/
server/mybatis-config.xml]; nested exception is
org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper
Configuration. Cause: org.apache.ibatis.builder.BuilderException:
Error creating document instance. Cause:
org.xml.sax.SAXParseException: Attribute "namespace" must be declared
for element type "mapper".

Caused by: org.apache.ibatis.builder.BuilderException: Error creating
document instance. Cause: org.xml.sax.SAXParseException: Attribute
"namespace" must be declared for element type "mapper".
at
org.apache.ibatis.parsing.XPathParser.createDocument(XPathParser.java:
253)
at org.apache.ibatis.parsing.XPathParser.<init>(XPathParser.java:122)
at
org.apache.ibatis.builder.xml.XMLMapperBuilder.<init>(XMLMapperBuilder.java:
74)
at
org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:
310)
at
org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:
104)


Here my mybatis-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>
<typeAliases>
<!--Define a aliases for easy use of them inside the mapper--
>
<typeAlias type="com.xxx.shared.beans.OrderOverviewBean"
alias="OrderOverviewBean"/>
<typeAlias type="com.xxx.shared.beans.OrderBean"
alias="OrderBean"/>
</typeAliases>
<mappers>
<mapper resource="com/xxx/server/order/persistance/
orderoverview-dao.xml" />
<mapper resource="com/xxx/server/order/persistance/order-
dao.xml" />
</mappers>
</configuration>

Eduardo Macarron

unread,
Mar 13, 2012, 3:11:04 PM3/13/12
to mybati...@googlegroups.com
I would bet this is not caused by the version change.

Looks that either orderoverview-dao.xml or order-dao.xml lacks the
namespace attribute.

Marco

unread,
Mar 13, 2012, 3:22:40 PM3/13/12
to mybatis-user
You have won the bet. :-)

The error was in my orderoverview-dao.xml.
Thanks a lot!
Reply all
Reply to author
Forward
0 new messages