Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logback problem on - Spring Boot 1.2.0 - Websphere Liberty Profile 8.5.5.x #2149

Closed
slavus opened this issue Dec 14, 2014 · 1 comment
Closed
Assignees
Labels
type: bug A general bug
Milestone

Comments

@slavus
Copy link

slavus commented Dec 14, 2014

Hi I encountered strange problem on spring boot 1.2.0 (This happens also for Spring boot 1.1.0 ).

It is not possible to start spring boot application on Websphere Liberty Profile 8.5.5.x as WAR application.

I created minimal spring boot app, and tried to start it on Liberty Profile, but app won't start. After little bit of investigation I found ffdc log with this

 java.lang.NullPointerException
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:142)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLogger(LogbackLoggingSystem.java:134)
    at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:86)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartedEvent(LoggingApplicationListener.java:129)
    at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:121)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:151)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
    at org.springframework.boot.context.event.EventPublishingRunListener.publishEvent(EventPublishingRunListener.java:100)
    at org.springframework.boot.context.event.EventPublishingRunListener.started(EventPublishingRunListener.java:54)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:278)
    at org.springframework.boot.context.web.SpringBootServletInitializer.run(SpringBootServletInitializer.java:117)
    at org.springframework.boot.context.web.SpringBootServletInitializer.createRootApplicationContext(SpringBootServletInitializer.java:108)
    at org.springframework.boot.context.web.SpringBootServletInitializer.onStartup(SpringBootServletInitializer.java:68)
    at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:175)
    at com.ibm.ws.webcontainer.webapp.WebApp.initializeServletContainerInitializers(WebApp.java:2471)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:1034)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:6342)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApp(DynamicVirtualHost.java:446)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.startWebApplication(DynamicVirtualHost.java:441)
    at com.ibm.ws.webcontainer.osgi.WebContainer.startWebApplication(WebContainer.java:761)
    at com.ibm.ws.webcontainer.osgi.WebContainer.startModule(WebContainer.java:739)
    at com.ibm.ws.app.manager.web.internal.WebModuleHandlerImpl.deployModule(WebModuleHandlerImpl.java:106)
    at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModule(DeployedAppInfoBase.java:538)
    at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployModules(DeployedAppInfoBase.java:457)
    at com.ibm.ws.app.manager.module.internal.DeployedAppInfoBase.deployApp(DeployedAppInfoBase.java:411)
    at com.ibm.ws.app.manager.war.internal.WARApplicationHandlerImpl.install(WARApplicationHandlerImpl.java:73)
    at com.ibm.ws.app.manager.internal.statemachine.StartAction.execute(StartAction.java:139)
    at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.enterState(ApplicationStateMachineImpl.java:1166)
    at com.ibm.ws.app.manager.internal.statemachine.ApplicationStateMachineImpl.run(ApplicationStateMachineImpl.java:779)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)

It looks like this block off code is the problem

        Assert.isInstanceOf(LoggerContext.class, factory, String.format(
                "LoggerFactory is not a Logback LoggerContext but Logback is on "
                        + "the classpath. Either remove Logback or the competing "
                        + "implementation (%s loaded from %s). If you are using "
                        + "Weblogic you will need to add 'org.slf4j' to "
                        + "prefer-application-packages in WEB-INF/weblogic.xml",
                factory.getClass(), factory.getClass().getProtectionDomain()
                        .getCodeSource().getLocation()));

in debug session it looks like factory.getClass().getProtectionDomain() .getCodeSource() is null.

If I remove logback from maven model app starts

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>logback-classic</artifactId>
                    <groupId>ch.qos.logback</groupId>
                </exclusion>
            </exclusions>
        </dependency>

Any idea why this happens and how to fix it?

@wilkinsona
Copy link
Member

Looking at the javadoc it's legal for getCodeSource() to return null so we need to protect against it.

The problem was introduced in e47435f and is in 1.1.8.RELEASE and later.

@wilkinsona wilkinsona added this to the 1.1.11 milestone Dec 14, 2014
@wilkinsona wilkinsona added the type: bug A general bug label Dec 14, 2014
@wilkinsona wilkinsona self-assigned this Dec 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants