当我尝试将spring应用程序上传到wildfly时,出现以下错误,如果我在STS中运行该应用程序,则运行正常,没有错误。
无法上传部署:{“ WFLYCTL0080:失败的服务” => {“ jboss.undertow.deployment.default-server.default-host。\” / dealer_app-0.0.1-SNAPSHOT \“” =>“组织。服务jboss.undertow.deployment.default-server.default-host。\“ / dealer_app-0.0.1-SNAPSHOT \”中的jboss.msc.service.StartException:java.lang.NoSuchMethodError:org.springframework.boot.builder。 SpringApplicationBuilder。([Ljava / lang / Class;)V原因:java.lang.NoSuchMethodError:org.springframework.boot.builder.SpringApplicationBuilder。([Ljava / lang / Class;)V“},” WFLYCTL0412:所需的服务尚未安装:“ => [” jboss.undertow.deployment.default-server.default-host。\“ / dealer_app-0.0.1-SNAPSHOT \”“],” WFLYCTL0180:缺少/不可用依赖项的服务“ =>未定义}
这是我的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>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.3.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<artifactId>dealer_app</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.7.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
<version>2.1.0.RELEASE</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.json/json -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20171018</version>
</dependency>
<!-- Spring Mail -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-mail</artifactId>
<version>2.0.4.RELEASE</version>
</dependency>
<!-- GSON -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<packaging>war</packaging>
谢谢
答案 0 :(得分:0)
我认为这可能是由于您的pom中没有包含jboss依赖项。
class QuoteListView(ListView):
model = SmgQuotesTable
def get_queryset(self):
r_get = self.request.GET # Get the data sendir by QuoteFormView
query_filter = Quotes().planSelector(r_get['couple'], r_get['kids'], r_get['age']) # Use the filter to get the correct Quote
queryset = super(QuoteListView, self).get_queryset().filter(composite=query_filter) # Aply the filter to get the correct queryset
Quotes().salaryDiscount(queryset,r_get['salary']) # Aply the discount of the salary
return queryset
这可能会成功,否则,可能是因为您使用的是Jboss库中未指定的方法。希望这会有所帮助!
答案 1 :(得分:0)
从spring-boot-starter-web中排除tomcat是不够的。
您必须像这样更改您的入门班:
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer{
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
如果仍然无法使用,则必须重新打包应用程序:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.example.DemoApplication</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>