Greg Zuber
Greg Zuber

Reputation: 1279

IntelliJ Process finished with exit code 0 when spring-boot run

I have a problem when starting spring-boot appication from IntelliJ-Idea. I don't have this problem when running application through terminal.

:: Spring Boot ::        (v1.2.1.RELEASE)

2015-09-24 12:22:44.274  WARN 22380 --- [           main] n.sf.ehcache.config.CacheConfiguration   : Cache 'publicationsCount' is set to eternal but also has TTI/TTL set.  To avoid this warning, clean up the config removing conflicting values of eternal, TTI and TTL. Effective configuration for Cache 'publicationsCount' will be eternal='true', timeToIdleSeconds='0', timeToLiveSeconds='0'.

Process finished with exit code 0

I think this warn is not causing it. What may be the reason?

Upvotes: 76

Views: 100792

Answers (13)

Pranav MS
Pranav MS

Reputation: 2296

You need to add the starte web dependency. it will resolve the issue.

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

this solved my issue.

Upvotes: 0

SKS
SKS

Reputation: 68

For me I forgot to add the Spring Web MVC Dependency

Upvotes: 1

Sid Ray
Sid Ray

Reputation: 71

For me removing the check-mark from - use settings from .mvn/maven.config and changing the Maven path to take from Bundled Maven worked. These settings are in build tools Maven settings.

Upvotes: 0

Wisnu Wijokangko
Wisnu Wijokangko

Reputation: 2288

In my case, I need to remove several dependencies first. Then I run maven clean. After that my code just works fine.

Upvotes: 0

mrdm
mrdm

Reputation: 129

Using the below dependencies in pom.xml, as well as loading maven changes (ctrl+shift+o) solved my problem.

<dependencies>
    <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>
    </dependency>

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

Upvotes: 4

Romesh D
Romesh D

Reputation: 45

If below property was added to the allication.properties file, need to remove this. This property is used to remove the web container.

spring.main.web-application-type=none

In my case I forgot to remove this and once it's removed the issue was fixed

Upvotes: 1

Airy
Airy

Reputation: 123

If you create a project gradle template from https://start.spring.io/ (sprint initializr), you need to add org.springframework.boot:spring-boot-starter-web dependecy in you build.gradle file.

// you need to add this dependency to run spring boot correctly
implementation 'org.springframework.boot:spring-boot-starter-web'   

Upvotes: 8

User
User

Reputation: 1628

Adding spring boot starter web solved my problem

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

Upvotes: 28

Alex
Alex

Reputation: 436

In my case, there is a slight difference between:

  • Just click Run in the most visible bottom inside IntelliJ and...
  • Look for the default controller inside src/main/java/com.exampler.yourapplication, right click and press Run there.

The second option just run the project properly.

Upvotes: 0

Mohamed.Abdo
Mohamed.Abdo

Reputation: 2200

in my case i started intelliJ as

adminstrator

, then it works make sure you have tomcat dependency

 <dependency>
        <groupId>org.apache.tomcat.embed</groupId>
        <artifactId>tomcat-embed-core</artifactId>
        <version>9.0.29</version>
    </dependency>

Upvotes: 1

Rishabh Agarwal
Rishabh Agarwal

Reputation: 2644

I create a simple project from https://start.spring.io/ (sprint initializr) and added a simple controller to run the application.

@RestController
public class testController {

    @GetMapping(value="/")
    //@RequestMapping(value="/",method=RequestMethod.GET)
    public String hello(){
        return "Hello World!!";
    }
}

but it wasn't getting started because my pom wasn't having

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

After adding this my application started...

2019-11-05 14:33:32.302  INFO 39079 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@dd20ebc, org.springframework.security.web.context.SecurityContextPersistenceFilter@57b1ec84, org.springframework.security.web.header.HeaderWriterFilter@2c2a7d53, org.springframework.security.web.csrf.CsrfFilter@b9b97ad, org.springframework.security.web.authentication.logout.LogoutFilter@29f3185c, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@4ffa7041, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter@2c2a903f, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter@6c70b7c3, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@48d44b46, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@5cbe95b1, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@11ad095c, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@16a09809, org.springframework.security.web.session.SessionManagementFilter@1de85972, org.springframework.security.web.access.ExceptionTranslationFilter@4a122e68, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@5d37aa0f]
2019-11-05 14:33:32.392  INFO 39079 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2019-11-05 14:33:32.398  INFO 39079 --- [           main] eModelDeploymentServiceParentApplication : Started ServiceModelDeploymentServiceParentApplication in 5.727 seconds (JVM running for 6.778)

Here are my pom dependencies:

<dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.kafka</groupId>
            <artifactId>kafka-streams</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka</artifactId>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.kafka</groupId>
            <artifactId>spring-kafka-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
</dependencies>

Note: You may be not needing all the dependencies above.

Upvotes: 41

Abd Abughazaleh
Abd Abughazaleh

Reputation: 5535

Add the below dependencies in pom.xml :

 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter</artifactId>
        </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-tomcat</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <scope>test</scope>
        </dependency>

Upvotes: 6

Aleksandr Sakharov
Aleksandr Sakharov

Reputation: 1342

Deleting provided scope of spring-boot-starter-tomcat dependency helps me.

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

Upvotes: 113

Related Questions