spring+mybatis,tomcat启动异常
org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'sql...
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: ServletContext resource [/WEB-INF/mybatis-config.xml]; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing SQL Mapper Configuration. Cause: org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. Cause: java.lang.NullPointerException
是映射文件的问题,在mybatis配置文件中去掉映射文件就没有问题
mapper文件:
<mapper>
<resultMap type="../org.gocom.crm.bean.Operator" id="operators">
<result property="userId" column="userid"/>
<result property="userName" column="operatorname"/>
<result property="password" column="password"/>
</resultMap>
<select id="queryOperator" resultType="operators">
<![CDATA[
select userid,operatorname,password from ac_operator where rownum<=10
]]>
</select>
</mapper>
我只写了Operator JavaBean没有其它定义任何类 展开
是映射文件的问题,在mybatis配置文件中去掉映射文件就没有问题
mapper文件:
<mapper>
<resultMap type="../org.gocom.crm.bean.Operator" id="operators">
<result property="userId" column="userid"/>
<result property="userName" column="operatorname"/>
<result property="password" column="password"/>
</resultMap>
<select id="queryOperator" resultType="operators">
<![CDATA[
select userid,operatorname,password from ac_operator where rownum<=10
]]>
</select>
</mapper>
我只写了Operator JavaBean没有其它定义任何类 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询