gpt4 book ai didi

java - Spring boot 1.5.2 - 加载 Logo 后 Web 应用程序停止?

转载 作者:搜寻专家 更新时间:2023-10-31 20:17:21 24 4
gpt4 key购买 nike

我在使用Spring Boot时遇到了一个很奇怪的问题,我不知道为什么使用Spring Boot的Web应用程序无法启动,即使我直接在终端上运行也没有输出错误。

java -jar /var/lib/tomcat/webapps/rasdaman.war
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )__ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' || .__|| ||| |_, | / / / /
=========||==============|/=////
:: Spring Boot :: (v1.5.2.RELEASE)

[rasdaman@osboxes rasdaman]$ echo $?
1

这里是应用类https://pastebin.com/rinWbp9z ,此 Web 应用程序使用 Liquibase 填充数据库模式和 Spring boot version 1.5.2。你能分享一些调试提示吗?

最佳答案

所以,问题是,我在 war 文件中使用 log4.properties。然后,当我开始这场 war 时,它会显示非常好这样的信息:

java -jar target/petascope_main/rasdaman.war
log4j:WARN No appenders could be found for logger (org.springframework.web.context.support.StandardServletEnvironment).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.5.2.RELEASE)

Aug 28, 2017 6:00:31 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Tomcat
Aug 28, 2017 6:00:32 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.5.11
Aug 28, 2017 6:00:33 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring embedded WebApplicationContext
Aug 28, 2017 6:00:38 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Tomcat

然后,我在 src/main/resources 中添加了一个 log4j.properties 文件,内容如下:

log4j.rootLogger=debug, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%t %-5p %c{2} - %m%n

之后,我可以看到来自 Spring 的使 Tomcat 停止的详细日志:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field abstractHandler in org.rasdaman.ApplicationMain required a single bean, but 7 were found:
- KVPRasqlServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/KVPRasqlServiceHandler.class]
- KVPWCPSServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/KVPWCPSServiceHandler.class]
- SOAPWCSServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/SOAPWCSServiceHandler.class]
- KVPWCSTServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/KVPWCSTServiceHandler.class]
- XMLWCSServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/XMLWCSServiceHandler.class]
- KVPWCSServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/KVPWCSServiceHandler.class]
- KVPWMSServiceHandler: defined in URL [jar:file:/home/rasdaman/build/applications/petascope/target/petascope_main/rasdaman.war!/WEB-INF/classes!/petascope/controller/handler/service/KVPWMSServiceHandler.class]


Action:

Consider marking one of the beans as @Primary, updating the consumer to accept multiple beans, or using @Qualifier to identify the bean that should be consumed

嗯,我必须说,隐藏错误的方式确实令人印象深刻。

关于java - Spring boot 1.5.2 - 加载 Logo 后 Web 应用程序停止?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45919310/

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