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
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); } }
Update packaging JAR to WAR
Added Tomcat starter dependency with scope as provided
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
Application properties
server.servlet.context-path=/GDriveAppJava
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.