没有为Heroku正确配置pom.xml和web.xml

时间:2019-03-26 16:20:44

标签: eclipse heroku dynamic-websites

过去5天,我一直在尝试将简单的Eclipse jee动态Web应用程序部署到heroku。我为使此工作正常而疯狂。我不确定,但我认为问题出在我的pom.xml和/或web.xml文件中。

该项目可以在github HERE

上找到

我已经阅读了一篇又一篇文章,并对Stackoverflow进行了广泛的研究。如果有人可以看一下项目并帮助正确配置这些文件,将不胜感激。

这是eclipse的输出:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------< VT5:VT5 >-------------------------------
[INFO] Building VT5 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] >>> heroku-maven-plugin:2.0.7:deploy-war (default-cli) > package @ VT5 >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ VT5 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\saltydog\git\repository\VT5\VT5\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ VT5 ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ VT5 ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\saltydog\git\repository\VT5\VT5\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ VT5 ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ VT5 ---
[INFO] 
[INFO] --- maven-war-plugin:3.2.1:war (default-war) @ VT5 ---
[INFO] Packaging webapp
[INFO] Assembling webapp [VT5] in [C:\Users\saltydog\git\repository\VT5\VT5\target\VT5-0.0.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\saltydog\git\repository\VT5\VT5\WebContent]
[INFO] Webapp assembled in [197 msecs]
[INFO] Building war: C:\Users\saltydog\git\repository\VT5\VT5\target\VT5-0.0.1-SNAPSHOT.war
[INFO] 
[INFO] <<< heroku-maven-plugin:2.0.7:deploy-war (default-cli) < package @ VT5 <<<
[INFO] 
[INFO] 
[INFO] --- heroku-maven-plugin:2.0.7:deploy-war (default-cli) @ VT5 ---
[WARNING] The <processTypes> value will be ignored when deploying a WAR file. Use `heroku:deploy` goal for custom processes.
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.5.38.0:jar
[INFO] com.github.jsimone:webapp-runner:8.5.38.0:jar already exists in C:\Users\saltydog\git\repository\VT5\VT5\target\dependency
[INFO] -----> Packaging application...
[INFO]        - app: vt5-1
[INFO]        - including: target/dependency/webapp-runner.jar
[INFO]        - including: target/VT5-0.0.1-SNAPSHOT.war
[INFO] -----> Creating build...
[INFO]        - file: target/heroku/build.tgz
[INFO]        - size: 22MB
[INFO] -----> Uploading build...
[INFO]        - success
[INFO] -----> Deploying...
[INFO] remote: 
[INFO] remote: -----> heroku-maven-plugin app detected
[INFO] remote: -----> Installing JDK 1.8... done
[INFO] remote: -----> Discovering process types
[INFO] remote:        Procfile declares types -> web
[INFO] remote: 
[INFO] remote: -----> Compressing...
[INFO] remote:        Done: 72.6M
[INFO] remote: -----> Launching...
[INFO] remote:        Released v4
[INFO] remote:        https://vt5-1.herokuapp.com/ deployed to Heroku
[INFO] remote: 
[INFO] -----> Done
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36.823 s
[INFO] Finished at: 2019-03-26T17:15:10-04:00
[INFO] ------------------------------------------------------------------------

这是heroku日志--tail

