myBatis xml map causing namespace must be declared for element type mapper



Is there anything obvious wrong with this setup please. On app startup I get Attribute "namespace" must be declared for element type "mapper", when it clearly is declared.


spring xml resource dao.xml:



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://ift.tt/GArMu6"
xmlns:xsi="http://ift.tt/ra1lAU"
xmlns:util="http://ift.tt/OGfeTW"
xmlns:jms="http://ift.tt/1iMF6wC"
xsi:schemaLocation="http://ift.tt/GArMu6
http://ift.tt/18sW2ax
http://ift.tt/OGfeTW
http://ift.tt/1aj0W5e
http://ift.tt/1iMF6wC http://ift.tt/1BuJ5p4">

<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/JNDINAME"/>
<property name="lookupOnStartup" value="true"/>
<property name="cache" value="true"/>
<property name="proxyInterface" value="javax.sql.DataSource"/>
</bean>

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
</bean>

<bean id="mapperScanner" class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="com.mycompany.dao"/>
<property name="sqlSessionFactory" ref="sqlSessionFactory"/>
</bean>
</beans>


Interface:



public interface MyDAO {
public void save(@Param("id") String id);
}


Mapper xml:



<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://ift.tt/1hHoXcX">

<configuration>

<mapper namespace="com.mycompany.dao">

<typeAlias alias="xxxVO" type="com.xxx" />

<insert id="save" parameterType="string">
SOME SQL etc
</insert>

</mapper>

</configuration>


The Interface is in src/main/java/com/mycompany/dao The mapper xml in in src/main/resources/com/mycompany/dao


My pom has



<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.2.2</version>
</dependency>


Thanks in advance


No comments:

Post a Comment