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

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!

你可能感兴趣的:(Could not open PortletContext resource [/com/rujuan/model/SqlMapConfig.xml])