Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring项目突然无法加载上下文-无代码更改_Java_Spring_Jpa_Namespaces - Fatal编程技术网

Java Spring项目突然无法加载上下文-无代码更改

Java Spring项目突然无法加载上下文-无代码更改,java,spring,jpa,namespaces,Java,Spring,Jpa,Namespaces,我正在开发一个使用Spring数据JPA的Spring3应用程序 昨天,项目在TeamCity中构建得很好,但今天构建在本地和构建服务器上失败,没有代码更改 堆栈跟踪提到名称空间处理程序。以下是配置文件的命名空间部分: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://w

我正在开发一个使用Spring数据JPA的Spring3应用程序

昨天,项目在TeamCity中构建得很好,但今天构建在本地和构建服务器上失败,没有代码更改

堆栈跟踪提到名称空间处理程序。以下是配置文件的命名空间部分:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:jpa="http://www.springframework.org/schema/data/jpa"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:task="http://www.springframework.org/schema/task"
   xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa-1.1.xsd
    http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
    http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.1.xsd">

Springsource昨晚发布了3.2.0,他们显然改变了一些破坏我构建的XSD


解决方案是升级到3.2.0(我使用的是3.1.3),神奇的是,一切都恢复正常了……

这似乎是JPA和Spring以及Spring数据共享核心之间的版本不匹配问题。我也犯了类似的错误

 Invalid NamespaceHandler class [org.springframework.data.jpa.repository.config.JpaRepositoryNameSpaceHandler] 
 for namespace [http://www.springframework.org/schema/data/jpa]: problem with handler class file or dependent class; 
 nested exception is java.lang.NoClassDefFoundError: org/springframework/data/repository/config/RepositoryConfigurationExtension
我更改并介绍了以下条目。注意每个模式的版本

   <?xml version="1.0" encoding="UTF-8"?>
   <beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:jpa="http://www.springframework.org/schema/data/jpa"
   xmlns:tx="http://www.springframework.org/schema/tx"
   xmlns:context="http://www.springframework.org/schema/context"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
   http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
   http://www.springframework.org/schema/data/jpa
   http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd
   http://www.springframework.org/schema/tx
   http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
   http://www.springframework.org/schema/context
   http://www.springframework.org/schema/context/spring-context-3.1.xsd">

Spring和JPA版本是3.1.3.0版本。我将Spring版本降级为3.1.2.0版本,问题得到了解决。但是,根据其他依赖关系,相同的解决方案可能有效,也可能无效。其他相关版本如下所示

  <spring.version>3.1.2.RELEASE</spring.version>
  <spring-data-jpa.version>1.2.0.RELEASE</spring-data-jpa.version>
  <spring-data-commons-core.version>1.4.0.RELEASE</spring-data-commons-core.version>
3.1.2.1版本
1.2.0.1发布
1.4.0.1发布

是上下文中的
spring-jpa-1.1.xsd
还是
spring-jpa-3.1.xsd
。通过回滚到昨天签入的所有内容来确认“无代码更改”。如果仍然存在问题,请检查TeamCity配置和/或其运行的服务器是否有任何更改,包括环境设置、TeamCity版本、已安装的库等。Usha-spring jpa在Bohemian-I触发TeamCity上的构建的那一刻已在1.1版上,并证实Mercurial修订版在两种情况下是相同的。我做了回滚等,但同样的行为!见下面的答案。
  <spring.version>3.1.2.RELEASE</spring.version>
  <spring-data-jpa.version>1.2.0.RELEASE</spring-data-jpa.version>
  <spring-data-commons-core.version>1.4.0.RELEASE</spring-data-commons-core.version>