user3600073
user3600073

Reputation: 1893

Spring Boot logging issue with logback

I have some logging related exceptions with spring boot web application when I deploy it in the traditional weblogic container. Same application works fine with the embedded tomcat without making any changes to it.

With the weblogic 12 c, I am seeing this exception:

at org.springframework.util.Assert.isInstanceOf(Assert.java:339) at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:92) at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithSensibleDefaults(AbstractLoggingSystem.java:62) at org.springframework.boot.logging.AbstractLoggingSystem.beforeInitialize(AbstractLoggingSystem.java:45) at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:68) at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:131) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98) at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:92) at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:53) at org.springframework.boot.SpringApplication.run(SpringApplication.java:269) at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:142) at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:89) at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:51) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175) at weblogic.servlet.internal.WebAppServletContext.initContainerInitializer(WebAppServletContext.java:1394) at weblogic.servlet.internal.WebAppServletContext.initContainerInitializers(WebAppServletContext.java:1331) at weblogic.servlet.internal.WebAppServletContext.initContainerInitializers(WebAppServletContext.java:1317) at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1834) at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2876) at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1661) at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:823) at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:360) at weblogic.application.internal.ExtensibleModuleWrapper$StartStateChange.next(ExtensibleModuleWrapper.java:356) at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:42) at weblogic.application.internal.ExtensibleModuleWrapper.start(ExtensibleModuleWrapper.java:138)

I am using spring-platform 1.0.1 in the parent pom. and my web module pom looks like this:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>people-mgmt</groupId>
    <artifactId>people-mgmt-data</artifactId>
    <version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
    <groupId>org.apache.tomcat.embed</groupId>
    <artifactId>tomcat-embed-jasper</artifactId>
    <scope>provided</scope>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jstl</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-test</artifactId>
    <scope>test</scope>
</dependency>

And here is my project dependency tree:

enter image description here enter image description here

Any help to resolve the issue would be greatly appreciated.

Upvotes: 2

Views: 4336

Answers (1)

user3600073
user3600073

Reputation: 1893

It is weblogic class loader issue. Please check these links - sl4j/logback under weblogic and http://blog.terrencemiao.com/archives/annoying-slf4j-problem-in-weblogic-server-12c

So, resolved this issue by adding the following in weblogic.xml under WEB-INF folder.

<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
    <container-descriptor>
        <prefer-application-packages>
            <package-name>org.slf4j</package-name>
        </prefer-application-packages>
    </container-descriptor>
</weblogic-web-app>

Upvotes: 2

Related Questions