Java 404在本地主机上找不到或被禁止
“我在从Java 404在本地主机上找不到或被禁止,java,spring-boot,tomcat,wildfly,Java,Spring Boot,Tomcat,Wildfly,“我在从localhost访问我的应用程序时遇到问题。我通过Eclipse在WildFlyServerVersion17中添加了该项目 当我打开localhost:8080/vaadin-app/ui时,我发现404未找到。 当我打开localhost:8080/vaadin应用程序时,被禁止。我哪里做错了 问题是否与web.xml文件有关?因为我意识到,web.xml不存在。因此,我手动创建了它web.xml pom.xml: <project xmlns="http://maven.a
localhost
访问我的应用程序时遇到问题。我通过Eclipse在WildFly
ServerVersion17中添加了该项目
当我打开localhost:8080/vaadin-app/ui
时,我发现404未找到。
当我打开localhost:8080/vaadin应用程序时,被禁止。我哪里做错了
问题是否与web.xml
文件有关?因为我意识到,web.xml
不存在。因此,我手动创建了它web.xml
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>com.kamil.vaadin</groupId>
<artifactId>vaadin-app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8.0</java.version>
</properties>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.3.5.RELEASE</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<executable>true</executable>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>1.3.5.RELEASE</version><!--$NO-MVN-MAN-VER$-->
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
</dependency>
</dependencies>
<packaging>war</packaging>
</project>
App.java:
@SpringBootApplication
public class App {
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
web.xml:
<display-name>vaadin-app</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>ui</welcome-file>
</welcome-file-list>
vaadin应用程序
index.html
index.htm
index.jsp
default.html
default.htm
default.jsp
用户界面
从以下位置扩展App.java:
public class App extends SpringBootServletInitializer {
并在此添加此方法:
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(App.class);
}
最后,我建议您设置war名称。您可以将其添加到pom.xml中:
<finalName>vaadin-app</finalName>
vaadin应用程序
web.xml不是Spring Boot所必需的。检查日志中部署应用程序的上下文。可能是较新版本的Spring Boot的“”。您可以使用localhost:8080/ui删除web.xml。
<finalName>vaadin-app</finalName>