的输出
C:\Users\saltydog\git\repository\VT5>heroku logs --tail
2019-03-26T21:07:59.897975+00:00 app[api]: Initial release by user rsxxx@gmail.com
2019-03-26T21:07:59.897975+00:00 app[api]: Release v1 created by user rsxxx@gmail.com
2019-03-26T21:07:59.990666+00:00 app[api]: Release v2 created by user rsxxx@gmail.com
2019-03-26T21:07:59.990666+00:00 app[api]: Enable Logplex by user rsxxx@gmail.com
2019-03-26T21:10:07.000000+00:00 app[api]: Build started by user rsxxx@gmail.com
2019-03-26T21:10:18.657266+00:00 app[api]: Deploy fa86bfdd by user rsxxx@gmail.com
2019-03-26T21:10:18.670130+00:00 app[api]: Scaled to web@1:Free by user rsxxx@gmail.com
2019-03-26T21:10:18.657266+00:00 app[api]: Release v3 created by user rsxxx@gmail.com
2019-03-26T21:10:19.000000+00:00 app[api]: Build succeeded
2019-03-26T21:10:22.350893+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/dependency/webapp-runner.jar $WEBAPP_RUNNER_OPTS --port 13062 target/VT5-0.0.1-SNAPSHOT.war`
2019-03-26T21:10:24.024048+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-03-26T21:10:24.031319+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-03-26T21:10:24.931432+00:00 app[web.1]: Expanding VT5-0.0.1-SNAPSHOT.war into /app/target/tomcat.13062/webapps/expanded
2019-03-26T21:10:24.931593+00:00 app[web.1]: Adding Context  for /app/target/tomcat.13062/webapps/expanded
2019-03-26T21:10:25.752672+00:00 app[web.1]: Mar 26, 2019 9:10:25 PM org.apache.coyote.AbstractProtocol init
2019-03-26T21:10:25.752692+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-13062"]
2019-03-26T21:10:25.793058+00:00 app[web.1]: Mar 26, 2019 9:10:25 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
2019-03-26T21:10:25.793067+00:00 app[web.1]: INFO: Using a shared selector for servlet write/read
2019-03-26T21:10:25.851354+00:00 app[web.1]: Mar 26, 2019 9:10:25 PM org.apache.catalina.core.StandardService startInternal
2019-03-26T21:10:25.851358+00:00 app[web.1]: INFO: Starting service [Tomcat]
2019-03-26T21:10:25.855328+00:00 app[web.1]: Mar 26, 2019 9:10:25 PM org.apache.catalina.core.StandardEngine startInternal
2019-03-26T21:10:25.855332+00:00 app[web.1]: INFO: Starting Servlet Engine: Apache Tomcat/8.5.38
2019-03-26T21:10:26.160579+00:00 app[web.1]: Mar 26, 2019 9:10:26 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
2019-03-26T21:10:26.160603+00:00 app[web.1]: INFO: No global web.xml found
2019-03-26T21:10:26.498285+00:00 heroku[web.1]: State changed from starting to up
2019-03-26T21:10:29.172266+00:00 app[web.1]: Mar 26, 2019 9:10:29 PM org.apache.jasper.servlet.TldScanner scanJars
2019-03-26T21:10:29.172281+00:00 app[web.1]: INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2019-03-26T21:10:29.308705+00:00 app[web.1]: Mar 26, 2019 9:10:29 PM org.apache.coyote.AbstractProtocol start
2019-03-26T21:10:29.308709+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-13062"]
2019-03-26T21:10:41.299385+00:00 heroku[router]: at=info method=GET path="/" host=vt5-1.herokuapp.com request_id=d09841f4-a111-4175-a680-bcc97a0a655f fwd="71.184.149.223" dyno=web.1 connect=0ms service=52ms status=404 bytes=1230 protocol=https
2019-03-26T21:10:42.738199+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=vt5-1.herokuapp.com request_id=40566c4b-9386-43e6-9a61-32e298be15f5 fwd="71.184.149.223" dyno=web.1 connect=0ms service=3ms status=404 bytes=1241 protocol=https
2019-03-26T21:14:55.000000+00:00 app[api]: Build started by user rsxxx@gmail.com
2019-03-26T21:15:07.603846+00:00 heroku[web.1]: Restarting
2019-03-26T21:15:07.608892+00:00 heroku[web.1]: State changed from up to starting
2019-03-26T21:15:07.244261+00:00 app[api]: Release v4 created by user rsxxx@gmail.com
2019-03-26T21:15:07.244261+00:00 app[api]: Deploy d20122bb by user rsxxx@gmail.com
2019-03-26T21:15:07.000000+00:00 app[api]: Build succeeded
2019-03-26T21:15:08.623952+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2019-03-26T21:15:08.638326+00:00 app[web.1]: Mar 26, 2019 9:15:08 PM org.apache.coyote.AbstractProtocol pause
2019-03-26T21:15:08.638371+00:00 app[web.1]: INFO: Pausing ProtocolHandler ["http-nio-13062"]
2019-03-26T21:15:09.063952+00:00 heroku[web.1]: Process exited with status 143
2019-03-26T21:15:11.373049+00:00 heroku[web.1]: Starting process with command `java $JAVA_OPTS -jar target/dependency/webapp-runner.jar $WEBAPP_RUNNER_OPTS --port 35070 target/VT5-0.0.1-SNAPSHOT.war`
2019-03-26T21:15:13.737687+00:00 app[web.1]: Setting JAVA_TOOL_OPTIONS defaults based on dyno size. Custom settings will override them.
2019-03-26T21:15:13.749340+00:00 app[web.1]: Picked up JAVA_TOOL_OPTIONS: -Xmx300m -Xss512k -XX:CICompilerCount=2 -Dfile.encoding=UTF-8
2019-03-26T21:15:15.042221+00:00 app[web.1]: Expanding VT5-0.0.1-SNAPSHOT.war into /app/target/tomcat.35070/webapps/expanded
2019-03-26T21:15:15.042349+00:00 app[web.1]: Adding Context  for /app/target/tomcat.35070/webapps/expanded
2019-03-26T21:15:16.148030+00:00 app[web.1]: Mar 26, 2019 9:15:16 PM org.apache.coyote.AbstractProtocol init
2019-03-26T21:15:16.148042+00:00 app[web.1]: INFO: Initializing ProtocolHandler ["http-nio-35070"]
2019-03-26T21:15:16.190235+00:00 app[web.1]: Mar 26, 2019 9:15:16 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
2019-03-26T21:15:16.190239+00:00 app[web.1]: INFO: Using a shared selector for servlet write/read
2019-03-26T21:15:16.254179+00:00 app[web.1]: Mar 26, 2019 9:15:16 PM org.apache.catalina.core.StandardService startInternal
2019-03-26T21:15:16.254183+00:00 app[web.1]: INFO: Starting service [Tomcat]
2019-03-26T21:15:16.258587+00:00 app[web.1]: Mar 26, 2019 9:15:16 PM org.apache.catalina.core.StandardEngine startInternal
2019-03-26T21:15:16.258591+00:00 app[web.1]: INFO: Starting Servlet Engine: Apache Tomcat/8.5.38
2019-03-26T21:15:16.864005+00:00 heroku[web.1]: State changed from starting to up
2019-03-26T21:15:16.736837+00:00 app[web.1]: Mar 26, 2019 9:15:16 PM org.apache.catalina.startup.ContextConfig getDefaultWebXmlFragment
2019-03-26T21:15:16.736850+00:00 app[web.1]: INFO: No global web.xml found
2019-03-26T21:15:21.020761+00:00 app[web.1]: Mar 26, 2019 9:15:21 PM org.apache.jasper.servlet.TldScanner scanJars
2019-03-26T21:15:21.020783+00:00 app[web.1]: INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2019-03-26T21:15:21.164841+00:00 app[web.1]: Mar 26, 2019 9:15:21 PM org.apache.coyote.AbstractProtocol start
2019-03-26T21:15:21.164845+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-35070"]
2019-03-26T21:15:21.622631+00:00 heroku[router]: at=info method=GET path="/" host=vt5-1.herokuapp.com request_id=ca93822e-6564-4abc-8c1d-26a201568b82 fwd="71.184.149.223" dyno=web.1 connect=1ms service=416ms status=404 bytes=1230 protocol=https
2019-03-26T21:15:24.692620+00:00 heroku[router]: at=info method=GET path="/" host=vt5-1.herokuapp.com request_id=0940932c-e4bc-4e64-a77f-958c5b2a853d fwd="71.184.149.223" dyno=web.1 connect=1ms service=10ms status=404 bytes=1230 protocol=https
2019-03-26T21:15:26.446183+00:00 heroku[router]: at=info method=GET path="/" host=vt5-1.herokuapp.com request_id=10f92084-bf5e-45ad-b4c8-1910e6d15c50 fwd="71.184.149.223" dyno=web.1 connect=1ms service=18ms status=404 bytes=1230 protocol=https

这是web.xml文件:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>VT5</display-name>
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
  </welcome-file-list>
  <servlet>
    <description></description>
    <display-name>VT5</display-name>
    <servlet-name>VT5</servlet-name>
    <servlet-class>VT5</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>VT5</servlet-name>
    <url-pattern>/VT5</url-pattern>
  </servlet-mapping>
</web-app>

最后是pom.xml文件:

<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>VT5</groupId>
  <artifactId>VT5</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  <dependencies>
    <dependency>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-servlet</artifactId>
      <version>9.4.7.v20170914</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.1.0</version>
    </dependency>
  </dependencies>
  <build>  
    <sourceDirectory>src</sourceDirectory>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-war-plugin</artifactId>
        <version>3.2.1</version>
        <configuration>
          <warSourceDirectory>WebContent</warSourceDirectory>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.heroku.sdk</groupId>
        <artifactId>heroku-maven-plugin</artifactId>
        <version>2.0.7</version>
        <configuration>
          <appName>vt5-1</appName> 
          <processTypes>
            <web>java $JAVA_OPTS -cp target/classes:target/dependency/* VT5</web>
          </processTypes>         
        </configuration>
      </plugin>      
    </plugins>
  </build>
</project>

0 个答案:

没有答案