简体   繁体   中英

How to resolve the requested resource is not available error in spring boot which runs on tomcat server?

I had successfully run my spring boot application in localhost.

在此处输入图像描述

But when I had run it from the CWP panel tomcat server, I am getting the error given below. How to resolve this error? Do I need anything else to run on a CWP panel tomcat server?

在此处输入图像描述

Steps which I had followed

  1. Extends the SpringBootServletInitializer class in the main class.

     @SpringBootApplication public class GDriveAppJavaApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure( SpringApplicationBuilder builder) { return builder.sources(GDriveAppJavaApplication.class); } public static void main(String[] args) { SpringApplication.run(GDriveAppJavaApplication.class, args); } }
  2. Update packaging JAR to WAR

  3. Added Tomcat starter dependency with scope as provided

     <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
  4. Application properties

     server.servlet.context-path=/GDriveAppJava
  5. Generated war file and copied to webapps folder in the tomcat

在此处输入图像描述

Step 1: You need to generate a war file and deploy it to the tomcat server. Referring to https://codezup.com/deploy-spring-boot-war-to-external-tomcat/ for generating war file.

Step 2: Search the war file to target folder. Then rename the war file. for example: gdapp.war. Then depoloy the.war file to the tomcat server.

Step 3: Access the application using the file name in the URL. example: gdapp/GDriveAppJava/...

Note: Make sure you have configured your database properly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM