복붙노트

[SPRING] NoSuchMethodError : org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment () Lorg / springframework / core / env / Environment; zkoss 사용

SPRING

NoSuchMethodError : org.springframework.beans.factory.xml.XmlReaderContext.getEnvironment () Lorg / springframework / core / env / Environment; zkoss 사용

나는 뒤에 오는 과오를 직면하고있다,

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)

Google 검색에서 관련성 문제와 관련이 있다는 것을 알고 있습니다. 그래서 여기에 내 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>

고맙습니다.

해결법

  1. ==============================

    1.나는 너와 같은 문제가 있었다. 2 시간 동안의 조사가 잘못되었습니다 ... 귀하의 질문을 발견 한 후 아마도 그것이 의존성 문제라고 생각했습니다.

    나는 너와 같은 문제가 있었다. 2 시간 동안의 조사가 잘못되었습니다 ... 귀하의 질문을 발견 한 후 아마도 그것이 의존성 문제라고 생각했습니다.

    그것은, 봄 콩 의존성을 추가하는 것만으로이 문제를 해결했습니다.

      <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-beans</artifactId>
        <version>4.1.6.RELEASE</version>
      </dependency>
    
  2. ==============================

    2.이것은 나에게 스프링 용기와 스프링 데이터 사이의 의존성 호환성 문제였다.

    이것은 나에게 스프링 용기와 스프링 데이터 사이의 의존성 호환성 문제였다.

    오류 이전 버전 (오류 없음) :

    <spring.version>4.1.0.RELEASE</spring.version>
    <springdata.version>1.6.1.RELEASE</springdata.version> 
    

    1.10.2.RELEASE로 스프링 데이터를 업데이트 한 후 오류가 추가되고 스프링 버전을 4.3.2로 업그레이드합니다. 릴리스 :

    <spring.version>4.3.2.RELEASE</spring.version>
    <springdata.version>1.10.2.RELEASE</springdata.version>
    

    올바른 스프링 버전을 사용하려면 스프링 의존성 선언을 건너 뛰고 스프링 데이터 의존성 만 유지하면됩니다. 또는 Spring 데이터 버전에 의해 사용되는 Spring 버전을 확인하고 결과를 업데이트 할 수 있습니다.

  3. ==============================

    3.이 오류는 매우 명확합니다. 클래스

    이 오류는 매우 명확합니다. 클래스

    org.springframework.beans.factory.xml.XmlReaderContext
    

    getEnvironment (java 메서드 표기법) 메서드를 포함하지 않습니다.

    .getEnvironment()Lorg/springframework/core/env/Environment
    

    애플리케이션에 포함 된 Spring 빈 라이브러리를보고 클래스에서 javap -l을 실행하면이 메소드가 실제로 존재하지 않는다는 것을 알게 될 것이다.

    **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 의존성을위한 메소드를 포함하는 최신 버전으로 업그레이드하기> 4.3.2

    문안 인사

    사힌

  4. ==============================

    4.

    if using spring 3.17 
    use 
    <dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-jpa</artifactId>
    <version>1.6.6.RELEASE</version>
    </dependency>
    
  5. ==============================

    5.웹 응용 프로그램 시작 / 배포 중에 서버에서이 오류가 발생하면

    웹 응용 프로그램 시작 / 배포 중에 서버에서이 오류가 발생하면

  6. from https://stackoverflow.com/questions/27607961/nosuchmethoderror-org-springframework-beans-factory-xml-xmlreadercontext-getenv by cc-by-sa and MIT license