不允许使用 jakarta.xml.ws.spi.Provider 密钥访问系统属性

问题描述 投票:0回答:2

我在执行Maven时发现这个错误

clean install
。我以前从未见过它,并且在网上找不到任何有关它的参考资料。尝试更改依赖项版本没有帮助。

nov 21, 2023 11:03:04 AM jakarta.xml.ws.spi.FactoryFinder lookupUsingOSGiServiceLoader
SEVERE: Access to the system property with key jakarta.xml.ws.spi.Provider is not allowed
java.lang.NullPointerException
    at jakarta.xml.ws.spi.FactoryFinder.lookupUsingOSGiServiceLoader(FactoryFinder.java:154)
    at jakarta.xml.ws.spi.FactoryFinder.find(FactoryFinder.java:99)
    at jakarta.xml.ws.spi.Provider.provider(Provider.java:64)
    at jakarta.xml.ws.Service.<init>(Service.java:82)
    at priv.gbbper.ws.documents_storage.v1.DocumentsStorageV1.<init>(DocumentsStorageV1.java:42)
    at it.bper.testing.integration.AbstractIT.<init>(AbstractIT.java:59)
    at it.bper.testing.integration.LocalStorageFoldersIT.<init>(LocalStorageFoldersIT.java:24)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
    at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:250)
    at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:260)
    at org.junit.runners.BlockJUnit4ClassRunner$2.runReflectiveCall(BlockJUnit4ClassRunner.java:309)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:306)
    at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
    at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
    at org.apache.maven.surefire.junitcore.pc.Scheduler$1.run(Scheduler.java:345)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)

这是 pom:

<?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>*****</groupId>
    <artifactId>*****</artifactId>
    <packaging>war</packaging>
    <version>1.22.0-SNAPSHOT</version>
    <name>****** Maven Webapp</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <filenet.cpe.install.path>X:/Program Files/IBM/FileNet/ContentEngine</filenet.cpe.install.path>
    </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>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.18.26</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>

     
        <dependency>
            <groupId>com.ibm.filenet</groupId>
            <artifactId>jace</artifactId>
            <version>4.5.2</version>
            <scope>system</scope>
            <systemPath>C:/Users/ActionICT-Motti/IdeaProjects/DocumentsStorage_v1/src/main/webapp/WEB-INF/lib/Jace.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>

        <!-- Logging libraries -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.21.1</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.14.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.bind</groupId>
            <artifactId>jakarta.xml.bind-api</artifactId>
            <version>4.0.1</version>
        </dependency>
        <dependency>
            <groupId>jakarta.xml.ws</groupId>
            <artifactId>jakarta.xml.ws-api</artifactId>
            <version>4.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.3.7</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.hk2</groupId>
            <artifactId>osgi-resource-locator</artifactId>
            <version>2.5.0-b42</version>
        </dependency>



    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-failsafe-plugin</artifactId>
                <version>3.2.1</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>[17,)</version>
                                </requireJavaVersion>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>-->
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>4.0.1</version>
                <executions>
                <execution>
                    <id>1</id>
                    <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>3.0</target>
                    </configuration>
                </execution>
                </executions>
            </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.11</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.wildfly.plugins</groupId>
                <artifactId>wildfly-maven-plugin</artifactId>
                <version>4.0.0.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>23.0.0.Final</version>
                    <javaOpts>
                        -Xms64m
<!--                        -Xmx512m-->
<!--                        -XX:MaxMetaspaceSize=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-->
                    </javaOpts>
                    <port>10090</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>
                    </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>
                <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>3.1.0</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.wildfly.plugins</groupId>
                        <artifactId>wildfly-maven-plugin</artifactId>
                        <version>4.2.0.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>
maven wildfly pom.xml wildfly-23
2个回答
1
投票

我对 Java 版本 > 11 也有同样的错误。
我已经使用 POM 中的 Maven 依赖项解决了这个问题:

    <dependency>
       <groupId>com.sun.xml.ws</groupId>
       <artifactId>jaxws-rt</artifactId>
       <version>4.0.2</version>
   </dependency>

0
投票

这也可能有效:

<dependency>
    <groupId>org.apache.cxf</groupId>
    <artifactId>cxf-rt-frontend-jaxws</artifactId>
    <version>4.0.4</version>
</dependency>
© www.soinside.com 2019 - 2024. All rights reserved.