Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Web Terminal running in Tomcat #2

Open
jesussaad opened this issue Jun 12, 2018 · 4 comments
Open

Cloud Web Terminal running in Tomcat #2

jesussaad opened this issue Jun 12, 2018 · 4 comments

Comments

@jesussaad
Copy link

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:

  • I change the "packaging" pom.xml option to war;
  • Change the "java.version" pom.xml option to 1.8;
  • Run the tomcat 8.0.52;
  • Deploy the cloudterm.war by Tomcat manager app;
  • I try access the terminal in browser: http://localhost:8080/cloudterm/
  • The expected terminal page is not showing, just the "HTTP Status 404"
@rahmanusta
Copy link
Collaborator

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
Copy link
Author

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
Copy link
Author

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants