0

我的配置在 WildFly Swarm 2018.4.1 上成功运行。当我尝试升级到 Wildfly Swarm 2018.5.0 时,我遇到了两个问题:

  1. NPE,可以通过遵循此 JIRA 项中的解决方法来解决:

    https://issues.jboss.org/browse/THORN-2015

更改后,服务器成功启动。然而

  1. HTTPS 侦听器未启动。我想这与 Wildfly Swarm 2018.5.0 中的重大变化有关,正如这篇文章中所宣布的:

    http://wildfly-swarm.io/posts/announcing-wildfly-swarm-2018-5-0/

    尤其是这句话:

    Elytron 子系统的默认配置现在更接近 WildFly 的。Elytron 是 WildFly 中的新安全子系统,但在 WildFly Swarm 中尚未受到太多关注。

    但是,我找不到我必须从当前配置进行更改以支持新配置的内容。

我需要对我的配置进行哪些更改才能使其在 WildFly Swarm 2018.5.0 下运行?

这是我的 pom(更改以支持解决方法 (1)):

<?xml version="1.0" encoding="UTF-8"?>
<!--
Private Module Warnings addressed in https://issues.jboss.org/browse/SWARM-1110
-->
<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>com.foo</groupId>
    <artifactId>api</artifactId>
    <name>Foo Web API</name>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>war</packaging>

    <properties>
        <version.wildfly.swarm>2018.5.0</version.wildfly.swarm>
        <version.arquillian>1.2.0.Final</version.arquillian>
        <version.postgres>42.1.4</version.postgres>
        <version.resteasy>3.1.4.Final</version.resteasy>
        <version.slf4j>1.7.25</version.slf4j>
        <version.swagger>1.5.17</version.swagger>
        <version.itext>5.5.13</version.itext>
        <version.itext.pdfhtml>2.0.1</version.itext.pdfhtml>
        <version.apache.commons>1.2</version.apache.commons>
        <version.projectlombok>1.16.18</version.projectlombok>
        <version.hibernate>5.2.12.Final</version.hibernate>
        <version.freemarker>2.3.28</version.freemarker>
        <version.junit>4.12</version.junit>
        <version.hamcrest>1.3</version.hamcrest>
        <version.jersey>2.26</version.jersey>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <failOnMissingWebXml>false</failOnMissingWebXml>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.wildfly.swarm</groupId>
                <artifactId>bom-all</artifactId>
                <version>${version.wildfly.swarm}</version>
                <scope>import</scope>
                <type>pom</type>
                <!-- Workaround for issue: https://issues.jboss.org/browse/THORN-2015 -->
                <exclusions>
                    <exclusion>
                        <groupId>org.wildlfy.swarm</groupId>
                        <artifactId>config-api-runtime</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>${version.arquillian}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <build>
        <finalName>webapi</finalName>
       <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.wildfly.swarm</groupId>
                <artifactId>wildfly-swarm-plugin</artifactId>
                <version>${version.wildfly.swarm}</version>       
                <executions>
                    <execution>
                        <goals>
                            <goal>package</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <additionalFractions>management</additionalFractions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <!-- here the phase you need -->
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target</outputDirectory>
                            <resources>          
                                <resource>
                                    <directory>src/non-packaged-resources</directory>
                                    <filtering>false</filtering>
                                </resource>
                            </resources>              
                        </configuration>            
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <!-- Add artifact for workaround in proper version -->
        <dependency> 
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>config-api-runtime</artifactId>
            <version>1.3.1</version>
        </dependency>
        <!-- Java EE 7 dependency -->
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-web-api</artifactId>
            <version>7.0</version>
            <type>jar</type>
        </dependency>
        <!-- WildFly Swarm Fractions -->
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>undertow</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>jaxrs</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>cdi</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>logging</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>keycloak</artifactId>
            <!-- Workaround for issue: https://issues.jboss.org/browse/THORN-2015 -->
            <exclusions>
                <exclusion>
                    <groupId>org.wildlfy.swarm</groupId>
                    <artifactId>config-api-runtime</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.wildfly.swarm</groupId>
            <artifactId>mail</artifactId>
        </dependency>
        <!-- Database dependencies -->
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <version>${version.postgres}</version>
        </dependency>
        <!-- iText Dependencies -->
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itextpdf</artifactId>
            <version>${version.itext}</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext-pdfa</artifactId>
            <version>${version.itext}</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf</groupId>
            <artifactId>itext-xtra</artifactId>
            <version>${version.itext}</version>
        </dependency>
        <dependency>
            <groupId>com.itextpdf.tool</groupId>
            <artifactId>xmlworker</artifactId>
            <version>${version.itext}</version>
        </dependency>
        <!-- Other dependencies -->
        <dependency>
            <groupId>org.freemarker</groupId>
            <artifactId>freemarker</artifactId>
            <version>${version.freemarker}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${version.hibernate}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${version.slf4j}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-text</artifactId>
            <version>${version.apache.commons}</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>${version.projectlombok}</version>
            <scope>compile</scope>
        </dependency>
        <!-- Test dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>${version.junit}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>${version.slf4j}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-all</artifactId>
            <version>${version.hamcrest}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-common</artifactId>
            <version>${version.jersey}</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>

还有我的项目-defaults.yml:

swarm:
  mail:
    mail-sessions:
      mail-socket:
        jndi-name: java:/mail/Foo
        smtp-server:
          username: foo@bar.com
          password: xxx
          tls: true
          outbound-socket-binding-ref: mail-smtp
        debug: false
        from: for@bar.com
  network:
    socket-binding-groups:
      standard-sockets:
        outbound-socket-bindings:
          mail-smtp:
            remote-host: smtp.office365.com
            remote-port: 587
  http:
    keystore: 
      path: star_foo_com.jks
      password: xxx
    certificate:
      alias: server
  deployment:
    webapi.war:
      swagger:
        packages:
          - com.foo.api
        root: /rest/v1/
  logging:
    root-logger:
      level: INFO
    loggers:
      com.foo:
        level: DEBUG
  datasources:
    jdbc-drivers:
      org.postgresql:
        driver-class-name: org.postgresql.Driver
        xa-datasource-class-name: org.postgresql.xa.PGXADataSource
        driver-module-name: org.postgresql
    data-sources:
      FooDS:
        driver-name: org.postgresql
        connection-url: jdbc:postgresql://xxx.eu-west-1.rds.amazonaws.com:5432/postgres
        user-name: db_admin
        password: xxx
        allow-multiple-users: true
        allocation-retry-wait-millis: 100
        allocation-retry: 10
        check-valid-connection-sql: SELECT 1
        jta: true
4

0 回答 0