Deployer of a Spring Boot project

4

I'm doing a deployer of my first project in Spring Boot + Angular. I have a linux server (centos) where I took a tutorial to install tomcat: tutorial

Tomcat is configured according to the tutorial, I've already been able to deployer a war, but I'm having problems accessing my rest method. On the login screen when I click the login button and I follow the Chrome debugger, I can see that the POST is triggered, but it does not reach method rest to be able to authenticate.

And my return (response.data) is a 403 error: Access to the specified resource has been forbidden.

Does anyone know how to tell me if there is any setting in tomcat or in the spring boot project itself to get this access to my rest class?

In development mode, everything works perfectly, now putting it on a server is where that error occurs.

I'm using to develop the Intellij IDE.

    
asked by anonymous 05.07.2017 / 15:04

2 answers

0

I checked to see if my Main class was extending to SpringBootServletInitializer and yes, there was that 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 the tomcat folder from my server, the problem was solved:

chmod -R 777 /opt/tomcat

I hope it helps!

    
06.07.2017 / 15:20
3

Spring boot comes with a tomcat server built in and ready to run as JAR. In order for it to function as a WAR the main class Main must extend the SpringBootServletInitializer class.

@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 about it.

link

    
05.07.2017 / 18:19