1
votes

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 hereenter image description here

Any help to resolve the issue would be greatly appreciated.

1
What versions of tomcat and the JDK are you using? - Dave Syer
Tomcat-7.0.54 and JDK1.7.0_60 - user3600073
@Dave please see my updates to my question. I had a default logback.xml generated by STS in the classpath and it was causing the issue with the tomcat. After removing the default logback.xml, things work fine with tomcat. However it is still the same issue with weblogic. - user3600073
Looks like an incompatible version of slf4j is on your classpath. Is it in the container somewhere? - Dave Syer
@Dave, it was related to weblogic class loader. Just figured it out. By adding preferable jars in weblogic.xml, I was able to deploy the application. Thank you for the quick response. - user3600073

1 Answers

1
votes

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>