itsource

Spring 3.0 - XML 스키마 네임스페이스용 Spring NamespaceHandler를 찾을 수 없습니다[ http://www.springframework.org/schema/security ]

mycopycode 2022. 8. 21. 19:56
반응형

Spring 3.0 - XML 스키마 네임스페이스용 Spring NamespaceHandler를 찾을 수 없습니다[ http://www.springframework.org/schema/security ]

이 문제의 원인이 무엇인지 짐작 가는 것이 있습니까?

XML 스키마 네임스페이스에 대한 Spring NamespaceHandler를 찾을 수 없습니다[ http://www.springframework.org/schema/security 。

org.springframework.web.context.ContextLoader initWebApplicationContext: Context initialization failed
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unable to locate Spring NamespaceHandler for XML schema namespace [http://www.springframework.org/schema/security]
Offending resource: ServletContext resource [/WEB-INF/applicationContext.xml]

applicationContext.xml 입니다.

<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/security"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:beans="http://www.springframework.org/schema/beans"
    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.0.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.0.xsd
        http://www.springframework.org/schema/security
        http://www.springframework.org/schema/security/spring-security-3.0.xsd">
...
</beans:beans>

pom.xml에는 다음이 있습니다.

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-core</artifactId>      
    <version>3.0.1.RELEASE</version>
</dependency>
<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-openid</artifactId>
    <version>3.0.1.RELEASE</version>
</dependency>

Maven 의존 관계를 추가해야 했습니다.

    <dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-config</artifactId>
        <version>3.0.1.RELEASE</version>
    </dependency>

애플리케이션을 도입하려고 할 때 같은 에러 메세지가 표시되었습니다.봄에는 보안 설정 xml이 applicationContext.xml(통상은 WEB-INF 폴더 내의 applicationContext-security.xml)과는 다른 것이 될 수 있습니다.적용되는 변경은 web.xml에 적용됩니다.

<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
        /WEB-INF/applicationContext.xml
        /WEB-INF/applicationContext-security.xml
    </param-value>
</context-param>

applicationContext.xml은 다음과 같습니다.

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

    <http auto-config='true'>
        <intercept-url pattern="/login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
        <intercept-url pattern="/**" access="ROLE_USER" />
        <form-login login-page='login.jsp'/>
    </http>

</beans:beans>

이러한 내용을 변경한 후에도 네임스페이스 오류가 발생합니다.이 문제를 해결하려면 다음 jar 파일을 WEB-INF/lib에 추가한 다음 라이브러리에 추가합니다.

  • spring-security-3.1.0.M2.jar
  • spring-security-config-3.1.0 입니다.M2.jar
  • spring-security-core-3.1.0 입니다.M2.jar
  • spring-security-taglibs-3.1.0.M2.jar
  • spring-security-web-3.1.0 입니다.M2.jar

나는 한동안 이것과 씨름했지만 이 대답들 중 어느 것도 도움이 되지 않았다.user64141의 코멘트 덕분에, 저는 이 컴퓨터에 문제가 있다는 것을 깨달았습니다.spring.handlers파일을 표시합니다.

Maven용 Shade 플러그인을 사용하여 뚱뚱한 병을 만들고 있습니다.spring.handlers(그리고spring.schemas) 파일은 각 스프링 종속성에 의해 덮어쓰기되었습니다.

Maven 사이트에서는 이 정확한 문제와 대신 파일을 함께 첨부하여 해결하는 방법에 대해 설명합니다.

http://maven.apache.org/plugins/maven-shade-plugin/examples/resource-transformers.html#AppendingTransformer

spring-security-config jar를 사용하여 문제를 해결했습니다.

솔루션은 WEB-INF/lib이 아닌 "spring-security-config"입니다.

Maven을 사용한 Eclipse 프로젝트의 경우, 모든 maven 의존 관계가 WEB-INF/lib에 복사된 것은 아니었습니다.Project -> Properties -> Deployment Assembly를 보면 일부 jar만 복사되어 있었습니다.

이를 수정하기 위해 "추가", "Java 빌드 경로 입력", 마지막으로 "매븐 종속성"을 차례로 클릭했습니다.

지난 한 시간 동안 SO와 웹을 검색해 본 결과, 이것이 다른 사람에게 도움이 되었으면 합니다.

메이븐 의존관계 목록은 스프링 사이트에 있습니다.필요한 주요 아티팩트는 다음과 같습니다.

  1. 스프링 보안 핵심
  2. 스프링 보안 웹
  3. spring-security-config

@James Jithin - 이러한 예외는 xsi:schema Location에 두 가지 버전의 콩과 보안 스키마가 있는 경우에도 나타날 수 있습니다.붙여넣은 조각에 기재되어 있는 그대로입니다.

xsi:schemaLocation="http://www.springframework.org/schema/beans   
 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd   
 http://www.springframework.org/schema/security  
 http://www.springframework.org/schema/security/spring-security-3.1.xsd"

내 경우 둘 다 3.1로 변경하면 문제가 해결되었다.

내가 한 일:

      <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>3.2.5.RELEASE</version>
        </dependency>

그리고.

xsi:schemaLocation="
        http://www.springframework.org/schema/security 
        http://www.springframework.org/schema/security/spring-security-3.2.xsd
        http://www.springframework.org/schema/beans 
        http://www.springframework.org/schema/beans/spring-beans-4.1.xsd">

완벽하게 동작합니다.모어백둥

이미 모든 의존 관계가 있는 경우 다음을 시도해 보십시오.
1. 다운로드한 모든 병을 maven 저장소 폴더에서 삭제하여 'org-> springframework'를 실행합니다.
2. 깔끔한 몸매를 만듭니다.

저는 오늘 비슷한 문제를 겪었습니다.웬일인지 그래.IntelliJ IDEA어플리케이션 전개 중에 Spring Security jar 파일이 포함되어 있지 않습니다.저는 여기 포스터의 대부분에 동의해야 한다고 생각합니다.

이 에러는, Virgo 에 전개중에 발생했습니다.해결책은 번들 Import에 이 항목을 추가하는 것이었습니다.

org.springframework.transaction.config;version="[3.1,3.2)",

META-INF 아래의 스프링 항에 spring.schemas 섹션과 spring.handlers 섹션이 있으며, 이 경우 org.springframework.transaction.config를 가리키는 클래스가 있습니다.TxNamespaceHandler)를 Import해야 합니다.

다음 해결책을 찾았습니다.

http://www.javacreed.com/unable-to-locate-spring-namespacehandler-for-xml-schema-namespace-httpwww-springframework-orgschemamvc/

프로젝트에 이 항아리 포함

몇 분 전에도 같은 문제가 발생하여 배포 어셈블리에서 'Maven defendies' 라이브러리를 찾을 수 없었습니다.Eclipse의 'Web Deployment Assembly' 섹션을 통해 추가했습니다.

의존관계를 추가해도 문제가 해결되지 않으면 WAR 아카이브를 다시 만듭니다.제 경우 보안 웹 및 보안 컨피규레이션자리가 없는 오래된 WAR 파일을 사용했습니다.

pom.xml 파일에 다음 의존관계를 추가하고 IntelliJ를 사용하는 경우 동일한 jar를 WEB-INF->lib 폴더에 추가합니다.경로는 Project Structure -> Atrifacts -> Available Elements 창에서 jar를 선택하고 더블 클릭합니다.각 폴더에 추가됩니다.

<dependency>
    <groupId>org.springframework.security</groupId>
    <artifactId>spring-security-config</artifactId>
    <version>3.0.1.RELEASE</version>
</dependency>

언급URL : https://stackoverflow.com/questions/2161050/spring-3-0-unable-to-locate-spring-namespacehandler-for-xml-schema-namespace

반응형