-1

I am new to spring boot. I have developed an app and it runs in Intellij IDE without any problem. I want to deploy an executable jar and run it through command window. To this end, I respectively applied the following commands in the related folder:

mvn clear

mvn install    

Please note that in my app I use two external jar files. One of them is ojdbc.jar for Oracle db connections and the other contains a Scala code using Apache Spark(cosinelsh.jar). So the command above should create a fat jar file. Indeed, this process went smoothly. However when intending to run the file (java -jar target/mlee.jar), the error below is thrown:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/C:/Users/n12017/AppData/Local/Temp/mlee-exe-jar.jar-spring-boot-libs-65763e64-4a74-4d8f-b23a-0a20f028113c/cosinelsh-1.0.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/C:/Users/n12017/IdeaProjects/LSH_USER/target/mlee-exe-jar.jar!/BOOT-INF/lib/logback-classic-1.1.9.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.Log4jLoggerFactory]
Exception in thread "main" java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.impl.Log4jLoggerFactory loaded from file:/C:/Users/n12017/AppData/Local/Temp/mlee-exe-jar.jar-spring-boot-libs-65763e64-4a74-4d8f-b23a-0a20f028113c/cosinelsh-1.0.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml Object of class [org.slf4j.impl.Log4jLoggerFactory] must be an instance of class ch.qos.logback.classic.LoggerContext
        at org.springframework.util.Assert.isInstanceOf(Assert.java:346)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.getLoggerContext(LogbackLoggingSystem.java:273)
        at org.springframework.boot.logging.logback.LogbackLoggingSystem.beforeInitialize(LogbackLoggingSystem.java:97)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationStartingEvent(LoggingApplicationListener.java:230)
        at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:209)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:167)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139)
        at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
        at org.springframework.boot.context.event.EventPublishingRunListener.starting(EventPublishingRunListener.java:68)
        at org.springframework.boot.SpringApplicationRunListeners.starting(SpringApplicationRunListeners.java:48)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151)
        at softuniBlog.DemoApplication.main(DemoApplication.java:12)
        ... 8 more

From similar questions in stackoverflow (Favoring LogBack over Log4j in spring-boot/ security or Disable Logback in SpringBoot), I have tried similar approaches but always failed.

Here is the dependency tree:

