Spring Boot War 不适用于 Jboss 7.1 [英] Spring boot war doesn´t work on Jboss 7.1

查看:30
本文介绍了Spring Boot War 不适用于 Jboss 7.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 Jboss 上部署 Spring 启动应用程序.我按照 this 教程将我的 jar 转换为 war 文件.但是当我尝试在 Jboss 上运行应用程序时,它给了我这个错误:

I´m trying to deploy a Spring boot application on Jboss. I follow this tutorial for convert my jar in to a war file. But when i try to run the application on Jboss it´s give me this error:

17:02:31,462 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter applicationContextIdFilter: java.lang.InstantiationException: org.springframework.boot.actuate.autoconfigure.EndpointWebMvcAutoConfiguration$ApplicationContextFilterConfiguration$1
    at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,472 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter webRequestLoggingFilter: java.lang.InstantiationException: org.springframework.boot.actuate.trace.WebRequestTraceFilter
    at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,480 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter authenticationFilter: java.lang.InstantiationException: br.gov.rs.defensoria.ldap.service.authentication.AuthenticationFilter
    at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,484 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter errorPageFilter: java.lang.IllegalAccessException: Class org.jboss.as.web.deployment.WebInjectionContainer can not access a member of class org.springframework.boot.context.web.ErrorPageFilter with modifiers ""
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:109) [rt.jar:1.7.0_51]
    at java.lang.Class.newInstance(Class.java:368) [rt.jar:1.7.0_51]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,493 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Exception starting filter metricFilter: java.lang.InstantiationException: org.springframework.boot.actuate.autoconfigure.MetricFilterAutoConfiguration$MetricsFilter
    at java.lang.Class.newInstance(Class.java:359) [rt.jar:1.7.0_51]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:80) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:72) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:441) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:3269) [jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3865) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,505 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-2) Error filterStart
17:02:31,505 ERROR [org.apache.catalina.core.StandardContext] (MSC service thread 1-2) Context [/ldap-service-1.0-SNAPSHOT] startup failed due to previous errors
17:02:31,510 INFO  [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/ldap-service-1.0-SNAPSHOT]] (MSC service thread 1-2) Closing Spring root WebApplicationContext
17:02:31,511 INFO  [org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext] (MSC service thread 1-2) Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@2222014c: startup date [Thu Apr 24 17:02:23 BRT 2014]; root of context hierarchy
17:02:31,514 INFO  [org.springframework.context.support.DefaultLifecycleProcessor] (MSC service thread 1-2) Stopping beans in phase 0
17:02:31,523 INFO  [org.springframework.boot.actuate.endpoint.jmx.EndpointMBeanExporter] (MSC service thread 1-2) Unregistering JMX-exposed beans on shutdown
17:02:31,529 INFO  [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean] (MSC service thread 1-2) Closing JPA EntityManagerFactory for persistence unit 'default'
17:02:31,554 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC00001: Failed to start service jboss.web.deployment.default-host."/ldap-service-1.0-SNAPSHOT": org.jboss.msc.service.StartException in service jboss.web.deployment.default-host."/ldap-service-1.0-SNAPSHOT": JBAS018040: Failed to start context
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:95)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
17:02:31,774 INFO  [org.jboss.as.server] (HttpManagementService-threads - 1) JBAS015870: Deploy of deployment "ldap-service-1.0-SNAPSHOT.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.web.deployment.default-host."/ldap-service-1.0-SNAPSHOT"" => "org.jboss.msc.service.StartException in service jboss.web.deployment.default-host."/ldap-service-1.0-SNAPSHOT": JBAS018040: Failed to start context"}}
17:02:31,850 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment ldap-service-1.0-SNAPSHOT.war in 83ms
17:02:31,852 INFO  [org.jboss.as.controller] (HttpManagementService-threads - 1) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.web.deployment.default-host."/ldap-service-1.0-SNAPSHOT": org.jboss.msc.service.StartException in service jboss.web.deployment.default-host."/ldap-service-1.0-SNAPSHOT": JBAS018040: Failed to start context

我的应用 Spring 配置文件

package myapp;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
@ComponentScan
public class Application extends SpringBootServletInitializer {
    private static Class<Application> applicationClass = Application.class;

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(applicationClass);
    }
}

这是我的 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>myapp</groupId>
<artifactId>myapp</artifactId>
<version>1.0-SNAPSHOT</version>

<packaging>war</packaging>
<name>myapp</name>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.0.2.RELEASE</version>
</parent>

<dependencies>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
    </dependency>
    <!-- tag::jetty[] -->
    <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-data-jpa</artifactId>
        <scope>compile</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-jpa</artifactId>
        <version>1.5.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-aop</artifactId>
        <version>4.0.3.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>test</scope>
    </dependency>
    <!-- end::jetty[] -->
    <!-- tag::actuator[] -->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <!-- end::actuator[] -->
    <dependency>
        <groupId>org.springframework.ldap</groupId>
        <artifactId>spring-ldap-core</artifactId>
        <version>2.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.ldap</groupId>
        <artifactId>spring-ldap-core-tiger</artifactId>
        <version>2.0.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>16.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.8.7</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.8.5</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-test</artifactId>
        <version>4.0.2.RELEASE</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>sqljdbc4</artifactId>
        <version>4.0</version>
        <scope>runtime</scope>
    </dependency>
