1

I buy a domain name: test.com.

Then I run jetty by doing:

/opt/jetty# nohup java -jar start.jar

When I go on my web site (http://test.com), It's not working, I need to add the port number like: http://test.com:8080 and this is very dirty. So, I want to delete or hide this port number.

What I tried is to run jetty with the port number like:

nohup java -jar start.jar -Djetty.http.port=8080

Then, in the file jetty-http.xml (in /opt/jetty/etc), I changed the line:

<Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="8080" /></Set>

I am using:

  • Vaadin.
  • Maven.
  • Jetty.

Where should I manage this?

EDIT :

As required, this is the 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>test</artifactId>
    <packaging>war</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>test</name>

    <prerequisites>
        <maven>3</maven>
    </prerequisites>

    <properties>
        <vaadin.version>8.0.4</vaadin.version>
        <vaadin.plugin.version>8.0.4</vaadin.plugin.version>
        <jetty.plugin.version>9.3.9.v20160517</jetty.plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <jetty.port>8080</jetty.port>
        <vaadin.widgetset.mode>local</vaadin.widgetset.mode>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-bom</artifactId>
                <version>${vaadin.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-compatibility-client-compiled</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-client-compiled</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-themes</artifactId>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.0.1</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                    <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.vaadin</groupId>
                <artifactId>vaadin-maven-plugin</artifactId>
                <version>${vaadin.plugin.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>update-theme</goal>
                            <goal>update-widgetset</goal>
                            <goal>compile</goal>
                            <goal>compile-theme</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-clean-plugin</artifactId>
                <version>3.0.0</version>
                <configuration>
                    <filesets>
                        <fileset>
                            <directory>src/main/webapp/VAADIN/themes</directory>
                            <includes>
                                <include>**/styles.css</include>
                                <include>**/styles.scss.cache</include>
                            </includes>
                        </fileset>
                    </filesets>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.plugin.version}</version>
                <configuration>
                    <contextPath>/login</contextPath>
                    <scanIntervalSeconds>2</scanIntervalSeconds>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

To prevent question, I tried to delete the <jetty.port>8080</jetty.port> without sucess.

EDIT : Based on maven jetty plugin - remove localhost/server name from url

I tried to changed the localhostto myapplicationname from /etc/hosts. I restart jetty. And, it's not working

Bob
  • 529
  • 1
  • 7
  • 28

1 Answers1

-1

If I understand the problem correctly, you need to use the 80 port as the Jetty's one (jetty.http.port), because http://test.com/ means that the port is the default — 80.

Additional references:

  1. networking - Why was port 80 chosen as the default HTTP port and 443 as the default HTTPS port? - Super User.
  2. java - Change Jetty default port - Stack Overflow.

Update

This sentence clarifies the problem a little bit:

I'm sorry, I don't know how I can provide more.. I installed Jetty 9 on a debian

— Bob, the original message.

Edit the /etc/default/jetty9 file as follows:

# Additional arguments to pass to Jetty
JETTY_ARGS=jetty.port=80

# If you run Jetty on port numbers that are all higher than 1023, then you
# do not need authbind. It is used for binding Jetty to lower port numbers.
# (yes/no, default: no)
AUTHBIND=yes

Then, restart the Jetty server:

# service jetty9 restart