--- maven-dependency-plugin:2.10:tree (default-cli) @ demo ---
[INFO] Blog:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.apache.tomcat:tomcat-jdbc:jar:8.5.11:compile
[INFO] |  |  \- org.apache.tomcat:tomcat-juli:jar:8.5.11:compile
[INFO] |  \- org.springframework:spring-jdbc:jar:4.3.6.RELEASE:compile
[INFO] |     +- org.springframework:spring-beans:jar:4.3.6.RELEASE:compile
[INFO] |     \- org.springframework:spring-tx:jar:4.3.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-security:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.3.6.RELEASE:compile
[INFO] |  +- org.springframework.security:spring-security-config:jar:4.2.1.RELEASE:compile
[INFO] |  |  \- org.springframework.security:spring-security-core:jar:4.2.1.RELEASE:compile
[INFO] |  \- org.springframework.security:spring-security-web:jar:4.2.1.RELEASE:compile
[INFO] |     +- org.springframework:spring-expression:jar:4.3.6.RELEASE:compile
[INFO] |     \- org.springframework:spring-web:jar:4.3.6.RELEASE:compile
[INFO] +- org.springframework.boot:spring-boot-starter-thymeleaf:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.5.1.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-tomcat:jar:1.5.1.RELEASE:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-core:jar:8.5.11:compile
[INFO] |  |  |  +- org.apache.tomcat.embed:tomcat-embed-el:jar:8.5.11:compile
[INFO] |  |  |  \- org.apache.tomcat.embed:tomcat-embed-websocket:jar:8.5.11:compile
[INFO] |  |  +- org.hibernate:hibernate-validator:jar:5.3.4.Final:compile
[INFO] |  |  |  +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] |  |  |  \- com.fasterxml:classmate:jar:1.3.3:compile
[INFO] |  |  \- org.springframework:spring-webmvc:jar:4.3.6.RELEASE:compile
[INFO] |  +- org.thymeleaf:thymeleaf-spring4:jar:2.1.5.RELEASE:compile
[INFO] |  \- nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:jar:1.4.0:compile
[INFO] |     \- org.codehaus.groovy:groovy:jar:2.4.7:compile
[INFO] +- org.springframework.boot:spring-boot-starter:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.1.RELEASE:compile
[INFO] |  |  +- ch.qos.logback:logback-classic:jar:1.1.9:compile
[INFO] |  |  |  \- ch.qos.logback:logback-core:jar:1.1.9:compile
[INFO] |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.22:compile
[INFO] |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.22:compile
[INFO] |  +- org.springframework:spring-core:jar:4.3.6.RELEASE:compile
[INFO] |  \- org.yaml:snakeyaml:jar:1.17:runtime
[INFO] +- org.springframework.boot:spring-boot-devtools:jar:1.5.1.RELEASE:runtime
[INFO] +- mysql:mysql-connector-java:jar:5.1.40:runtime
[INFO] +- com.microsoft.sqlserver:mssql-jdbc:jar:6.1.0.jre7:runtime
[INFO] |  \- com.microsoft.azure:azure-keyvault:jar:0.9.3:runtime
[INFO] |     +- com.microsoft.azure:azure-core:jar:0.9.3:runtime
[INFO] |     |  +- commons-codec:commons-codec:jar:1.10:runtime
[INFO] |     |  +- commons-lang:commons-lang:jar:2.6:runtime
[INFO] |     |  +- com.sun.jersey:jersey-client:jar:1.13:runtime
[INFO] |     |  |  \- com.sun.jersey:jersey-core:jar:1.13:runtime
[INFO] |     |  \- com.sun.jersey:jersey-json:jar:1.13:runtime
[INFO] |     |     +- org.codehaus.jettison:jettison:jar:1.1:runtime
[INFO] |     |     |  \- stax:stax-api:jar:1.0.1:runtime
[INFO] |     |     +- com.sun.xml.bind:jaxb-impl:jar:2.2.3-1:runtime
[INFO] |     |     |  \- javax.xml.bind:jaxb-api:jar:2.2.2:runtime
[INFO] |     |     |     \- javax.xml.stream:stax-api:jar:1.0-2:runtime
[INFO] |     |     +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:runtime
[INFO] |     |     +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:runtime
[INFO] |     |     +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.2:runtime
[INFO] |     |     \- org.codehaus.jackson:jackson-xc:jar:1.9.2:runtime
[INFO] |     +- org.apache.httpcomponents:httpclient:jar:4.5.2:runtime
[INFO] |     |  \- org.apache.httpcomponents:httpcore:jar:4.4.6:runtime
[INFO] |     +- javax.inject:javax.inject:jar:1:runtime
[INFO] |     \- com.microsoft.azure:adal4j:jar:1.0.0:runtime
[INFO] |        +- com.nimbusds:oauth2-oidc-sdk:jar:4.5:runtime
[INFO] |        |  +- net.jcip:jcip-annotations:jar:1.0:runtime
[INFO] |        |  +- org.apache.commons:commons-lang3:jar:3.3.1:runtime
[INFO] |        |  +- com.nimbusds:lang-tag:jar:1.4:runtime
[INFO] |        |  \- com.nimbusds:nimbus-jose-jwt:jar:3.1.2:runtime
[INFO] |        |     \- org.bouncycastle:bcprov-jdk15on:jar:1.51:runtime
[INFO] |        \- com.google.code.gson:gson:jar:2.8.0:runtime
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.1.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.1.RELEASE:test
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.1.RELEASE:test
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test
[INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:runtime
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:runtime
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.3:runtime
[INFO] |  +- junit:junit:jar:4.12:test
[INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test
[INFO] |  \- org.springframework:spring-test:jar:4.3.6.RELEASE:test
[INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.1.RELEASE:compile
[INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.9:compile
[INFO] |  +- org.hibernate:hibernate-core:jar:5.0.11.Final:compile
[INFO] |  |  +- org.jboss.logging:jboss-logging:jar:3.3.0.Final:compile
[INFO] |  |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  |  +- org.javassist:javassist:jar:3.21.0-GA:compile
[INFO] |  |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  |  +- org.jboss:jandex:jar:2.0.0.Final:compile
[INFO] |  |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- org.hibernate.common:hibernate-commons-annotations:jar:5.0.1.Final:compile
[INFO] |  +- org.hibernate:hibernate-entitymanager:jar:5.0.11.Final:compile
[INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile
[INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.11.0.RELEASE:compile
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.13.0.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-orm:jar:4.3.6.RELEASE:compile
[INFO] |  \- org.springframework:spring-aspects:jar:4.3.6.RELEASE:compile
[INFO] +- org.thymeleaf.extras:thymeleaf-extras-springsecurity4:jar:2.1.2.RELEASE:compile
[INFO] |  +- org.thymeleaf:thymeleaf:jar:2.1.5.RELEASE:compile
[INFO] |  |  +- ognl:ognl:jar:3.0.8:compile
[INFO] |  |  \- org.unbescape:unbescape:jar:1.1.0.RELEASE:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.22:compile
[INFO] +- com.oracle:ojdbc6:jar:11.2.0.4:compile
[INFO] +- org.springframework.boot:spring-boot-starter-mail:jar:1.5.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.3.6.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:4.3.6.RELEASE:compile
[INFO] |  \- com.sun.mail:javax.mail:jar:1.5.6:compile
[INFO] +- javax.mail:mail:jar:1.4.1:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- org.scala-lang:scala-library:jar:2.10.0:compile
[INFO] +- cosine-lsh:cosinelsh:jar:1.0:compile
[INFO] \- com.fasterxml.jackson.core:jackson-databind:jar:2.4.4:compile
[INFO]    +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO]    \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO]    \- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile

And pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>Blog</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>demo</name>
    <description>Blog Project from the Software Technologies Course</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.1.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.thymeleaf.extras</groupId>
            <artifactId>thymeleaf-extras-springsecurity4</artifactId>
            <version>2.1.2.RELEASE</version>
        </dependency>

        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>ojdbc6</artifactId>
            <version>11.2.0.4</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-mail</artifactId>
            <!--<version>1.4.3.RELEASE</version>-->
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.1</version>
        </dependency>

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.10.0</version>
        </dependency>

        <dependency>
            <groupId>cosine-lsh</groupId>
            <artifactId>cosinelsh</artifactId>
            <version>1.0</version>
        </dependency>

        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.4.4</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>mlee-exe-jar</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <requiresUnpack>
                        <dependency>
                            <groupId>cosine-lsh</groupId>
                            <artifactId>cosinelsh</artifactId>
                            <version>1.0</version>
                        </dependency>
                    </requiresUnpack>
                </configuration>
            </plugin>
        </plugins>
    </build>


</project>

I got stuck! Can somebody help?

Thanks in advance!

EDIT

I could get rid of binding logging as James Fry suggested as below:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>

However, when jar file is run through command window it starts and ends after a few second:

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.1.RELEASE)

EDIT 2

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:536) ~[spring-context-4.3.6.RELEASE.jar!/:4.3.6.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:737) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:370) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:314) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1162) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1151) [spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at softuniBlog.DemoApplication.main(DemoApplication.java:12) [classes!/:0.0.1-SNAPSHOT]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_121]
        at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_121]
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [mlee-exe-jar.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [mlee-exe-jar.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [mlee-exe-jar.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [mlee-exe-jar.jar:0.0.1-SNAPSHOT]
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embedded Tomcat
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:117) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.java:84) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:537) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.java:179) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        ... 16 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Failed to initialize component [StandardServer[-1]]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:112) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:140) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.startup.Tomcat.start(Tomcat.java:343) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.java:98) ~[spring-boot-1.5.1.RELEASE.jar!/:1.5.1.RELEASE]
        ... 21 common frames omitted
