Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring boot 1.5.2 - web application stops after loading logo?

I have a very weird problem with Spring Boot, I don't know why the web application which using Spring Boot cannot start and it has no output error even when I run it directly on the terminal.

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

Here is the application class https://pastebin.com/rinWbp9z, this web application uses Liquibase to populate database schema and Spring boot version 1.5.2. Can you please share some hint to debug?

like image 395
Bằng Rikimaru Avatar asked Aug 28 '17 12:08

Bằng Rikimaru


1 Answers

So, the problem is, I'm using log4.properties out of war file. Then, when I starts this war, It shows very nice information like this:

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

Then, I added a log4j.properties file in src/main/resources with this content:

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

After that, I can see the detail log from Spring which make Tomcat stop:

***************************
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

Well, I must say, it is really impressive about how error could be hidden.

like image 152
Bằng Rikimaru Avatar answered Oct 06 '22 03:10

Bằng Rikimaru