gpt4 book ai didi

java.net.MalformedURLException : unknown protocol: classpath

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:24:57 27 4
gpt4 key购买 nike

我正在尝试在 Spring 使用模式定位类路径从本地驱动器导入 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 的 header ,

<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">

我正在使用 spring 4.1 和 spring-bean 3.0 版。

最佳答案

您不应该乱用其他位置并使用默认值。对于 Spring Social Facebook,您应该使用 http://www.springframework.org/schema/social/spring-social-facebook-1.1.xsd 或最好是少一个版本 http://www.springframework.org/schema/social/spring-social-facebook.xsd.

Spring 总是首先从类路径的 jars 中加载 xsd。 Spring 附带一个自定义的 EntityResolverPluggableSchemaResolver它使用 Spring jar 文件的 META-INF 目录中的不同 spring.schemas 文件。

出现像你这样的错误的唯一原因(以及你尝试解决它的原因)是

  1. 您还没有包含 spring-social-facebook 所需的依赖项
  2. 您包含了错误的 spring-social-facebook 依赖项
  3. 您正在使用不兼容的 Spring 和 Spring Social 版本。

我敢打赌选项 2 没有所有 1.1.0 版本的 spring-social-facebook,而是混合版本的 jars。

关于java.net.MalformedURLException : unknown protocol: classpath,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31939072/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com