Quantcast

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

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Marco
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>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Eduardo Macarron
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.

El día 13 de marzo de 2012 19:47, Marco <[hidden email]> escribió:

> 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>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

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

Marco
You have won the bet.  :-)

The error was in my orderoverview-dao.xml.
Thanks a lot!
Loading...