Does IntelliJ come with a Tomcat container with it?

Answered

Hello, I have a maven project with a Web application using spring-boot framework. I can start my Web application on my localhost in IntelliJ, but not at command line. In command line, I should be able to start the web application with spring-boot:run, but it fails. And the error message seems like related with Tomcat.

Does IntelliJ have a built-in Tomcat container when i run inside IntelliJ, since I don't have any error message. At a terminal, however, I can't started the application successfully. How to configure Tomcat to work with my spring-boot application outside of IntelliJ?

Any info would be very helpful! I need to be able to run the application at a command line for deployment. 

 

3 comments
Comment actions Permalink

IDE does not bundled any application servers.

What Run/Debug Configuration do you use for starting in IDE?

What error do you get when run it from command line?

Make sure you have all the needed dependencies configured for the Gradle project. Check related tutorials and a sample project (e.g. Spring Initializ) and https://spring.io/guides/gs/spring-boot/

0
Comment actions Permalink

My main class:

@SpringBootApplication
@Import({WebConfigurer.class})
@ComponentScan("com.jde.nlu.qe")
@PropertySource({"classpath:boot.properties", "classpath:important.properties", "classpath:jss.properties",
        "classpath:system.properties", "classpath:ump.properties"})
@EnableAutoConfiguration
public class JnluQEWebStart extends SpringBootServletInitializer {

    public static void main(String[] args) {

        SpringApplication.run(JnluQEWebStart.class, args);
    }
}

When I run "JnluQEWebStart" I received the following error message:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-09-16 at 00:44:28.164 [main] ERROR org.springframework.boot.SpringApplication [863] [reportFailure] - Application run failed org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:155) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:544) ~[spring-context-5.0.9.RELEASE.jar:5.0.9.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:780) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:412) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:333) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1277) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1265) [spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at com.jde.nlu.qe.boot.JnluQEWebStart.main(JnluQEWebStart.java:22) [classes/:?]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ServletWebServerApplicationContext due to missing ServletWebServerFactory bean.
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.getWebServerFactory(ServletWebServerApplicationContext.java:204) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:178) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:152) ~[spring-boot-2.0.5.RELEASE.jar:2.0.5.RELEASE]
    ... 8 more

It may have nothing to do with Tomcat.
0
Comment actions Permalink

Please ask the question on a Spring Boot related forums. You will have better chance to get the answer which rather relates to the Spring Boot than to IDE functionality. See e.g. https://stackoverflow.com/a/50232382/2000323.

0

Please sign in to leave a comment.