Caused by: javax.xml.parsers.FactoryConfigurationError: Provider for class javax.xml.parsers.SAXParserFactory cannot be created
        at javax.xml.parsers.FactoryFinder.findServiceProvider(Unknown Source) ~[na:1.8.0_121]
        at javax.xml.parsers.FactoryFinder.find(Unknown Source) ~[na:1.8.0_121]
        at javax.xml.parsers.SAXParserFactory.newInstance(Unknown Source) ~[na:1.8.0_121]
        at org.apache.tomcat.util.digester.Digester.getFactory(Digester.java:432) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.digester.Digester.getParser(Digester.java:617) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.digester.Digester.getXMLReader(Digester.java:809) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1477) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.execute(MbeansDescriptorsDigesterSource.java:170) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.loadDescriptors(MbeansDescriptorsDigesterSource.java:149) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.Registry.load(Registry.java:590) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:669) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.Registry.findDescriptor(Registry.java:703) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.Registry.findManagedBean(Registry.java:479) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.tomcat.util.modeler.Registry.registerComponent(Registry.java:622) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.util.LifecycleMBeanBase.register(LifecycleMBeanBase.java:161) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.util.LifecycleMBeanBase.initInternal(LifecycleMBeanBase.java:61) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:829) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:107) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11]
        ... 24 common frames omitted
Caused by: java.lang.RuntimeException: Provider for class javax.xml.parsers.SAXParserFactory cannot be created
        ... 42 common frames omitted
