首页 > 解决方案 > 无法启动网络关闭的启动项目

问题描述

我已经创建了 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)

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

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

标签: springspring-bootspring-mvctomcattomcat9

解决方案


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

还有关于注册模式的详细信息,但这可能是矫枉过正。


推荐阅读