私は次のエラーに直面しています、
Java.lang.NoSuchMethodError: org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment()Lorg/springframework/core/env/Environment;
at org.springframework.context.annotation.ComponentScanBeanDefinitionParser.parse(ComponentScanBeanDefinitionParser.Java:81)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.Java:73)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.Java:1423)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.Java:1413)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.Java:184)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.Java:140)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.Java:111)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.Java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.Java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.Java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.Java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.Java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.Java:209)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.Java:239)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.Java:196)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.Java:181)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(DefaultBeanDefinitionDocumentReader.Java:140)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.Java:111)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.Java:493)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.Java:390)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.Java:334)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.Java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.Java:174)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.Java:209)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.Java:180)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.Java:125)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.Java:94)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.Java:129)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.Java:537)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:452)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.Java:663)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.Java:629)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.Java:677)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.Java:548)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.Java:489)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.Java:136)
at javax.servlet.GenericServlet.init(GenericServlet.Java:160)
at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1280)
at org.Apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.Java:1193)
at org.Apache.catalina.core.StandardWrapper.load(StandardWrapper.Java:1088)
at org.Apache.catalina.core.StandardContext.loadOnStartup(StandardContext.Java:5198)
at org.Apache.catalina.core.StandardContext.startInternal(StandardContext.Java:5481)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1559)
at org.Apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.Java:1549)
at Java.util.concurrent.FutureTask.run(FutureTask.Java:266)
at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1142)
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:617)
at Java.lang.Thread.run(Thread.Java:745)
私はグーグル検索から依存関係の問題に関連していることを知っています。ここに私のpom.xmlがあります
<project xmlns="http://maven.Apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.Apache.org/POM/4.0.0 http://maven.Apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>TempApp</artifactId>
<groupId>com.zbc.tempapp</groupId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>TempApp</name>
<repositories>
<repository>
<id>ZK CE</id>
<name>ZK CE Repository</name>
<url>http://mavensync.zkoss.org/maven2</url>
</repository>
</repositories>
<properties>
<jpa.version>1.0.1.Final</jpa.version>
<hibernate.version>4.3.6.Final</hibernate.version>
<hibernate.commons.annotation.version>4.0.4.Final</hibernate.commons.annotation.version>
<hibernate.validator.version>5.1.2.Final</hibernate.validator.version>
<springVersion>4.1.2.RELEASE</springVersion>
<log4j2Version>2.0</log4j2Version>
<springDataJpaVersion>1.4.3.RELEASE</springDataJpaVersion>
<apacheCommonsLangVersion>3.2.1</apacheCommonsLangVersion>
<apacheCommonsCollection>4.0</apacheCommonsCollection>
<apacheCommonsEmail>1.3.2</apacheCommonsEmail>
<quartzVersion>2.2.1</quartzVersion>
<zkVersion>7.0.3</zkVersion>
<zkSpringVersion>3.1.1</zkSpringVersion>
<junit.version>4.11</junit.version>
<plugin.maven.war>2.4</plugin.maven.war>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<plugin.maven.compiler>3.0</plugin.maven.compiler>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- asyn logger log4j 2 -->
<dependency>
<groupId>org.Apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j2Version}</version>
</dependency>
<dependency>
<groupId>org.Apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j2Version}</version>
</dependency>
<!-- hibernate/jpa related -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>${jpa.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernate.commons.annotation.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate.validator.version}</version>
</dependency>
<!-- Spring -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>${springDataJpaVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springVersion}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${springVersion}</version>
</dependency>
<!-- JUnit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<!-- quartz schedular -->
<dependency>
<groupId>org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
<version>${quartzVersion}</version>
</dependency>
<!-- Zkoss Dependency -->
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkplus</artifactId>
<version>${zkVersion}</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zhtml</artifactId>
<version>${zkVersion}</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkbind</artifactId>
<version>${zkVersion}</version>
</dependency>
<dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zul</artifactId>
<version>${zkVersion}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-core</artifactId>
<version>3.1.1</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency> -->
<!-- <dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-webflow</artifactId>
<version>3.1.1</version>
</dependency> -->
<!-- <dependency>
<groupId>org.zkoss.zk</groupId>
<artifactId>zkspring-security</artifactId>
<version>3.1.1</version>
</dependency> -->
<!-- Apache commons -->
<dependency>
<groupId>org.Apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>${apacheCommonsEmail}</version>
</dependency>
<dependency>
<groupId>org.Apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${apacheCommonsLangVersion}</version>
</dependency>
<dependency>
<groupId>org.Apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>${apacheCommonsCollection}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>${plugin.maven.war}</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true
</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true
</addDefaultSpecificationEntries>
</manifest>
<manifestEntries>
<Implementation-Build>${BUILD_TAG}</Implementation-Build>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${plugin.maven.compiler}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<debug>true</debug>
<optimize>true</optimize>
</configuration>
</plugin>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12.4</version>
<executions>
<execution>
<configuration>
<!-- make it false to execute test cases -->
<skipTests>true</skipTests>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<configuration>
<!-- make it false to execute test cases -->
<skipTests>true</skipTests>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.Apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<encoding>${project.build.sourceEncoding}</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
<debug>true</debug>
<optimize>true</optimize>
</configuration>
</plugin>
</plugins>
</build>
</project>
ありがとうございました。
私はあなたと同じ問題を抱えていました。 2時間の発見がうまくいかなかった...あなたの質問を見つけて、おそらく依存関係の問題であることがわかりました。
それは、Spring Beanの依存関係を追加するだけでこの問題を解決しました
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>
これは私にとっては、春のjarファイルと春のデータ間の依存関係の互換性の問題でした。
エラーの前のバージョン(エラーなし):
<spring.version>4.1.0.RELEASE</spring.version>
<springdata.version>1.6.1.RELEASE</springdata.version>
Springデータを1.10.2.RELEASEに更新した後、エラーが追加され、springバージョンを4.3.2.RELEASEにアップグレードすることで解決しました。
<spring.version>4.3.2.RELEASE</spring.version>
<springdata.version>1.10.2.RELEASE</springdata.version>
正しいスプリングバージョンを使用するために、スプリング依存関係のMaven宣言をスキップし、スプリングデータ依存関係のみを保持できます。または、mavenリポジトリで、どのスプリングバージョンがスプリングデータバージョンで使用されているかを確認し、その結果更新することができます。
このエラーはかなり明確です、クラス
org.springframework.beans.factory.xml.XmlReaderContext
メソッドgetEnvironmentが含まれていません(Javaメソッド表記)
.getEnvironment()Lorg/springframework/core/env/Environment
アプリケーションに含まれているSpring beanライブラリを見て、クラスでjavap -lを実行すると、おそらくこのメソッドreallyが存在しないことに気付くでしょう。 ...
**javap.exe c:\XmlReaderContext.class** -l
Compiled from "XmlReaderContext.Java"
public class org.springframework.beans.factory.xml.XmlReaderContext extends org.springframework.beans.factory.parsing.ReaderContext {
public org.springframework.beans.factory.xml.XmlReaderContext(org.springframework.core.io.Resource, org.springframework.beans.factory.parsing.ProblemReporter, org.springframework.beans.factory.par
aderEventListener, org.springframework.beans.factory.parsing.SourceExtractor, org.springframework.beans.factory.xml.XmlBeanDefinitionReader, org.springframework.beans.factory.xml.NamespaceHandlerRes
public final org.springframework.beans.factory.xml.XmlBeanDefinitionReader getReader();
public final org.springframework.beans.factory.support.BeanDefinitionRegistry getRegistry();
public final org.springframework.core.io.ResourceLoader getResourceLoader();
public final Java.lang.ClassLoader getBeanClassLoader();
public final org.springframework.beans.factory.xml.NamespaceHandlerResolver getNamespaceHandlerResolver();
public Java.lang.String generateBeanName(org.springframework.beans.factory.config.BeanDefinition);
public Java.lang.String registerWithGeneratedName(org.springframework.beans.factory.config.BeanDefinition);
public org.w3c.dom.Document readDocumentFromString(Java.lang.String);
}
このためのメソッドを含む新しいバージョンにアップグレードしてくださいSpring bean dependency> 4.3.2
よろしく
さひ
if using spring 3.17
use
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
<version>1.6.6.RELEASE</version>
</dependency>