Situation: I use Spring Boot . When I run from under the IDE , as I understand it, the built-in TomCat rises and the application is already deployed in it, everything works fine, you can quickly test it, etc. ... as I understand it, the main convenience of Spring Boot .

Now I want to close the application to the combat server. To do this, I generate a war, which by the way weighs decently, and I try to deploy it. I get this error:

FAIL - Application at the context path / test could not be started FAIL - Encountered exception org.apache.catalina.LifecycleException: Failed to start component [StandardEngine [Catalina] .StandardHost [localhost] .StandardContext [/ test]]

When I start the server on the command line, I also see the word SPRING in ascii art, which I thought was wrong: does he accidentally raise a server on the server when deploying my application, maybe this is an error?

Maybe war need some other method to generate? Now I generate the package command.

Here is pom.xml

 <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.1.RELEASE</version> </parent> <dependencies> <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> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> 

Who is using Spring Boot please tell me what is my mistake, maybe I'm doing something wrong in principle?

1 answer 1

Try this:

 <!-- ... --> <packaging>war</packaging> <!-- ... --> <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> <scope>provided</scope> </dependency> <!-- ... --> </dependencies> 

And also if you run your project at all. Build it into a jar file and run it from the terminal java -jar file_name.jar

http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#build-tool-plugins-maven-packaging

  • after adding the <scope>provided</scope> nothing has changed, I tried to run the generated jar, the built-in server went up. - droid
  • @droid did you add the spring-boot-starter-tomcat dependency? - GVArt
  • yes, right, just wrote wrong, added a dependency completely, after that the output war picked up a few mb - droid
  • The problem is how to start the application, check the logs logs/catalina.out - GVArt
  • judging by the logs, such an error is the following: Annotation-specified bean name 'mainController' for bean class [***.MainController] conflicts with existing, non-compatible bean definition of same name and class [***.MainController]