javaterminal / cloudterm

Cloud Web Terminal Emulator. Opens your terminal to Web.
MIT License
78 stars 37 forks source link

Cloud Web Terminal running in Tomcat #2

Open jesussaad opened 6 years ago

jesussaad commented 6 years ago

Could you help me please open the terminal page when deployed in Tomcat? I know the best way to run the cloudterm is standalone way from JAR, but I have no permissions for that in my Server, so I need run in Tomcat

This is my scenario was tried:

rahmanusta commented 6 years ago

Plus you need to setup a SpringBootServletInitializer class if you want to deploy it to standard servlet container. This will be picked up by tomcat and initialize your app.

See https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html

jesussaad commented 6 years ago

Thanks man! Could you help me again found whats wrong is happen? I do three changes like described in https://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html and keep not working, but at least now is possible to see a evolution because when I access http://localhost:8080/cloudterm/ a blank web page is showing, but none is showing up in the log.

This is my complete pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

     <groupId>com.example</groupId>
    <artifactId>cloudterm</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>cloudterm</name>
    <description>Cloud Web Terminal</description>

  <parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.6.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
  </parent>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.8</java.version>
    <maven-jar-plugin.version>3.0.2</maven-jar-plugin.version>
    <maven-compiler-plugin.version>3.6.2</maven-compiler-plugin.version>
  </properties>

  <dependencies>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-freemarker</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-websocket</artifactId>
    </dependency>

    <dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-tomcat</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.kodedu.pty4j</groupId>
      <artifactId>pty4j</artifactId>
      <version>0.7.4</version>
    </dependency>

  </dependencies>

  <repositories>
    <repository>
      <id>pty4j-releases</id>
      <url>https://github.com/javaterminal/pty4j/raw/master/releases</url>
    </repository>
  </repositories>

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <finalName>cloudterm</finalName>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>

This is my main class changed:

package com.kodedu.cloudterm;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;

@SpringBootApplication
public class AppStarter extends SpringBootServletInitializer
{
    public static void main(String[] args) {

        SpringApplication.run(AppStarter.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {

        return application.sources(AppStarter.class);
    }
}

And this is the log from catalina.out in app startup: catalina.2018-06-13.log

PS.: I did the tests in Tomcat 8.0.52 (my current version) and Tomcat 8.5.31 (just for conference) PS2.: I tried the cloudterm-0.0.1-SNAPSHOT.war and cloudterm.war files generated by "mvn clean install" from target folder and the result is the same

jesussaad commented 6 years ago

Plus I tried with Spring Boot 1.5.13.RELEASE and with ServletInitializer class like https://start.spring.io and the same blank page is showing. Follow attached the Tomcat 8.0.52 log catalina.out.log

rahmanusta commented 6 years ago

Normally it should work, but it didn't work for me too. ServletIinitializer isn't triggered.