복붙노트

[SPRING] java.net.MalformedURLException : 알 수없는 프로토콜 : classpath

SPRING

java.net.MalformedURLException : 알 수없는 프로토콜 : classpath

내가 봄에서 schemalocation classpath를 사용하여 로컬 드라이브에서 xsd 스키마를 가져 오려고합니다. 클래스 패스에 필요한 파일을 추가하고이 파일의 참조를

15:10:19.336 [localhost-startStop-1] DEBUG o.s.b.f.xml.ResourceEntityResolver - Could not resolve XML entity [classpath:spring-social-facebook-1.1.xsd] against system root URL
java.net.MalformedURLException: unknown protocol: classpath
    at java.net.URL.<init>(Unknown Source) ~[na:1.8.0_31]
    at java.net.URL.<init>(Unknown Source) ~[na:1.8.0_31]
    at java.net.URL.<init>(Unknown Source) ~[na:1.8.0_31]

여기 내 applicationContext.xml의 헤더입니다.

<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
    xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:beans="http://www.springframework.org/schema/beans" xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:mongo="http://www.springframework.org/schema/data/mongo"     xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:social="http://www.springframework.org/schema/social"
    xmlns:facebook="http://www.springframework.org/schema/social/facebook"
    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/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
            http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
            http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
            http://www.springframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo-1.7.xsd
            http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
            http://www.springframework.org/schema/social http://www.springframework.org/schema/social/spring-social.xsd
            http://www.springframework.org/schema/social/facebook classpath:spring-social-facebook-1.1.xsd">

나는 스프링 4.1과 스프링 빈 3.0을 사용하고있다.

해결법

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

    1.다른 위치를 어지럽히고 기본값을 사용해서는 안됩니다. 스프링 소셜 Facebook의 경우 http://www.springframework.org/schema/social/spring-social-facebook-1.1.xsd를 사용하거나 더 적은 버전을 사용하십시오 http://www.springframework.org/schema/social/ spring-social-facebook.xsd.

    다른 위치를 어지럽히고 기본값을 사용해서는 안됩니다. 스프링 소셜 Facebook의 경우 http://www.springframework.org/schema/social/spring-social-facebook-1.1.xsd를 사용하거나 더 적은 버전을 사용하십시오 http://www.springframework.org/schema/social/ spring-social-facebook.xsd.

    Spring은 항상 classpath로부터 jars로부터 xsd를로드 할 것이다. Spring은 커스텀 EntityResolver를 가지고있다. PluggableSchemaResolver는 Spring jar 파일의 META-INF 디렉토리에서 다른 spring.schemas 파일을 사용한다.

    당신이 얻는 오류를 얻는 유일한 이유는 (그리고 왜 당신이 그것을 해결하려고하는지)입니다.

    나는 spring-social-facebook의 1.1.0 버전을 모두 가지고 있지는 않지만 jar의 버전을 혼합하는 옵션 2에 걸 겠어.

  2. ==============================

    2.내가 봄 - 사회 - 웹의 잘못된 항아리를 사용했지만 xsd가 포함 된 봄 - 사회 - 페이스 북이 아니기 때문에이 문제를 해결했습니다. 나는 classpath를 더 이상 사용할 필요가 없다. 덕분에 M. Deinum.

    내가 봄 - 사회 - 웹의 잘못된 항아리를 사용했지만 xsd가 포함 된 봄 - 사회 - 페이스 북이 아니기 때문에이 문제를 해결했습니다. 나는 classpath를 더 이상 사용할 필요가 없다. 덕분에 M. Deinum.

  3. from https://stackoverflow.com/questions/31939072/java-net-malformedurlexception-unknown-protocol-classpath by cc-by-sa and MIT license