Java: 缩放测功机错误 JSP Heroku

Java: Scaling dynos error JSP Heroku

我正在尝试在 heroku 上部署我的 jsp 网络应用程序,遵循 documentation 的所有步骤,我正在使用 webapp-runner,我在根目录中创建了 Procfile我的项目的内容

web:    java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war

但是 运行 heroku ps:scale web=1 显示,

Scaling dynos... !
 !    Couldn't find that process type.

这是我的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.alumniassociation</groupId>
    <artifactId>AlumniAssociationDB</artifactId>
    <version>1.0</version>

    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>3.0.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.github.jsimone</groupId>
                                    <artifactId>webapp-runner</artifactId>
                                    <version>8.5.15.0</version>
                                    <destFileName>webapp-runner.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

我读过有类似问题的问题,但其中 none 个正在使用 java。

编辑- 这是日志

2017-08-28T22:06:39.139623+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 15661 target/*.war`
2017-08-28T22:06:41.064738+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-08-28T22:06:41.068301+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8 
2017-08-28T22:06:41.308912+00:00 app[web.1]: The specified path "target/*.war" does not exist.
2017-08-28T22:06:41.312373+00:00 app[web.1]: Usage: <main class> [options] 
2017-08-28T22:06:41.312375+00:00 app[web.1]:   Options:
2017-08-28T22:06:41.312375+00:00 app[web.1]:     --basic-auth-pw
2017-08-28T22:06:41.312376+00:00 app[web.1]:        Password to be used with basic auth. Defaults to BASIC_AUTH_PW env
2017-08-28T22:06:41.312376+00:00 app[web.1]:        variable.
2017-08-28T22:06:41.312377+00:00 app[web.1]:     --basic-auth-user
2017-08-28T22:06:41.312377+00:00 app[web.1]:        Username to be used with basic auth. Defaults to BASIC_AUTH_USER env
2017-08-28T22:06:41.312378+00:00 app[web.1]:        variable.
2017-08-28T22:06:41.312378+00:00 app[web.1]:     --bind-on-init
2017-08-28T22:06:41.312379+00:00 app[web.1]:        Controls when the socket used by the connector is bound. By default it is
2017-08-28T22:06:41.312379+00:00 app[web.1]:        bound when the connector is initiated and unbound when the connector is
2017-08-28T22:06:41.312380+00:00 app[web.1]:        destroyed., default value: true
2017-08-28T22:06:41.312380+00:00 app[web.1]:        Default: true
2017-08-28T22:06:41.312381+00:00 app[web.1]:     --compressable-mime-types
2017-08-28T22:06:41.312381+00:00 app[web.1]:        Comma delimited list of mime types that will be compressed when using
2017-08-28T22:06:41.312381+00:00 app[web.1]:        GZIP compression.
2017-08-28T22:06:41.312382+00:00 app[web.1]:        Default: text/html,text/xml,text/plain,text/css,application/json,application/xml,text/javascript,application/javascript
2017-08-28T22:06:41.312382+00:00 app[web.1]:     --context-xml
2017-08-28T22:06:41.312382+00:00 app[web.1]:        The path to the context xml to use.
2017-08-28T22:06:41.312383+00:00 app[web.1]:     --enable-basic-auth
2017-08-28T22:06:41.312383+00:00 app[web.1]:        Secure the app with basic auth. Use with --basic-auth-user and
2017-08-28T22:06:41.312384+00:00 app[web.1]:        --basic-auth-pw or --tomcat-users-location
2017-08-28T22:06:41.312384+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312384+00:00 app[web.1]:     --enable-client-auth
2017-08-28T22:06:41.312385+00:00 app[web.1]:        Specify -Djavax.net.ssl.keyStore and -Djavax.net.ssl.keyStorePassword in
2017-08-28T22:06:41.312385+00:00 app[web.1]:        JAVA_OPTS
2017-08-28T22:06:41.312385+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312386+00:00 app[web.1]:     --enable-compression
2017-08-28T22:06:41.312386+00:00 app[web.1]:        Enable GZIP compression on responses
2017-08-28T22:06:41.312387+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312387+00:00 app[web.1]:     --enable-naming
2017-08-28T22:06:41.312387+00:00 app[web.1]:        Enables JNDI naming
2017-08-28T22:06:41.312387+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312388+00:00 app[web.1]:     --enable-ssl
2017-08-28T22:06:41.312388+00:00 app[web.1]:        Specify -Djavax.net.ssl.keyStore, -Djavax.net.ssl.keystoreStorePassword,
2017-08-28T22:06:41.312389+00:00 app[web.1]:        -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword in JAVA_OPTS. Note: should not be
2017-08-28T22:06:41.312389+00:00 app[web.1]:        used if a reverse proxy is terminating SSL for you (such as on Heroku)
2017-08-28T22:06:41.312389+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312390+00:00 app[web.1]:     --expand-war-file
2017-08-28T22:06:41.312390+00:00 app[web.1]:        Expand the war file and set it as source
2017-08-28T22:06:41.312390+00:00 app[web.1]:        Default: true
2017-08-28T22:06:41.312391+00:00 app[web.1]:     --expanded-dir-name
2017-08-28T22:06:41.312391+00:00 app[web.1]:        The name of the directory the WAR file will be expanded into.
2017-08-28T22:06:41.312391+00:00 app[web.1]:        Default: expanded
2017-08-28T22:06:41.312392+00:00 app[web.1]:     --help
2017-08-28T22:06:41.312392+00:00 app[web.1]:        
2017-08-28T22:06:41.312393+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312393+00:00 app[web.1]:     --max-threads
2017-08-28T22:06:41.312393+00:00 app[web.1]:        Set the maximum number of worker threads
2017-08-28T22:06:41.312393+00:00 app[web.1]:        Default: 0
2017-08-28T22:06:41.312394+00:00 app[web.1]:     --path
2017-08-28T22:06:41.312394+00:00 app[web.1]:        The context path
2017-08-28T22:06:41.312394+00:00 app[web.1]:        Default: <empty string>
2017-08-28T22:06:41.312395+00:00 app[web.1]:     --port
2017-08-28T22:06:41.312395+00:00 app[web.1]:        The port that the server will accept http requests on.
2017-08-28T22:06:41.312395+00:00 app[web.1]:        Default: 8080
2017-08-28T22:06:41.312396+00:00 app[web.1]:     --proxy-base-url
2017-08-28T22:06:41.312396+00:00 app[web.1]:        Set proxy URL if tomcat is running behind reverse proxy
2017-08-28T22:06:41.312396+00:00 app[web.1]:        Default: <empty string>
2017-08-28T22:06:41.312397+00:00 app[web.1]:     --scanBootstrapClassPath
2017-08-28T22:06:41.312397+00:00 app[web.1]:        Set jar scanner scan bootstrap classpath.
2017-08-28T22:06:41.312397+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312398+00:00 app[web.1]:     --session-store
2017-08-28T22:06:41.312398+00:00 app[web.1]:        Session store to use (valid options are 'memcache' or 'redis')
2017-08-28T22:06:41.312398+00:00 app[web.1]:     --session-store-ignore-pattern
2017-08-28T22:06:41.312399+00:00 app[web.1]:        Request pattern to not track sessions for. Valid only with memcache
2017-08-28T22:06:41.312399+00:00 app[web.1]:        session store. (default is '.*\.(png|gif|jpg|css|js)$'
2017-08-28T22:06:41.312399+00:00 app[web.1]:        Default: .*\.(png|gif|jpg|css|js)$
2017-08-28T22:06:41.312400+00:00 app[web.1]:     --session-store-locking-mode
2017-08-28T22:06:41.312400+00:00 app[web.1]:        Session locking mode for use with memcache session store. (default is
2017-08-28T22:06:41.312400+00:00 app[web.1]:        all)
2017-08-28T22:06:41.312401+00:00 app[web.1]:        Default: all
2017-08-28T22:06:41.312401+00:00 app[web.1]:     --session-store-operation-timeout
2017-08-28T22:06:41.312401+00:00 app[web.1]:        Operation timeout for the memcache session store. (default is 5000ms)
2017-08-28T22:06:41.312402+00:00 app[web.1]:        Default: 5000
2017-08-28T22:06:41.312402+00:00 app[web.1]:     --session-timeout
2017-08-28T22:06:41.312402+00:00 app[web.1]:        The number of minutes of inactivity before a user's session is timed out.
2017-08-28T22:06:41.312403+00:00 app[web.1]:     --shutdown-override
2017-08-28T22:06:41.312403+00:00 app[web.1]:        Overrides the default behavior and casues Tomcat to ignore lifecycle
2017-08-28T22:06:41.312403+00:00 app[web.1]:        failure events rather than shutting down when they occur.
2017-08-28T22:06:41.312404+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312404+00:00 app[web.1]:     --temp-directory
2017-08-28T22:06:41.312404+00:00 app[web.1]:        Define the temp directory, default value: ./target/tomcat.PORT
2017-08-28T22:06:41.312408+00:00 app[web.1]:     --tomcat-users-location
2017-08-28T22:06:41.312408+00:00 app[web.1]:        Location of the tomcat-users.xml file. (relative to the location of the
2017-08-28T22:06:41.312409+00:00 app[web.1]:        webapp-runner jar file)
2017-08-28T22:06:41.312409+00:00 app[web.1]:     --uri-encoding
2017-08-28T22:06:41.312409+00:00 app[web.1]:        Set the URI encoding to be used for the Connector.
2017-08-28T22:06:41.312410+00:00 app[web.1]:     --use-body-encoding-for-uri
2017-08-28T22:06:41.312410+00:00 app[web.1]:        Set if the entity body encoding should be used for the URI.
2017-08-28T22:06:41.312410+00:00 app[web.1]:        Default: false
2017-08-28T22:06:41.312411+00:00 app[web.1]:     -A
2017-08-28T22:06:41.312411+00:00 app[web.1]:        Allows setting HTTP connector attributes. For example: -Acompression=on
2017-08-28T22:06:41.312411+00:00 app[web.1]:        Syntax: -Akey=value
2017-08-28T22:06:41.312412+00:00 app[web.1]:        Default: {}
2017-08-28T22:06:41.312414+00:00 app[web.1]: 
2017-08-28T22:06:41.396632+00:00 heroku[web.1]: Process exited with status 1
2017-08-28T22:06:45.605029+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port 18827 target/*.war`
2017-08-28T22:06:48.421998+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2017-08-28T22:06:48.430508+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx350m -Xss512k -Dfile.encoding=UTF-8 
2017-08-28T22:06:49.252921+00:00 app[web.1]: The specified path "target/*.war" does not exist.
2017-08-28T22:06:49.258063+00:00 app[web.1]: Usage: <main class> [options] 
2017-08-28T22:06:49.258065+00:00 app[web.1]:   Options:
2017-08-28T22:06:49.258065+00:00 app[web.1]:     --basic-auth-pw
2017-08-28T22:06:49.258066+00:00 app[web.1]:        Password to be used with basic auth. Defaults to BASIC_AUTH_PW env
2017-08-28T22:06:49.258067+00:00 app[web.1]:        variable.
2017-08-28T22:06:49.258068+00:00 app[web.1]:     --basic-auth-user
2017-08-28T22:06:49.258069+00:00 app[web.1]:        Username to be used with basic auth. Defaults to BASIC_AUTH_USER env
2017-08-28T22:06:49.258069+00:00 app[web.1]:        variable.
2017-08-28T22:06:49.258070+00:00 app[web.1]:     --bind-on-init
2017-08-28T22:06:49.258071+00:00 app[web.1]:        Controls when the socket used by the connector is bound. By default it is
2017-08-28T22:06:49.258071+00:00 app[web.1]:        bound when the connector is initiated and unbound when the connector is
2017-08-28T22:06:49.258072+00:00 app[web.1]:        destroyed., default value: true
2017-08-28T22:06:49.258073+00:00 app[web.1]:        Default: true
2017-08-28T22:06:49.258073+00:00 app[web.1]:     --compressable-mime-types
2017-08-28T22:06:49.258074+00:00 app[web.1]:        Comma delimited list of mime types that will be compressed when using
2017-08-28T22:06:49.258074+00:00 app[web.1]:        GZIP compression.
2017-08-28T22:06:49.258075+00:00 app[web.1]:        Default: text/html,text/xml,text/plain,text/css,application/json,application/xml,text/javascript,application/javascript
2017-08-28T22:06:49.258076+00:00 app[web.1]:     --context-xml
2017-08-28T22:06:49.258077+00:00 app[web.1]:        The path to the context xml to use.
2017-08-28T22:06:49.258077+00:00 app[web.1]:     --enable-basic-auth
2017-08-28T22:06:49.258078+00:00 app[web.1]:        Secure the app with basic auth. Use with --basic-auth-user and
2017-08-28T22:06:49.258079+00:00 app[web.1]:        --basic-auth-pw or --tomcat-users-location
2017-08-28T22:06:49.258079+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258080+00:00 app[web.1]:     --enable-client-auth
2017-08-28T22:06:49.258081+00:00 app[web.1]:        Specify -Djavax.net.ssl.keyStore and -Djavax.net.ssl.keyStorePassword in
2017-08-28T22:06:49.258081+00:00 app[web.1]:        JAVA_OPTS
2017-08-28T22:06:49.258082+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258083+00:00 app[web.1]:     --enable-compression
2017-08-28T22:06:49.258083+00:00 app[web.1]:        Enable GZIP compression on responses
2017-08-28T22:06:49.258084+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258085+00:00 app[web.1]:     --enable-naming
2017-08-28T22:06:49.258085+00:00 app[web.1]:        Enables JNDI naming
2017-08-28T22:06:49.258086+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258086+00:00 app[web.1]:     --enable-ssl
2017-08-28T22:06:49.258087+00:00 app[web.1]:        Specify -Djavax.net.ssl.keyStore, -Djavax.net.ssl.keystoreStorePassword,
2017-08-28T22:06:49.258088+00:00 app[web.1]:        -Djavax.net.ssl.trustStore and -Djavax.net.ssl.trustStorePassword in JAVA_OPTS. Note: should not be
2017-08-28T22:06:49.258089+00:00 app[web.1]:        used if a reverse proxy is terminating SSL for you (such as on Heroku)
2017-08-28T22:06:49.258089+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258090+00:00 app[web.1]:     --expand-war-file
2017-08-28T22:06:49.258091+00:00 app[web.1]:        Expand the war file and set it as source
2017-08-28T22:06:49.258092+00:00 app[web.1]:        Default: true
2017-08-28T22:06:49.258092+00:00 app[web.1]:     --expanded-dir-name
2017-08-28T22:06:49.258093+00:00 app[web.1]:        The name of the directory the WAR file will be expanded into.
2017-08-28T22:06:49.258093+00:00 app[web.1]:        Default: expanded
2017-08-28T22:06:49.258094+00:00 app[web.1]:     --help
2017-08-28T22:06:49.258095+00:00 app[web.1]:        
2017-08-28T22:06:49.258096+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258096+00:00 app[web.1]:     --max-threads
2017-08-28T22:06:49.258097+00:00 app[web.1]:        Set the maximum number of worker threads
2017-08-28T22:06:49.258098+00:00 app[web.1]:        Default: 0
2017-08-28T22:06:49.258098+00:00 app[web.1]:     --path
2017-08-28T22:06:49.258099+00:00 app[web.1]:        The context path
2017-08-28T22:06:49.258099+00:00 app[web.1]:        Default: <empty string>
2017-08-28T22:06:49.258100+00:00 app[web.1]:     --port
2017-08-28T22:06:49.258101+00:00 app[web.1]:        The port that the server will accept http requests on.
2017-08-28T22:06:49.258101+00:00 app[web.1]:        Default: 8080
2017-08-28T22:06:49.258102+00:00 app[web.1]:     --proxy-base-url
2017-08-28T22:06:49.258102+00:00 app[web.1]:        Set proxy URL if tomcat is running behind reverse proxy
2017-08-28T22:06:49.258103+00:00 app[web.1]:        Default: <empty string>
2017-08-28T22:06:49.258103+00:00 app[web.1]:     --scanBootstrapClassPath
2017-08-28T22:06:49.258104+00:00 app[web.1]:        Set jar scanner scan bootstrap classpath.
2017-08-28T22:06:49.258104+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258105+00:00 app[web.1]:     --session-store
2017-08-28T22:06:49.258106+00:00 app[web.1]:        Session store to use (valid options are 'memcache' or 'redis')
2017-08-28T22:06:49.258106+00:00 app[web.1]:     --session-store-ignore-pattern
2017-08-28T22:06:49.258107+00:00 app[web.1]:        Request pattern to not track sessions for. Valid only with memcache
2017-08-28T22:06:49.258107+00:00 app[web.1]:        session store. (default is '.*\.(png|gif|jpg|css|js)$'
2017-08-28T22:06:49.258109+00:00 app[web.1]:        Default: .*\.(png|gif|jpg|css|js)$
2017-08-28T22:06:49.258109+00:00 app[web.1]:     --session-store-locking-mode
2017-08-28T22:06:49.258110+00:00 app[web.1]:        Session locking mode for use with memcache session store. (default is
2017-08-28T22:06:49.258111+00:00 app[web.1]:        all)
2017-08-28T22:06:49.258112+00:00 app[web.1]:        Default: all
2017-08-28T22:06:49.258112+00:00 app[web.1]:     --session-store-operation-timeout
2017-08-28T22:06:49.258113+00:00 app[web.1]:        Operation timeout for the memcache session store. (default is 5000ms)
2017-08-28T22:06:49.258114+00:00 app[web.1]:        Default: 5000
2017-08-28T22:06:49.258114+00:00 app[web.1]:     --session-timeout
2017-08-28T22:06:49.258115+00:00 app[web.1]:        The number of minutes of inactivity before a user's session is timed out.
2017-08-28T22:06:49.258116+00:00 app[web.1]:     --shutdown-override
2017-08-28T22:06:49.258116+00:00 app[web.1]:        Overrides the default behavior and casues Tomcat to ignore lifecycle
2017-08-28T22:06:49.258117+00:00 app[web.1]:        failure events rather than shutting down when they occur.
2017-08-28T22:06:49.258118+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258118+00:00 app[web.1]:     --temp-directory
2017-08-28T22:06:49.258119+00:00 app[web.1]:        Define the temp directory, default value: ./target/tomcat.PORT
2017-08-28T22:06:49.258119+00:00 app[web.1]:     --tomcat-users-location
2017-08-28T22:06:49.258120+00:00 app[web.1]:        Location of the tomcat-users.xml file. (relative to the location of the
2017-08-28T22:06:49.258128+00:00 app[web.1]:        webapp-runner jar file)
2017-08-28T22:06:49.258129+00:00 app[web.1]:     --uri-encoding
2017-08-28T22:06:49.258129+00:00 app[web.1]:        Set the URI encoding to be used for the Connector.
2017-08-28T22:06:49.258130+00:00 app[web.1]:     --use-body-encoding-for-uri
2017-08-28T22:06:49.258130+00:00 app[web.1]:        Set if the entity body encoding should be used for the URI.
2017-08-28T22:06:49.258131+00:00 app[web.1]:        Default: false
2017-08-28T22:06:49.258131+00:00 app[web.1]:     -A
2017-08-28T22:06:49.258132+00:00 app[web.1]:        Allows setting HTTP connector attributes. For example: -Acompression=on
2017-08-28T22:06:49.258132+00:00 app[web.1]:        Syntax: -Akey=value
2017-08-28T22:06:49.258133+00:00 app[web.1]:        Default: {}
2017-08-28T22:06:49.258138+00:00 app[web.1]: 
2017-08-28T22:06:49.347094+00:00 heroku[web.1]: Process exited with status 1
2017-08-28T22:06:49.361893+00:00 heroku[web.1]: State changed from starting to crashed

Procfile 更改为

web: sh target/bin/webapp

是为我做的!

The specified path "target/*.war" does not exist.

检查文件夹的内容,也许您正在创建 .jar 而不是 .war

同时指定 <packaging>jar</packaging>