</dependencies>

<properties>
    <start-class>myapp.Application</start-class>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <java.version>1.7</java.version>
</properties>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
        </plugin>
        <plugin>
            <groupId>com.googlecode.flyway</groupId>
            <artifactId>flyway-maven-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</driver>
                <url>jdbc:sqlserver://dpepoaap02SQLEXPRESS;Databasename=dev_db_ldap_service</url>
                <user>user_dev</user>
                <password>dpe123</password>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

<repositories>
    <repository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>localRepo</id>
        <url>file://M://</url>
        <snapshots>
            <enabled>true</enabled>
            <updatePolicy>always</updatePolicy>
        </snapshots>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <name>Spring Snapshots</name>
        <url>http://repo.spring.io/snapshot</url>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <name>Spring Milestones</name>
        <url>http://repo.spring.io/milestone</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>

有什么想法吗?谢谢!

推荐答案

解释了部署 spring-boot 的主要问题 这里

The main issue with deploying spring-boot is explained here

该帖子现在有点旧,不适用于当前的 spring-boot(撰写本文时为 1.3.3).

The post is a bit old by now and does not apply to the current spring-boot (1.3.3 as of this writing).

在您的情况下发生的情况是 spring-boot 执行器中的某些过滤器没有 JBoss 将尝试调用的默认构造函数,因此要解决此问题,您需要执行以下操作(这是针对当前的 spring-boot 1.3.3):

What is happening in your case is that some filter in spring-boot actuator do not have default constructors which JBoss will try to call so to get around this you need to do the following (This is for current spring-boot 1.3.3):

创建一个 ApplicationContext,它将所有 bean 过滤器包装在一个具有默认构造函数的委托类中.我们可以使用 spring 的 DelegatingFilterProxy 来实现

Create an ApplicationContext which will wrap all bean filters in a delegating class which has a default constructor. We can use spring's DelegatingFilterProxy for that

public class JBossWebApplicationContext extends AnnotationConfigEmbeddedWebApplicationContext {

private final Logger log = LoggerFactory.getLogger(getClass());

@Override
protected Collection<ServletContextInitializer> getServletContextInitializerBeans() {
    Collection<ServletContextInitializer> servletContextInitializerBeans = super.getServletContextInitializerBeans();
    for (ServletContextInitializer servletContextInitializerBean : servletContextInitializerBeans) {
        if (servletContextInitializerBean instanceof FilterRegistrationBean) {
            FilterRegistrationBean frb = (FilterRegistrationBean) servletContextInitializerBean;
            try {
                Field field = FilterRegistrationBean.class.getDeclaredField("filter");
                field.setAccessible(true);
                Filter origFilter = (Filter) field.get(frb);
                frb.setFilter(new DelegatingFilterProxy(origFilter));
            } catch (NoSuchFieldException | IllegalAccessException e) {
                throw new BeanCreationException("Error setting up bean. It does not have a filter field", e);
            }

        }
    }

    return servletContextInitializerBeans;
}
}

然后在你的 springboot 主类中确保使用我们上面创建的上下文:

Then in your springboot main class make sure to use the context we created above:

@SpringBootApplication
public class MyApplication extends SpringBootServletInitializer {

@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    application.sources(MyApplication.class);
    application.contextClass(JBossWebApplicationContext.class);
    return super.configure(application);
}

public static void main(String[] args) throws Exception {
    SpringApplication app = new SpringApplication(MyApplication.class);
    app.setApplicationContextClass(JBossWebApplicationContext.class);
    app.run(args);
}
}

最后,您需要确保您的 servlet 路径配置为/*",因为 JBoss 7.1 似乎不能仅使用默认值 (/).这可以在您的 application.yml(或 application.properties)中配置

Lastly you need to make sure your servlet path is configured to be "/*" since JBoss 7.1 does not seem to work with only the default (/). This can be configured in your application.yml (or application.properties)

server:
  servletPath: /*

这应该允许您在 JBoss 7.1 中部署 springBoot 应用程序(我在 7.1.3 上测试过)

This should allow you to deploy a springBoot application in JBoss 7.1 (Tested myself on 7.1.3)

一些额外的点:

  • 没有对此进行了广泛的测试,因此在依赖此解决方案之前,您应该确保一切正常运行
  • 我真的不喜欢必须调用反射来获取 FRB 底层过滤器,但不幸的是 getFilter 方法受到保护
  • 这个解决方案可能会被比我更熟悉 Spring 的人改进
  • I have NOT tested this extensively and therefore you should make sure things are behaving as they should be before relying on this solution
  • I really don't like having to call reflection to get the FRB underlying filter but unfortunately the getFilter method is protected
  • This solution can probably be improved upon by someone who is more versed into spring than I am

这篇关于Spring Boot War 不适用于 Jboss 7.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