java jboss-as-maven插件迁移到jdk 11

anauzrmj  于 2023-09-29  发布在  Java
关注(0)|答案(1)|浏览(84)

我在一个maven项目上,从Java 8迁移到11,我遇到了这些错误:
11:36:39,016错误[org.jboss.msc.service.fail](MSC服务线程1-11)MSC 000001:无法启动服务jboss.txn。ArjunaObjectStoreEnvironment:org.jboss.msc.service.StartException in service jboss.txn.ArjunaObjectStoreEnvironment:无法在11:36:39,352启动服务错误[org.jboss.as.controller.management-operation](ServerService线程池-- 30)JBAS 014612:操作(“add”)失败-地址:([(“subsystem”=>“infinispan”),(“cache-container”=>“web”),(“local-cache”=>“local-web”)]):java.lang.NoClassDefFoundError:jdk/internal/reflect/ConstructorAccessorImpl at java.base/jdk.internal.misc.Unsafe.defineClass0(Native Method)[java.base:] at java.base/jdk.internal.misc.Unsafe.defineClass(Unsafe.java:1194)[java.base:] at java.base/jdk.internal.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)[java.base:] at j
11:36:39,394错误[org.jboss.as.controller.management-operation](ServerService Thread Pool -- 47)JBAS 014612:操作(“add”)失败

  • 地址:([(“subsystem”=>“web”)]):javax.xml.stream.FactoryConfigurationError:Provider __redirected.__XMLInputFactory无法示例化:java.lang.reflect.InvocationTargetException at

