---
title: "Spring异常备忘录"
author: "ace"
date: "2010-09-09T09:32:31Z"
tags: []
categories: ["企业架构"]
slug: "spring"
draft: false
lastmod: "2010-09-09T09:32:31Z"
id: 759134
url: "https://xace.iteye.com/blog/759134"
---

> org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from ServletContext resource [/web-inf/springmvc-servlet.xml]; nested exception is java.io.FileNotFoundException: Could not open ServletContext resource [/web-inf/springmvc-servlet.xml]  
>  Caused by: java.io.FileNotFoundException: Could not open ServletContext resource [/web-inf/springmvc-servlet.xml]  


在WEB-INF 下确实是没有找到springmvc-servlet.xml , 同时根本没有编辑这个xml文件，更加没有引用他

原因是：在web.xml里配置了如下的servlet

```xml

<servlet>
  <servlet-name>adminServlet</servlet-name>
  <servletclass>org.springframework.web.servlet.DispatcherServlet</servlet-class>
    <!--
    <init-param>
     <param-name>namespace</param-name>
     <param-value>admin-servlet</param-value>
    </init-param>
    <init-param>
      <param-name>namespace</param-name>
      <param-value>spring/mvc-config</param-value>
    </init-param>
    -->
  <load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
  <servlet-name>adminServlet</servlet-name>
<url-pattern>/remote/*</url-pattern>
</servlet-mapping>
```

注意在运行时，Spring会在WEB-INF下去找adminServlet-servlet.xml这个是默认规定的，当然你可以像斜体内容去指定加载的*.xml文件名



not allowed in read-only mode (FlushMode.NEVER)

即check打头的操作时，是不可操作数据库的，包括更新与增加数据。

```xml
<bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor">
  <property name="transactionManager" ref="transactionManager" />
  <property name="transactionAttributes">
    <props>
      <prop key="query*">PROPAGATION_REQUIRED,readOnly</prop>
      <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
      <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
      <prop key="check*">PROPAGATION_REQUIRED,readOnly</prop>
      <prop key="insert*">
        PROPAGATION_REQUIRED,-GenericException  
       </prop>
```

即check打头的操作时，是不可操作数据库的，包括更新与增加数据。
修改为

```xml
<prop key="check*">PROPAGATION_REQUIRED</prop>  
```