Devanshi
Devanshi

Reputation: 77

How to solve H14 error in Heroku?

I am trying to deploy war file using spring boot app usng maven plugin in heroku.

The error code that I am getting on deploying it is:

2018-03-10T05:47:07.563714+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=patiyati.herokuapp.com request_id=ebb35d7d-1fff-484f-8f58-faccd506b002 fwd="171.76.43.17" dyno= connect= service= status=503 bytes= protocol=https

my pom.xml is as shown below:

<?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>

    <artifactId>Patiyati</artifactId>
    <packaging>war</packaging>
    <name>Patiyati</name>
    <description>Patiyati</description>
    <version>1.0</version>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
    </parent>

    <properties>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>

        <!-- Web -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

        <!-- Web with Tomcat + Embed -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- JSTL -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-mongodb</artifactId>
        </dependency>

        <!-- Need this to compile JSP -->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <!-- Need this to compile JSP -->
        <dependency>
            <groupId>org.eclipse.jdt.core.compiler</groupId>
            <artifactId>ecj</artifactId>
            <version>4.6.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- Optional, for bootstrap -->
        <dependency>
            <groupId>org.webjars</groupId>
            <artifactId>bootstrap</artifactId>
            <version>3.3.7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20180130</version>
        </dependency>

    </dependencies>
    <build>
        <plugins>
            <!-- Package as an executable jar/war -->
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.heroku.sdk</groupId>
                <artifactId>heroku-maven-plugin</artifactId>
                <version>2.0.3</version>
                <configuration>
                    <appName>patiyati</appName>
                    <warFile>target/Patiyati-1.0.war</warFile>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

I have gone through many similar questions and have tried implementing those but none was of use... On using Heroku ps:scale web=1 -a patiyati I get "Couldn't find process type error"

I followed the steps given in the document heroku deployment using maven plugin, but it provides me the same result.

On adding a procfile :

web: java $JAVA_OPTS -cp target/classes:target/dependency/* com.spring.app.SpringBootWebApplication

Where SpringBootWebApplication is my main class and is under com.spring.app package.

Now i get app crash as a result

2018-03-10T08:31:39.460117+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=patiyati.herokuapp.com request_id=59d88594-c17f-4003-8527-722d780f475c fwd="171.76.43.17" dyno= connect= service= status=503 bytes= protocol=https

It would be great if anybody could help me solve this issue. Thanks in advance.

Upvotes: 3

Views: 2733

Answers (2)

carbonmonoxide
carbonmonoxide

Reputation: 41

I had same problem. I removed <packaging>war</packaging> line from pom.xml then pushed and it started working. I hope it helps someone

Upvotes: 1

Ram
Ram

Reputation: 1803

Add a Procfile in your application root directory with below entry and push the app.

web: java -jar $JAVA_OPTS -Dserver.port=$PORT target/your-app-name-version.jar

EDIT

Just realized from your pom.xml that you're packaging as war. Please refer here on war deployment to heroku.

Upvotes: 7

Related Questions