我正在尝试在 springboot 中制作的野蝇服务器上部署一个应用程序。我正在生成一个带有mvn clean install
的战争文件,并通过管理员控制台放在野蝇上,但应用程序无法启动。
我怀疑错误可能是连接面,因为我启动了另一个没有连接面的简单 hello world 应用程序,并且该应用程序运行良好。
这是我的春季应用程序:
@SpringBootApplication
@ComponentScan
public class AudicontasApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
@PostConstruct
void started() {
TimeZone.setDefault(TimeZone.getTimeZone("UTC-3"));
}
public static void main(String[] args) {
SpringApplication.run(AudicontasApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(AudicontasApplication.class);
}
}
class CustomHealthIndicator implements HealthIndicator {
@Override
public Health health() {
return Health.status("I <3 Production!").build();
}
}
这是我的绒球:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.techlead.audicontas</groupId>
<artifactId>audicontas</artifactId>
<version>1.0.0</version>
<packaging>war</packaging>
<name>audicontas</name>
<description>Projeto com as regras de negócio e os serviços do sistema audicontas.</description>
<!-- <url>https://www.codenotfound.com/jsf-primefaces-example-spring-boot-maven.html</url> -->
<parent>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-parent</artifactId>
<version>2.4.1</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<scope>provided</scope>
<!--<version>3.1.0</version>-->
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- SQL server Driver JDBC-->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.4.0.jre8</version>
</dependency>
<!-- joinfaces -->
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.joinfaces</groupId>
<artifactId>tomcat-spring-boot-starter</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Utils -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>br.com.caelum.stella</groupId>
<artifactId>caelum-stella-bean-validation</artifactId>
<version>2.1.2</version>
</dependency>
<dependency>
<groupId>org.primefaces.theme</groupId>
<artifactId>serenity</artifactId>
<version>1.0.4</version>
</dependency>
</dependencies>
</project>
这是野蝇日志错误:
11:18:52,580 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 72) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.NoSuchMethodError: org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:85)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;
at org.apache.tomcat.util.descriptor.tld.TldParser.<init>(TldParser.java:49)
at org.apache.tomcat.util.descriptor.tld.TldParser.<init>(TldParser.java:44)
at org.apache.jasper.servlet.TldScanner.<init>(TldScanner.java:84)
at org.apache.jasper.servlet.JasperInitializer.newTldScanner(JasperInitializer.java:118)
at org.apache.jasper.servlet.JasperInitializer.onStartup(JasperInitializer.java:99)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:186)
at io.undertow.servlet.core.DeploymentManagerImpl$1.call(DeploymentManagerImpl.java:171)
at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:42)
at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.api.LegacyThreadSetupActionWrapper$1.call(LegacyThreadSetupActionWrapper.java:44)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:234)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService.startContext(UndertowDeploymentService.java:100)
at org.wildfly.extension.undertow.deployment.UndertowDeploymentService$1.run(UndertowDeploymentService.java:82)
... 6 more
11:18:52,587 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 5) WFLYCTL0013: Operation ("add") failed - address: ([("deployment" => "audicontas-1.0.0.war")]) - failure description: {
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.NoSuchMethodError: org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
11:18:52,588 ERROR [org.jboss.as.server] (External Management Request Threads -- 5) WFLYSRV0021: Deploy of deployment "audicontas-1.0.0.war" was rolled back with the following failure message:
{
"WFLYCTL0080: Failed services" => {"jboss.undertow.deployment.default-server.default-host./" => "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./: java.lang.NoSuchMethodError: org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;
Caused by: java.lang.NoSuchMethodError: org.apache.tomcat.util.descriptor.DigesterFactory.newDigester(ZZLorg/apache/tomcat/util/digester/RuleSet;Z)Lorg/apache/tomcat/util/digester/Digester;"},
"WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.deployment.default-server.default-host./"],
"WFLYCTL0180: Services with missing/unavailable dependencies" => undefined
}
我不确定这是否是最佳选择,但对我来说,当我删除 jar 依赖项tomcat-embed-jasper
时,这个问题得到了解决。我刚刚在我的pom中插入了下面的代码.xml:
<dependency>
<groupId>org.joinfaces</groupId>
<artifactId>jsf-spring-boot-starter</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</exclusion>
</exclusions>
</dependency>
我删除了所有与雄猫相关的依赖项并排除了嵌入的雄猫。然后产生了战争,它正在与野蝇合作