0

thank you for your attention in reading my problem;

I'm trying to deploy a spring boot application but when I put it in the tomcat webapps folder it doesn't load my application, does anyone know what could be happening?

I already tried to run several versions of java changing the system variables, I used several versions of tomcat but none unzip the application

I'm using java version 17 and version apache-tomcat-9.0.71

Log Tomcat

Tomcat Past

4 Answers4

1

I thought Spring Boot came with a pre-installed web server, so there is no need to use this method. Why don't you use the current method which supports auto deployment of your application?

Wanjalize
  • 21
  • 2
1

An Spring Boot application is a ready to run jar file which contains tomcat/jetty and can be run with java -jar <your app>.jar. When you want to run an application in tomcat you should build a .war file.

======================================

As found here: https://stackoverflow.com/a/27905557/2144466

Did you follow this guide: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.traditional-deployment

and do you have a class which extends SpringBootServletInitializer andd overwrites the configure method: ` @SpringBootApplication public class MyApplication extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(MyApplication.class);
}

public static void main(String[] args) {
    SpringApplication.run(MyApplication.class, args);
}

`

Stian
  • 58
  • 1
  • 5
  • the war file was created correctly, however when I add it to the webapps folder in tomcat it does not start with the server in the log – Paulo Inácio Feb 16 '23 at 23:15
0

Please follow below.

  • Rename your war file at location webapps from web-0.0.1-SNAPSHOT.war to web.war
  • restart tomcat.
  • open url (http://localhost:8080/web) in browser.
Learner
  • 28
  • 5
  • Or you can go with jar build of spring boot and run `java -jar web.jar --server.port=9000` in commad prompt or terminal and open (http://localhost:9000/web) – Learner Feb 16 '23 at 21:43
  • I did that and it returned " HTTP Status 404 - Not Found " – Paulo Inácio Feb 16 '23 at 23:21
  • the project is not uploading in the log, will it be some incompatibility between versions of java, tomcat and maven? – Paulo Inácio Feb 16 '23 at 23:21
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 21 '23 at 11:37
0

I managed to solve the problem.

Apparently it was version incompatibility between spring, tomcat and java, by adjusting the system variables I can deploy both java 11 and java 17 applications.

Even though I managed to find a solution, I thank the friends above for dedicating their time to trying to solve my problem.