我的Web应用程序是使用Java构建的,并且在Tomcat服务器9.0上运行 在localhost上,它可以正常工作,但是在将其部署到heroku后,出现此错误。构建和部署成功。
HTTP状态404 –找不到
类型状态报告
消息/
说明原始服务器未找到当前表示 获取目标资源或不愿意透露其存在。
当我尝试访问我的heroku Web应用程序时收到此错误。
Web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version="4.0">
<welcome-file-list>
<welcome-file>home.jsp</welcome-file>
</welcome-file-list>
</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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>prototype_upgradecareer.github.io</groupId>
<artifactId>prototype_upgradecareer.github.io</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.heroku</groupId>
<artifactId>webapp-runner</artifactId>
<version>9.0.30.0</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.19</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/jstl -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Procfile
web:java $ JAVA_OPTS -jar target / dependency / webapp-runner.jar --port $ PORT target / *。war
我尝试使用heroku控制台(在heroku.com中)检查目标文件夹,这是成功构建后的列表
在日志上,除此以外,一切似乎都很好
2020-08-24T12:05:27.612061+00:00 app[web.1]: INFO: No global web.xml found
2020-08-24T12:05:27.710152+00:00 heroku[web.1]: State changed from starting to up
2020-08-24T12:05:30.862409+00:00 app[web.1]: Aug 24, 2020 12:05:30 PM org.apache.jasper.servlet.TldScanner scanJars
2020-08-24T12:05:30.862421+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.
2020-08-24T12:05:30.945571+00:00 app[web.1]: Aug 24, 2020 12:05:30 PM org.apache.coyote.AbstractProtocol start
2020-08-24T12:05:30.945574+00:00 app[web.1]: INFO: Starting ProtocolHandler ["http-nio-51544"]
2020-08-24T12:05:37.009304+00:00 heroku[router]: at=info method=GET path="/" host=upgradecareer.herokuapp.com request_id=d13362d6-0a53-4890-b2e9-949882b80fb1 fwd="106.215.199.53" dyno=web.1 connect=0ms service=51ms status=404 bytes=864 protocol=https
^C^CThe system cannot find message text for message number 0x237b in the message file for Application.
我的 org.eclipse.wst.common.component 文件
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="prot**********">
<wb-resource deploy-path="/" source-path="/"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<property name="context-root" value="pro************"/>
<property name="java-output-path" value="/pro***********/build/classes"/>
</wb-module>
</project-modules
我尝试重新启动dyno仍然没有运气。