La distribuzione di Java Heroku sta fallendo


Continuo a ricevere questo errore quando provo a distribuire un server Java su Heroku.

inserisci qui la descrizione dell'immagine

2017-11-18T18:22:34.252354+00:00 heroku[router]: at=error code=H14 desc="No web 
processes running" method=GET path="/favicon.ico" host=javachatapp-dataserver.herokuapp.com request_id=e899dbbc-1687-470d-a14f-2fffd0cdba12 fwd="24.125.73.190" dyno= connect= service= status=503 bytes= protocol=https

2017-11-18T18:22:34.195269+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=javachatapp-dataserver.herokuapp.com request_id=f3363e55-f850-4235-90e2-6cb6468dc7e5 fwd="24.125.73.190" dyno= connect= service= status=503 bytes= protocol=https

Penso che abbia un percorso errato nel Profilo, perché quando Heroku sta costruendo, vedo questo errore:

2017-11-18T01:04:45.763178+00:00 heroku[web.1]: Starting process with command `java -jar ./target/chatappdataserver-1.0-jar-with-dependencies.jar`
2017-11-18T01:04:47.619837+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-11-18T01:04:47.620602+00:00 app[web.1]: Error: Unable to access jarfile ./target/chatappdataserver-1.0-jar-with-dependencies.jar

Ma questo è letteralmente ciò che il mio Procfile ha in esso:

web: java -jar ./target/chatappdataserver-1.0-SNAPSHOT-jar-with-dependencies.jar

Quando accedo a bash su heroku e avvio il server manualmente con il comando precedente funziona, ma non riesco a far avviare heroku il server con heroku open. Si blocca su ogni rilascio. Qualcuno l'ha mai visto prima?

Procfile in Heroku inserisci qui la descrizione dell'immagine


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.wisen.chatappdataserver</groupId>
    <artifactId>chatappdataserver</artifactId>
    <version>1.0-SNAPSHOT</version>


    <dependencies>
        <dependency>
            <groupId>com.sparkjava</groupId>
            <artifactId>spark-core</artifactId>
            <version>2.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptorRefs>
                        <!-- This tells Maven to include all dependencies -->
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>0.4.4</version>
                <configuration>
                    <jdkVersion>1.8</jdkVersion>
                    <appName>javachatapp-dataserver</appName>
                    <processTypes>
                        <!-- Tell Heroku how to launch your application -->
                        <web>java -jar ./target/chatappdataserver-1.0-jar-with-dependencies.jar</web>
                    </processTypes>
                </configuration>
            </plugin>
        </plugins>
    </build>



</project>
Author: wizeOnes, 2017-11-18

2 answers

Vedo due cose che sono interessanti.

Il tuo procfile si riferisce a

web: java -jar ./target/chatappdataserver-1.0-SNAPSHOT-jar-with-dependencies.jar

Che è ragionevole dal momento che il tuo pom definisce la versione come 1.0-SNAPSHOT ma Heroku cerca di trovare il file jar java -jar ./target/chatappdataserver-1.0-jar-with-dependencies.jar in base al log che hai condiviso.

Questo è strano e qualcosa che devi capire. Oppure cambia la tua versione nel tuo pom in 1.0

La versione

Non deve essere aggiunta con SNAPSHOT.

L'altra cosa che penso sia strana è che non si specifica il porta si prevede di utilizzare. Heroku assegna dinamicamente una porta e quindi indirizzerà le chiamate dal tuo host javachatapp-dataserver.herokuapp.com sulla porta 80 a questa porta assegnata dinamicamente.

Nel mio procfile, ho definito una porta come questa

-Dport=$PORT

Il mio procfile completo è simile a questo

web: java $JAVA_OPTS -Dport=$PORT -jar ./build/libs/tage-1.0-SNAPSHOT-all.jar

Sto costruendo usando Gradle in modo che il percorso del file jar sia diverso. Ma questa è l'unica grande differenza tra l'utilizzo di Maven e Gradle in questo contesto.

 2
Author: Thomas Sundberg, 2017-11-20 06:12:21

Prova a eseguire

$ heroku ps:scale web=1

Questo assicurerà che un banco di prova web sia in esecuzione. Qualcosa in una distribuzione precedente potrebbe aver causato il ridimensionamento.

 0
Author: codefinger, 2017-11-18 20:38:12