spring - 无法启动网络关闭的启动项目
问题描述
我已经创建了 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 配置。
解决方案
您可以在没有网络连接的情况下将 xsd 放在服务器上的类路径中。XSD url 仅在找不到 xsd 的本地类路径副本时使用。
还有关于注册模式的详细信息,但这可能是矫枉过正。
推荐阅读
- solr - Solr查询两个字段错误
- javascript - 查找对象中与给定字符串匹配的所有键的路径
- powershell - 具有独特选择 Powershell 的多个 ComboBox
- windows-machine-learning - 使用 Windows SDK 17763 进行 ML 图像评估接受大小为 227 x 227 的图像
- c++ - 尝试创建表会出现 sql 逻辑错误
- php - 显示/隐藏记录 PHP MySQL
- c++ - 链接到 libkcapi 时没有核心转储
- spring-security - Spring security5:在 OAuth2 检查之前触发 LogoutFilter
- c++ - 如何静态识别动态堆分配?
- asp.net - 在面板中呈现 asp.net 用户控件