[java.base:] at __redirected.__XMLInputFactory.(__XMLInputFactory.java:115)[jboss-modules.jar:1.3.0.Final-redhat-2] ... 23更多Caused by:java.lang.ClassNotFoundException:jdk.internal.reflect.ConstructorAccessorImpl from [Module“org.codehaus.woodstox:main”from local module loader@299270eb(finder:本地模块查找器@3b90a30a(root:C:\Users\BUSINICT-Motti\IdeaProjects\DocumentsStorage_v1\target\jboss-as-run\jboss-eap-6.3\modules,C:\Users\BUSINICT-Motti\IdeaProjects\DocumentsStorage_v1\target\jboss-as-run\jboss-eap-6.3\modules\system\layers\base))]
这是我的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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>it.bper.ws</groupId>
    <artifactId>DocumentsStorageWS</artifactId>
    <packaging>war</packaging>
    <version>1.22.1</version>
    <name>documents storage Maven Webapp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
    </properties>

    <repositories>
        <!-- Repository per scaricare JBoss AS -->
        <repository>
            <id>jboss-enterprise-maven-repository</id>
            <name>JBoss Enterprise Maven Repository - Early-access repository</name>
            <url>https://maven.repository.redhat.com/earlyaccess/all</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.jboss.narayana.arjunacore/arjuna -->
        <dependency>
            <groupId>org.jboss.narayana.arjunacore</groupId>
            <artifactId>arjuna</artifactId>
            <version>7.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.28</version>
            <scope>provided</scope>
        </dependency>

        <!-- Common libraries -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.13.0</version>
        </dependency>

        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock-standalone</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>

        <!--
             IBM Filenet libraries
             A runtime servono tutti i JAR, come da documentazione FileNet:
             - Jace.jar
             - stax-api.jar
             - xlxpScanner.jar
             - xlxpScannerUtils.jar
             - log4j.jar (la versione nel FileNet di BPER e' la 1.2.14)
             ma qui riportiamo solo quelli strettamente necessari per compilare
             ed eseguire i test, perche' gli altri JAR sono in WEB-INF/lib
             quindi accessibili dal class loader della web application
          -->
        <dependency>
            <groupId>com.ibm.filenet</groupId>
            <artifactId>jace</artifactId>
            <version>4.5.2</version>
            <scope>system</scope>
            <systemPath>${basedir}/src/main/webapp/WEB-INF/lib/Jace.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <!-- Logging libraries -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>3.0.0-alpha1</version>
        </dependency>

        <!-- Test libraries -->
        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.16.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.13.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>3.0.2</version>
        </dependency>
<dependency>
            <groupId>javax.annotation</groupId>
            <artifactId>javax.annotation-api</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.xml.ws</groupId>
            <artifactId>jaxws-api</artifactId>
            <version>2.3.1</version>
        </dependency>
        <dependency>
            <groupId>javax.jws</groupId>
            <artifactId>javax.jws-api</artifactId>
            <version>1.1</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.1.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <parallel>all</parallel>
                    <useUnlimitedThreads>false</useUnlimitedThreads>
                    <threadCount>6</threadCount>
                    <perCoreThreadCount>true</perCoreThreadCount>
                </configuration>
            </plugin>
           <!-- <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <version>1.4.1</version>
                <executions>
                    <execution>
                        <id>enforce-java</id>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <requireJavaVersion>
                                    <message>Il JDK da utilizzare dev'essere 1.7</message>
                                    <version>[1.7,1.8)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>-->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.ow2.asm</groupId>
                        <artifactId>asm</artifactId>
                        <version>6.2</version> <!-- Use newer version of ASM -->
                    </dependency>
                    <!-- https://mvnrepository.com/artifact/org.jboss.narayana.arjunacore/arjuna -->
                    <dependency>
                        <groupId>org.jboss.narayana.arjunacore</groupId>
                        <artifactId>arjuna</artifactId>
                        <version>7.0.0.Final</version>
                    </dependency>

                </dependencies>
            </plugin>
            <plugin>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3.2</version>
                <executions>
                    <execution>
                        <id>generate-java-sources</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                    <configuration>
                        <xadditionalHeaders>true</xadditionalHeaders>
                        <executable>${tool.wsimport}</executable><!-- Piu' veloce nel generare i sorgenti -->
                        <wsdlDirectory>src/main/resources/wsdl</wsdlDirectory>
                        <target>2.1</target>
                    </configuration>
                </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>javax.annotation</groupId>
                        <artifactId>javax.annotation-api</artifactId>
                        <version>1.3.2</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.xml.bind</groupId>
                        <artifactId>jaxb-api</artifactId>
                        <version>2.3.1</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.xml.ws</groupId>
                        <artifactId>jaxws-api</artifactId>
                        <version>2.3.1</version>
                    </dependency>
                    <dependency>
                        <groupId>javax.jws</groupId>
                        <artifactId>javax.jws-api</artifactId>
                        <version>1.1</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <artifactId>maven-war-plugin</artifactId>
                <version>3.4.0</version>
                <configuration>
                    <failOnMissingWebXml>false</failOnMissingWebXml>
                </configuration>
            </plugin>
            <plugin>
                <groupId>external.atlassian.jgitflow</groupId>
                <artifactId>jgitflow-maven-plugin</artifactId>
                <version>1.0-m5.1</version>
                <configuration>
                    <releaseBranchVersionSuffix>RC</releaseBranchVersionSuffix>
                    <noDeploy>true</noDeploy>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.10</version>
                <executions>
                    <!-- test unitari-->
                    <execution>
                        <id>prepare agent</id>

                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- test integrazione -->
                    <execution>
                        <id>prepare agent integration</id>

                        <goals>
                            <goal>prepare-agent-integration</goal>
                        </goals>
                        <configuration>
                            <propertyName>jacocoAgent</propertyName>
                            <classDumpDir>${project.build.directory}/dumpClassDir</classDumpDir>
                            <output>file</output>
                            <append>true</append>
                            <dumpOnExit>true</dumpOnExit>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jboss.as.plugins</groupId>
                <artifactId>jboss-as-maven-plugin</artifactId>
                <version>7.9.Final</version>
                <configuration>
                    <!--
                         In produzione c'e' JBoss EAP 6.3 => JBoss AS 7.4.0.Final
                         ma tale release non e' disponibile nei repo Maven
                         quindi usiamo la versione piu' simile disponibile
                      -->
                    <version>7.4.0.Final-redhat-4</version>
                    <jvmArgs>-Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true
                        -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
                        -Dsun.rmi.dgc.server.gcInterval=3600000
                        -Djboss.socket.binding.port-offset=100
                        -Djboss.server.config.dir=${project.build.testOutputDirectory}/configuration
                        ${jacocoAgent}
<!--                        &lt;!&ndash;per eseguire il debug remoto rimuovere il commento dalla riga sottostante-->
<!--                            -Xrunjdwp:transport=dt_socket,address=33333,server=y,suspend=y-->
                    </jvmArgs>
                    <port>10099</port>
                </configuration>
                <executions>
                    <execution>
                        <id>start</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>start</goal>
                        </goals>
                        <configuration>
                            <startup-timeout>120</startup-timeout>
                        </configuration>
                    </execution>
                    <execution>
                        <id>avoid-console-logging</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>execute-commands</goal>
                        </goals>
                        <configuration>
                            <execute-commands>
                                <commands>
                                    <command>/subsystem=logging/root-logger=ROOT:root-logger-unassign-handler(name="CONSOLE")</command>
                                </commands>
                            </execute-commands>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy</id>
                        <phase>pre-integration-test</phase>
                        <goals>
                            <goal>deploy</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>stop</id>
                        <phase>post-integration-test</phase>
                        <goals>
                            <goal>undeploy</goal><!-- Per eseguire "mvn verify" e non solo "mvn clean verify" -->
                            <goal>shutdown</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId><!-- Deve stare ***DOPO*** il maven-resources-plugin -->
                <version>3.1.0</version>
                <executions>
                    <execution>
                        <id>loadProperties</id>
                        <phase>process-resources</phase>
                        <configuration>
                            <exportAntProperties>true</exportAntProperties>
                            <target>
                                <exec executable="hostname" outputproperty="computer.hostname" />
                                <!-- Default "overwrite=false" => non sovrascrive l'eventuale properties gia' presente -->
                                <copy file="src/test/resources/local.properties" tofile="${project.build.outputDirectory}/${computer.hostname}.properties" />
                                <loadproperties srcFile="${project.build.outputDirectory}/${computer.hostname}.properties" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings
                    only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.jvnet.jax-ws-commons</groupId>
                                        <artifactId>jaxws-maven-plugin</artifactId>
                                        <versionRange>[2.3,)</versionRange>
                                        <goals>
                                            <goal>wsimport</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <profiles>

        <profile>
            <id>Jenkins</id>
            <build>
                <plugins>
                    <!--forza l'utilizzo della toolchain JDK 7 per la build -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-toolchains-plugin</artifactId>
                        <version>1.1</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>toolchain</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <toolchains>
                                <jdk>
                                    <version>1.7</version>
                                </jdk>
                            </toolchains>
                        </configuration>
                    </plugin>
                    <!--Il plugin di JBoss non è toolchain-aware, per cui si deve forzare l'esecuzione di JBoss su JDK7 -->
                    <plugin>
                        <groupId>org.jboss.as.plugins</groupId>
                        <artifactId>jboss-as-maven-plugin</artifactId>
                        <version>7.8.Final</version>
                        <configuration>
                            <javaHome>${jdkJenkins}</javaHome>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
            <properties>
                <jdkJenkins>/opt/java/jdk1.7.0_71</jdkJenkins>
                <!--disabilita il plugin enforcer (perche' non e' toolchain-aware e comunque non serve dal -->
                <!--momento che si specifica esplicitamente il JDK utilizzato tramite JDK toolchain        -->
                <enforcer.skip>true</enforcer.skip>
                <!-- imposta il path di wsimport nel server Jenkins per il maven-jaxws-plugin -->
                <tool.wsimport>${jdkJenkins}/bin/wsimport</tool.wsimport>
            </properties>
        </profile>
    </profiles>
</project>

我试着在网上搜索,但我找不到正确的配置。你有什么建议吗?

iqjalb3h

iqjalb3h1#

jboss-as-maven-plugin已弃用。您应该使用[ wildfly-maven-plugin ]。
请注意,wildfly-maven-plugin 4.x至少需要Java 11,3.x至少需要Java 8。

相关问题