Could not open PortletContext resource [/com/rujuan/model/SqlMapConfig.xml]

来源:互联网 发布:淘宝豆豆鞋 编辑:程序博客网 时间:2024/06/10 22:16

In my spring-ibatis.xml, I need to config sqlMapClient:

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="com/rujuanmodel/SqlMapConfig.xml" />
<property name="dataSource" ref="dataSource" />
</bean>

When I deploy it to tomcat, it always gives me an error: 

Could not open PortletContext resource [/com/rujuan/model/SqlMapConfig.xml]

The thing is when it deploys to webapp, the path has changed. So we need to config like this:

<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:com/rujuan/model/SqlMapConfig.xml" />
<property name="dataSource" ref="dataSource" />
</bean>

then it works!

原创粉丝点击