0

I keep getting this error when trying to deploy a Java server to Heroku.

enter image description here

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

I think it has an incorrect path in the Profile, because when Heroku is building, I see this Error:

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

But this is literally what my Procfile has in it:

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

When I log into bash on heroku, and start the server manually with the above command it works, but I can't seem to get heroku to start the server with heroku open. It crashes on every release. Has anyone seen this before?

Procfile in Heroku enter image description here


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>

3 Answers 3

2

I see two thing that are interesting.

Your procfile refers to

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

Which is reasonable since your pom defines the version as 1.0-SNAPSHOT but Heroku tries to find the jar file java -jar ./target/chatappdataserver-1.0-jar-with-dependencies.jar according to the log you shared.

That is strange and something you need to understand. Or change your version in your pom to 1.0

Version don't have to be appended with SNAPSHOT.

The other thing that I think is strange is that you don't specify the port you will be using. Heroku dynamically assigns a port and they will then route calls from your host javachatapp-dataserver.herokuapp.com on port 80 to this dynamically assigned port.

In my procfile, I have defined a port like this

-Dport=$PORT

My complete procfile looks like this

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

I'm building using Gradle so the path to the jar file is different. But thats the only big difference between using Maven and Gradle in this context.

Sign up to request clarification or add additional context in comments.

1 Comment

It was because the web process in the pom.xml file was referring to: java -jar ./target/chatappdataserver-1.0-jar-with-dependencies.jar. I changed it to: web: java -jar ./target/chatappdataserver-1.0-SNAPSHOT-jar-with-dependencies.jar, and everything worked.
0

Try running

$ heroku ps:scale web=1

This will ensure a web dyno is running. Something in a previous deploy may have caused it to scale down.

9 Comments

When I run that command it says couldn't find that process type. I am actually on the free tier in heroku, and already have a repo deployed; might that be the reason to why it isn't working?
Are you deploying with Git? Is your Procfile checked in?
I deployed using maven: mvn heroku: deploy, heroku open. However, the first time I deployed, it was via git: git push heroku master, heroku open. I deleted that entire repo from Heroku, and re-deployed using maven.
What config is in your pom.xml?
Yes, it was the web process, thank you for your help!
|
0

The problem is in:

<!-- Tell Heroku how to launch your application -->
<web>java -jar ./target/chatappdataserver-1.0-jar-with-dependencies.jar</web>

You must write the name of your artifactId-version-descriptorRef.jar in your case: chatappdataserver-1.0-SNAPSHOT-jar-with-dependencies.jar

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.