brunobrasilweb / springboot-adminlte2

Spring Boot with template adminlte2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Deploying War on Tomcat 8 container

ullakhan opened this issue · comments

Thanks for this project which helps me to start off with Thymleadfand AdminLTE integration.
It is working fine with the spring boot's embedded tomcat container and able to see the screen as expected,but having a trouble which deploying the war on external tomcat 8 or wildfly 10 servers.
The following thing i have followed to make sure it is deployed correctly on JEE containers.

  1. Changed the package from "jar" to "war" in pom.xml
    war

  2. Extended the SistemaApplication.java class like below:
    public class SistemaApplication extends SpringBootServletInitializer {

     public static void main(String[] args) {
           		SpringApplication.run(SistemaApplication.class, args);
        }
     	@Override
    

    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(SistemaApplication.class);
    }
    }

  3. Changed the pom.xml like below:

    org.springframework.boot
    spring-boot-starter-web


    org.springframework.boot
    spring-boot-starter-tomcat


  4. Add the servlet api 3.1.0 to pom.xml

    javax.servlet
    javax.servlet-api
    3.1.0
    provided

  5. Clean the project from Eclipse and did the maven install.

  6. Running on tomcat 8 server it is launching the login page.Once we enter the credentials the main screen is not showing as expected.

spring_admin_lte

Could you please let know am I missing anything .?

Thanks,
Nyamath Ulla Khan

Hi Nyamath

The problem is because you have to use for ex: http://myapp.test is not http://localhost:8080/Spring_AdminLte2 for find CSS and JS.

Try the console: mvn spring-boot:run or mvnw spring-boot:run for windows your app path diretory.

Hi Bruno,

As i have already mentioned it works fine with Embedded Tomcat container.
I am running it on Tomcat 8 externally port 8080 from Eclipse instead of Embedded tomcat container.

If I run through the below command which you shared:
SVE1511AENB:~/projects/AdminLTE/springboot-adminlte2$ mvn spring-boot:run

2017-01-04 22:00:37.532 ERROR 25620 --- [ main] o.s.boot.SpringApplication : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.context.ApplicationContextException: Unable to start EmbeddedWebApplicationContext due to missing EmbeddedServletContainerFactory bean.

I think the above error is popping up because I have excluded tomcat the from spring-boot-starter-web.

  <spring-boot-starter-tomcat>

Please let me know if you are able to deploy it externally on tomcat 8 OR any advice me what am I supposed to do to run properly on Servers like Wildfly 10/Tomcat 8.

Thanks,
Nyamath Ulla Khan