SqlMapConfig.xml引用<sqlMap resource="../Emp.xml" />报错?求解
applicationContext.xml配置<beanid="dataSource"class="org.apache.commons.dbcp.BasicDataS...
applicationContext.xml配置
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="false">
..........................................
</bean>
<bean id="client" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="configLocation">
<value>classpath:SqlMapConfig.xml</value>
</property>
</bean>
<bean id="empDao" class="com.cstp.dao.emp.impl.EmpDAOImpl">
<property name="sqlMapclient">
<ref bean="client"/>
</property>
</bean>
<bean id="empService" class="com.cstp.service.emp.impl.EmpServiceImpl">
<property name="empdao">
<ref bean="empDao"/>
</property>
</bean>
<bean id="empAction" class="com.cstp.web.emp.EmpAction">
<property name="empService">
<ref bean="empService"/>
</property>
</bean>
<bean id="userDao" class="com.cstp.dao.users.impl.UserDaoImpl">
<property name="sqlMapclient">
<ref bean="client"/>
</property>
</bean>
<bean id="userService" class="com.cstp.service.users.impl.UserServiceImpl">
<property name="userDao">
<ref bean="userDao"/>
</property>
</bean>
<bean id="userAction" class="com.cstp.web.users.UserAction">
<property name="userService">
<ref bean="userService"/>
</property>
</bean>
</beans>
SqlMapConfig.xml配置中
<sqlMapConfig >
<sqlMap resource="com/cstp/pojo/emp/Emp.xml" />
<sqlMap resource="com/cstp/pojo/users/users.xml" />
</sqlMapConfig>
如果去掉<sqlMap resource="com/cstp/pojo/users/users.xml" />项目能启动,加上这个引用后就报错
2014-10-29 16:56:17 org.springframework.beans.factory.support.DisposableBeanAdapter invokeCustomDestroyMethod
警告: Couldn't find a destroy method named 'false' on bean with name 'dataSource'
2014-10-29 16:56:17 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [SqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource com/cstp/pojo/users/users.xml
这个是项目包结构,求大神指教啊。。。。 展开
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="false">
..........................................
</bean>
<bean id="client" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="dataSource">
<ref bean="dataSource"/>
</property>
<property name="configLocation">
<value>classpath:SqlMapConfig.xml</value>
</property>
</bean>
<bean id="empDao" class="com.cstp.dao.emp.impl.EmpDAOImpl">
<property name="sqlMapclient">
<ref bean="client"/>
</property>
</bean>
<bean id="empService" class="com.cstp.service.emp.impl.EmpServiceImpl">
<property name="empdao">
<ref bean="empDao"/>
</property>
</bean>
<bean id="empAction" class="com.cstp.web.emp.EmpAction">
<property name="empService">
<ref bean="empService"/>
</property>
</bean>
<bean id="userDao" class="com.cstp.dao.users.impl.UserDaoImpl">
<property name="sqlMapclient">
<ref bean="client"/>
</property>
</bean>
<bean id="userService" class="com.cstp.service.users.impl.UserServiceImpl">
<property name="userDao">
<ref bean="userDao"/>
</property>
</bean>
<bean id="userAction" class="com.cstp.web.users.UserAction">
<property name="userService">
<ref bean="userService"/>
</property>
</bean>
</beans>
SqlMapConfig.xml配置中
<sqlMapConfig >
<sqlMap resource="com/cstp/pojo/emp/Emp.xml" />
<sqlMap resource="com/cstp/pojo/users/users.xml" />
</sqlMapConfig>
如果去掉<sqlMap resource="com/cstp/pojo/users/users.xml" />项目能启动,加上这个引用后就报错
2014-10-29 16:56:17 org.springframework.beans.factory.support.DisposableBeanAdapter invokeCustomDestroyMethod
警告: Couldn't find a destroy method named 'false' on bean with name 'dataSource'
2014-10-29 16:56:17 org.springframework.web.context.ContextLoader initWebApplicationContext
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'client' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [SqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: java.io.IOException: Could not find resource com/cstp/pojo/users/users.xml
这个是项目包结构,求大神指教啊。。。。 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询