Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Deploying with an Embedded Web Server

Andrey Serebryanskiy
Andrey Serebryanskiy
5,756 Points

Can not switch to Jetty

Hey! I'm using spring-boot-gradle-plugin with spring boot version 2.0.0.RELEASE.

My dependencies list looks as follows:

dependencies {
    compile 'org.springframework.boot:spring-boot-devtools'
    compile('org.springframework.boot:spring-boot-starter-thymeleaf') {
        exclude module: 'spring-boot-starter-tomcat'
    }
    compile 'org.springframework.boot:spring-boot-starter-jetty'
    compile 'org.springframework.boot:spring-boot-starter-data-jpa'
    compile 'org.springframework.boot:spring-boot-starter-security'
    compile 'org.springframework.boot:spring-boot-starter-websocket'
    compile 'org.webjars:webjars-locator:0.32'
    compile 'org.webjars:jquery:3.3.1'
    compile 'org.webjars:sockjs-client:1.0.2'
    compile 'org.webjars:stomp-websocket:2.3.3'
    compile 'org.hibernate:hibernate-core:5.2.13.Final'
    compile 'org.hibernate:hibernate-entitymanager:5.2.13.Final'
    compile 'org.hibernate:hibernate-java8:5.2.13.Final'
    compile 'org.apache.tomcat:tomcat-dbcp:8.0.30'
    compile 'net.sourceforge.nekohtml:nekohtml:1.9.21'

    compileOnly 'org.projectlombok:lombok:1.16.20'

    runtime 'com.h2database:h2'
    runtime 'javax.transaction:jta:1.1'
    runtime 'org.aspectj:aspectjweaver:1.8.7'

    testCompile 'junit:junit:4.12'
    testCompile 'org.hamcrest:hamcrest-all:1.3'
    testCompile 'org.springframework.boot:spring-boot-starter-test'
    testCompile 'org.springframework.security:spring-security-test:5.0.1.RELEASE'
}

But for some reason when I execute bootRun task it states that "Tomcat has started on port..".

Does somebody knows what is the case and how to fix it?

1 Answer

Andrey Serebryanskiy
Andrey Serebryanskiy
5,756 Points

Changed version of spring-boot-plugin to 1.5.9.RELEASE and everything works fine.