Deployer of a Spring Boot Project

Asked

Viewed 224 times

4

I’m deploying my first project in Spring Boot + Angular. I have a linux server (centos) where I took a tutorial to install Tomcat: tutorial

The Tomcat is configured according to the tutorial, I’ve already been able to deploy a War but I’m having trouble accessing my Rest method. On the login screen when I click on the login button and follow by the Chrome Bugger, I can see that the POST is triggered, but it does not reach the Rest method to be able to authenticate.

And my return (Response.data) is an error 403: Access to the specified Resource has been Forbidden.

Can anyone tell me if there is any Tomcat configuration or in the spring boot project itself to get this access to my Rest class?

In development mode, everything works perfectly, now putting in a server is where this error occurs.

I’m using it to develop IDE Intellij.

2 answers

3

Spring boot comes with a built-in Tomcat server ready to run as JAR. For it to work as a WAR the initial class Main must extend the class Springbootservletinitializer.

@SpringBootApplication
public class SpringBootWebApplication extends SpringBootServletInitializer {

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

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

}

It would be interesting to take a look at the built-in servers. Follow spring documentation on this.

https://docs.spring.io/spring-boot/docs/current/reference/html/howto-embedded-servlet-containers.html

0


I did the checking to see if my Main class made the extend for Springbootservletinitializer and yes, there was this extension.

One thing I noticed was the lack of permission to access files, at least the message said so, so I went to search and found nothing concrete about it.

I made a full release of my server’s Tomcat folder, the problem has been solved:

chmod -R 777 /opt/tomcat

I hope it helps!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.