Quantcast
Channel: Active questions tagged servlets - Stack Overflow
Viewing all articles
Browse latest Browse all 675

SpringBoot API calls causing a 404, i have no access to my backend on tomcat9 server

$
0
0

I have built a webapp using springboot with a react frontend and when I run the app locally I can use my REST API calls without any issue. Once I package everything up into a war file and deploy it to my tomcat server on my VM I can no longer access my backend.

On the catalina.out log file there are no errors appearing however theres also no indication of the springboot app starting. This is all I am getting.

17-Jul-2024 19:20:56.108 INFO [http-nio-0.0.0.0-8080-exec-2] org.apache.catalina.startup.HostConfig.deployWAR Deploying web application archive [/opt/tomcat/webapps/record-retention.war]17-Jul-2024 19:20:56.305 WARNING [http-nio-0.0.0.0-8080-exec-2] org.apache.tomcat.util.descriptor.web.WebXml.setVersion Unknown version string [5.0]. Default version will be used.17-Jul-2024 19:20:58.396 INFO [http-nio-0.0.0.0-8080-exec-2] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that werening can improve startup time and JSP compilation time.17-Jul-2024 19:20:58.416 INFO [http-nio-0.0.0.0-8080-exec-2] org.apache.catalina.startup.HostConfig.deployWAR Deployment of web application archive [/opt/tomcat/webapps/record-retention.war] has finished in [2,308] ms

This is my App class.

import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;import org.springframework.boot.builder.SpringApplicationBuilder;import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;@SpringBootApplicationpublic class App extends SpringBootServletInitializer{    public static void main(String[] args) {            SpringApplication.run(App.class, args);      }    @Override    protected SpringApplicationBuilder configure(SpringApplicationBuilder application){        return application.sources(App.class);    }}

The build portion of my pom.xml

<build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin><plugin><groupId>com.github.eirslett</groupId><artifactId>frontend-maven-plugin</artifactId><version>1.12.1</version><executions><execution><id>Install node and npm</id><goals><goal>install-node-and-npm</goal></goals><configuration><nodeVersion>v20.14.0</nodeVersion><npmVersion>10.8.1</npmVersion></configuration></execution><execution><id>npm install</id><goals><goal>npm</goal></goals><phase>generate-resources</phase><configuration><arguments>install</arguments><workingDirectory>src/main/record-retention-ui</workingDirectory></configuration></execution><execution><id>npm build</id><goals><goal>npm</goal></goals><phase>generate-resources</phase><configuration><arguments>run build</arguments><workingDirectory>src/main/record-retention-ui</workingDirectory></configuration></execution></executions><configuration><workingDirectory>src/main/record-retention-ui</workingDirectory></configuration></plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-resources-plugin</artifactId><executions><execution><id>Copy JavaScript app into Springboot</id><phase>process-resources</phase><goals><goal>copy-resources</goal></goals><configuration><outputDirectory>${project.build.directory}/${project.build.finalName}/</outputDirectory><resources><resource><directory>src/main/record-retention-ui/build</directory><filtering>false</filtering></resource></resources></configuration></execution></executions></plugin></plugins></build>

Previous to posting I've attacking this problem for 2 days with no avail, I implemented the servletInitializer as I didn't have that initially. I have no issue accessing the frontend through the server I just cant make any API calls.

This is my first time attempting to deploy a webapp to a server so any help/advice is greatly appreciated. If more information is needed I can provide it!


Viewing all articles
Browse latest Browse all 675

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>