【问题标题】:Can't start boot project where network is close无法启动网络关闭的启动项目
【发布时间】:2019-08-18 06:34:28
【问题描述】:

我已经创建了 Spring Boot 应用程序。很简单:

插件:

apply plugin: 'war'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'

在我的构建脚本中:

buildscript {
    dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:2.1.3.RELEASE")
    }
}

和依赖:

compile("org.springframework.boot:spring-boot-devtools")
compile('org.springframework.boot:spring-boot-starter-data-jpa')
compile("org.springframework.boot:spring-boot-starter-web")
compile("org.springframework.boot:spring-boot-starter-security")
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'

此外,我还有一些依赖项,例如:lambok、h2、webjars 等。没什么有趣的。

所以在我的本地机器上:

  • 在我的本地机器上构建战争文件!
  • 一切都很好!完全没问题!

我一点问题都没有!但是当我将它部署在“没有网络”的服务器上时

Mar 27, 2019 11:44:59 AM org.apache.tomcat.util.digester.Digester warning
WARNING: Parse Warning Error at line 25 column 19: schema_reference.4: Failed to read schema document 'http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
org.xml.sax.SAXParseException; systemId: jar:jar:file:/.../war.war!/WEB-INF/lib/tomcat-embed-websocket-9.0.14.jar!/META-INF/web-fragment.xml; lineNumber: 25; columnNumber: 19; schema_reference.4: Failed to read schema document 'http://xmlns.jcp.org/xml/ns/javaee/web-fragment_4_0.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)

知道如何解决这个问题吗?

只是没有任何 XML 配置的简单 Web 应用程序。

【问题讨论】:

    标签: spring spring-boot spring-mvc tomcat tomcat9


    【解决方案1】:

    您可以在没有网络连接的情况下将 xsd 放在服务器上的类路径中。 XSD url 仅在找不到 xsd 的本地类路径副本时使用。

    还有details on registering schemas,不过这可能有点矫枉过正。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-13
      • 1970-01-01
      • 2022-06-13
      • 1970-01-01
      • 2018-02-22
      • 1970-01-01
      • 2017-10-15
      相关资源
      最近更新 更多