Spring 弹簧靴&x2B;jboss=第403页
我试着把spring boot和jboss连接了一个星期。。。我在这个论坛上读了很多话题,很多都太老了。每次我想运行服务器时都会出现错误404。你能帮我用jboss正确配置我的应用程序吗 更新: 感谢您对错误404的帮助。我把包裹改成了“战争”。但是现在当我运行wildfly服务器时,我得到了错误403(禁止)。我在寻找如何修复它,并且仍然留在原来的地方。让wildfly使用spring boot工作是如此的困难 我更新了文件: pom.xmlSpring 弹簧靴&x2B;jboss=第403页,spring,spring-boot,jboss,http-status-code-404,Spring,Spring Boot,Jboss,Http Status Code 404,我试着把spring boot和jboss连接了一个星期。。。我在这个论坛上读了很多话题,很多都太老了。每次我想运行服务器时都会出现错误404。你能帮我用jboss正确配置我的应用程序吗 更新: 感谢您对错误404的帮助。我把包裹改成了“战争”。但是现在当我运行wildfly服务器时,我得到了错误403(禁止)。我在寻找如何修复它,并且仍然留在原来的地方。让wildfly使用spring boot工作是如此的困难 我更新了文件: pom.xml <project xmlns="http:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>pl.seweryn</groupId>
<artifactId>LibraryCRUD</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<!-- Spring: boot starter parent -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.0.RELEASE</version>
</parent>
<dependencies>
<!-- Starter for building web, including RESTful, applications using Spring
MVC. Uses Tomcat as the default embedded container -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- Starter for using Spring Data JPA with Hibernate -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
<!-- Starter for testing Spring Boot applications with libraries including
JUnit, Hamcrest and Mockito -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- The spring-boot-devtools module can be included in any project to
provide additional development-time features. -->
<!-- Applications that use spring-boot-devtools will automatically restart
whenever files on the classpath change. -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<!-- JSP Standard Tag Library -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet.jsp</groupId>
<artifactId>jboss-jsp-api_2.2_spec</artifactId>
<version>1.0.2.Final</version>
</dependency>
<!-- … -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<!-- … -->
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
</properties>
<build>
<finalName>LibraryCRUD</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
</configuration>
</plugin>
</plugins>
</build>
</project>
Application.java
package pl.seweryn.init;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
//@Configuration
//@EnableAutoConfiguration
//@ComponentScan
@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan - alternative
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}
按照以下说明操作:
您基本上必须将应用程序打包为WAR并实现
SpringBootServletilizer
我在我的项目中发现了很多错误,现在它可以正常工作了。我会在这里写下我的应用程序的答案
您链接到的项目将生成一个JAR文件(Spring Boot应用程序的默认打包)。您需要一个WAR文件来部署到JBoss(或任何其他servlet容器)。更改POM文件中的打包类型,重新打包项目(
mvn clean package
),然后将生成的WAR文件部署到JBoss上。谢谢您的回答。在此之后,我现在有错误403。Page still dosent load index.jsp:(我更新了github repo。感谢您的回答。在此之后,我出现了错误403。Page still dosent load index.jsp:(我更新了github repo)。
package pl.seweryn.init;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
//@Configuration
//@EnableAutoConfiguration
//@ComponentScan
@SpringBootApplication // same as @Configuration @EnableAutoConfiguration @ComponentScan - alternative
public class Application extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Application.class, args);
}
}