Deploy Springboot Tomcat

Asked

Viewed 110 times

0

I’m having trouble deploying my Springboot application to Tomcat on a linux VPS.

The server is working but links to Resources and other non-index pages are broken [Aplicação deployada[1]

   <
        <groupId>com.eduq</groupId>
        <artifactId>eduq-web-app</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <name>eduq-web-app</name>
        <description>EduQ Web Application</description>



        <dependencies>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-jpa</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-jdbc</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-thymeleaf</artifactId>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-web</artifactId>
                 </dependency>
                 <dependency>
                       <groupId>org.springframework.boot</groupId>
                        <artifactId>spring-boot-starter-tomcat</artifactId>


            </dependency>
                <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-devtools</artifactId>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.postgresql</groupId>
                <artifactId>postgresql</artifactId>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-test</artifactId>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.thymeleaf</groupId>
                <artifactId>thymeleaf-spring5</artifactId>
                <version>3.0.11.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>nz.net.ultraq.thymeleaf</groupId>
                <artifactId>thymeleaf-layout-dialect</artifactId>
            </dependency>
            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>webjars-locator</artifactId>
                <version>0.36</version>
            </dependency>
            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>bootstrap</artifactId>
                <version>4.3.1</version>
            </dependency>
            <dependency>
                <groupId>org.webjars</groupId>
                <artifactId>jquery</artifactId>
                <version>3.4.0</version>
            </dependency>
            <dependency>
                <groupId>com.sun.mail</groupId>
                <artifactId>javax.mail</artifactId>
            </dependency>
            <dependency>
               <groupId>org.json</groupId>
               <artifactId>json</artifactId>
               <version>20080701</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.datatype</groupId>
                <artifactId>jackson-datatype-json-org</artifactId>
            </dependency>
        </dependencies>

        <build>
            <plugins>
                <plugin>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-maven-plugin</artifactId>
                </plugin>
            </plugins>
        </build>

        <properties>
            <java.version>1.8</java.version>
            <thymeleaf.version>3.0.11.RELEASE</thymeleaf.version>
            <thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
            <tomcat.version>9.0.24</tomcat.version>

        </properties>

    </project>

spring.thymeleaf.mode=html
spring.thymeleaf.cache=false
spring.resources.add-mappings=true

server.servlet.contextPath = /

#datasource
spring.datasource.url = jdbc:postgresql://localhost:5432/eduq_v2
spring.datasource.username = postgres
spring.datasource.password = postgres
spring.datasource.driver-class-name = org.postgresql.Driver
spring.datasource.validationQuery = SELECT 1

#jpa/hibernate
spring.jpa.database=POSTGRESQL
spring.jpa.show-sql = true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
# Fix Postgres JPA Error:
# Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented.
spring.jpa.properties.hibernate.temp.use_jdbc_metadata_defaults=false
  • You developed it autoembedded and when going to production it was through a provided server? (aka not self-provisioned?)

  • exactly, but now do not know how to solve, I looked several tutorials and could not

  • Possibly the links to the resources are absolute relative to the root of the service and you are deploying it to an address that is not the root of Tomcat. I recommend trying to climb a test Cat (other than the self-boarded one) to see the behavior. It is also worth looking at the Tomcat logs which resources are being accessed. I’ve been through something similar and I don’t remember the outline, but I did it in local test yet

  • I’ve had a similar problem, it occurred because of an authentication filter. Compare some recent version that was working and see if any changes occurred in a class that implements Implements Containerrequestfilter or an equivalent in springBoot

  • @Jeffersonquesado , I’ll take a look

  • @cpll I will check

  • tries to reassemble the environment. Make the clone of it again.

  • I’ve done it hasn’t worked out yet

Show 3 more comments
No answers

Browser other questions tagged

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