Caused by: java.util.ServiceConfigurationError: javax.xml.parsers.SAXParserFactory: Error reading configuration file
        at java.util.ServiceLoader.fail(Unknown Source) ~[na:1.8.0_121]
        at java.util.ServiceLoader.parse(Unknown Source) ~[na:1.8.0_121]
        at java.util.ServiceLoader.access$200(Unknown Source) ~[na:1.8.0_121]
        at java.util.ServiceLoader$LazyIterator.hasNextService(Unknown Source) ~[na:1.8.0_121]
        at java.util.ServiceLoader$LazyIterator.hasNext(Unknown Source) ~[na:1.8.0_121]
        at java.util.ServiceLoader$1.hasNext(Unknown Source) ~[na:1.8.0_121]
        at javax.xml.parsers.FactoryFinder$1.run(Unknown Source) ~[na:1.8.0_121]
        at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_121]
        ... 42 common frames omitted
Caused by: java.io.FileNotFoundException: JAR entry META-INF/services/javax.xml.parsers.SAXParserFactory not found in C:\Users\n12017\AppData\Local\Temp\mlee-exe-jar.jar-spring-boot-libs-7a6ac511-970e-415f-bccb-432a1d0c7cee\cosinelsh-1.0.jar
        at org.springframework.boot.loader.jar.JarURLConnection.throwFileNotFound(JarURLConnection.java:185) ~[mlee-exe-jar.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.jar.JarURLConnection.connect(JarURLConnection.java:104) ~[mlee-exe-jar.jar:0.0.1-SNAPSHOT]
        at org.springframework.boot.loader.jar.JarURLConnection.getInputStream(JarURLConnection.java:169) ~[mlee-exe-jar.jar:0.0.1-SNAPSHOT]
        at java.net.URL.openStream(Unknown Source) ~[na:1.8.0_121]
        ... 49 common frames omitted
Community
  • 1
  • 1
mlee_jordan
  • 772
  • 4
  • 18
  • 50
  • it sounds like you are having a new problem now, unrelated to the logging issue. What is the output of this command: `$ jar -tvf cosinelsh-1.0.‌​jar | grep SAXParserFactory` ? – Gary Apr 02 '17 at 19:26
  • @Gary in windows I have tried the following thanks to your suggestion: ``jar -tvf cosinelsh-1.0.jar | findstr SAXParserFactory`` Here what I got: ``2701 Thu Jul 09 00:59:52 CEST 2015 org/apache/xerces/jaxp/SAXParserFactoryImpl.class 44 Thu Jul 09 00:59:52 CEST 2015 META-INF/services/javax.xml.parsers.SAXParserFactory`` – mlee_jordan Apr 13 '17 at 09:36
  • ok, it sounds like you have a conflict with your cosinelsh library. It contains classes that are also contained elsewhere, probably with version mismatches. In general it becomes tricky to include fatjar dependencies in a project like this because you can't really manage what is in them. Like @James Fry mentioned, I would look at removing things like SAXParser than have been stuffed in there. – Gary Apr 13 '17 at 20:43
  • @Gary thanks for the suggestion! Now I have removed SAXParser and javax servlets (since there were some possible conflicts between spark (jetty) and spring boot(tomcat)). Now my issue is: ``Caused by: java.lang.OutOfMemoryError: Java heap space``. By the way when run my code locally, it works. – mlee_jordan Apr 14 '17 at 10:11
  • It appears you are having a new, unrelated issue. I would suggest creating a new question instead of appending that issue to this question. That will make it easier for others to find and suggest answers, without getting bogged down in the details of these other issues. – Gary Apr 14 '17 at 13:25

1 Answers1

0

You should exclude the other implementation from the problematic import - in this case your cosinelsh jar contains SLF4J logger bindings, as well as the logback-classic-1.1.9.jar that's brought in through Spring Boot.

I believe the correct fix is to build the cosinelsh jar without these dependencies, if you are able to (eg by setting the scope to "provided" or similar). If that is not possible, you may be able to removing the spring boot supplied libraries from the spring-boot-starter-logging dependency (brought in through spring-boot-starter), eg:

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
James Fry
  • 1,133
  • 1
  • 11
  • 28
  • Thanks @James Fry! When excluding logging from classpath I could still run the code in my local comp. However, when intending to run the deployed jar file in command window, now it starts the program but after a few seconds it stops. please see my edit above. – mlee_jordan Mar 29 '17 at 08:54
  • Additionally, I could manually remove log file from my cosinelsh jar instead of removing logback. But this time I had the error as shown above in edit 2. – mlee_jordan Mar 29 '17 at 09:12
  • In the errors it says in the end that "JAR entry META-INF/services/javax.xml.parsers.SAXParserFactory not found in C:\Users\n12017\AppData\Local\Temp\mlee-exe-jar.jar-spring-boot-libs-7a6ac511-970e-415f-bccb-432a1d0c7cee\cosinelsh-1.0.jar". But it does exist in the given folder. – mlee_jordan Mar 29 '17 at 09:18