ClassnotFoundException jakarta.Name:使用 Jakarta 运行 deltaspike 1.9.6 测试 CDITestRunner 时出现 NamingException

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

我正在尝试在我们的测试中使用 CDITestRunner,使用 deltaspike 和 jakarta 1.9.6 版本以及 apache open web beans。 它没有使用 CDITestRunner 运行测试并抛出 ClassnotFoundException jakarta.Name:NamingException。

ClassnotFoundException jakarta.Name:NamingException

似乎是因为 jakarta.naming 包不可用而导致错误,我是否需要提供单独的依赖项,因为我在 deltaspike 依赖项中没有看到任何 jakarta 传递依赖项。任何人都可以指导 NamingException 类需要哪个依赖项解决了。

  <?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>newproject</groupId>
    <artifactId>test-project</artifactId>
    <name>Test Server</name>
    <version>1.00</version>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>17</java.version>
        <jv.version>17</jv.version>
        <openwebbeans.version>2.0.27</openwebbeans.version>
        <slf4j.version>2.0.0-alpha5</slf4j.version>
        <xmlbeans.version>3.1.0</xmlbeans.version>
        <dom4j.version>2.1.3</dom4j.version>
        <guava.version>30.0-jre</guava.version>
        <glassfish.jersey.version>3.1.1</glassfish.jersey.version>
        <fasterxml.jackson.jaxrs>2.14.1</fasterxml.jackson.jaxrs>
        <fasterxml.jackson.core>2.14.1</fasterxml.jackson.core>
        <bonecp.version>0.8.0.RELEASE</bonecp.version>
        <antlr4.version>4.8-1</antlr4.version>
        <soap-api.version>1.4.0</soap-api.version>
        <xmlsec.version>3.0.0</xmlsec.version>
        <javax.activation-api.version>1.2.0</javax.activation-api.version>
        <jaxws-rt.version>4.0.1</jaxws-rt.version>
        <jaxb-runtime.version>3.0.2</jaxb-runtime.version>
        <javax.annotation-api.version>1.3.2</javax.annotation-api.version>
        <hk2-api.version>3.0.3</hk2-api.version>
        <oracle.ojdbc.version>21.6.0.0.1</oracle.ojdbc.version>
        <javax.mail.version>2.0.1</javax.mail.version>
        <javax.jms.version>1.1</javax.jms.version>
        <javax.persistence>2.2</javax.persistence>
        <servlet.api.version>5.0.0</servlet.api.version>
        <apache.geronimo.version>1.2</apache.geronimo.version>
        <apache.geronimo.jms.version>1.1.1</apache.geronimo.jms.version>
        <apache.geronimo.jee.version>1.0.1</apache.geronimo.jee.version>
        <!-- Maven plugin versions -->
        <jaxws.maven.plugin.version>3.0.0</jaxws.maven.plugin.version>
    </properties>


    <dependencyManagement>
        <dependencies>
            
            <dependency>
                <groupId>javax.inject</groupId>
                <artifactId>javax.inject</artifactId>
                <version>${javax.inject.version}</version>
            </dependency>
            <dependency>
                <groupId>jakarta.annotation</groupId>
                <artifactId>jakarta.annotation-api</artifactId>
                <version>2.1.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.deltaspike.cdictrl</groupId>
                <artifactId>deltaspike-cdictrl-owb</artifactId>
                <version>1.9.6</version>
                <classifier>jakarta</classifier>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.deltaspike.core</groupId>
                <artifactId>deltaspike-core-api</artifactId>
                <version>1.9.6</version>
                <classifier>jakarta</classifier>
            </dependency>
            
            <dependency>
                <groupId>org.apache.deltaspike.core</groupId>
                <artifactId>deltaspike-core-impl</artifactId>
                <version>1.9.6</version>
                <classifier>jakarta</classifier>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-test-control-module-api</artifactId>
                <version>1.9.6</version>
                <classifier>jakarta</classifier>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <artifactId>deltaspike-core-api</artifactId>
                        <groupId>org.apache.deltaspike.core</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.deltaspike.modules</groupId>
                <artifactId>deltaspike-test-control-module-impl</artifactId>
                <version>1.9.6</version>
                <classifier>jakarta</classifier>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <artifactId>deltaspike-core-api</artifactId>
                        <groupId>org.apache.deltaspike.core</groupId>
                    </exclusion>
                    <exclusion>
                        <artifactId>deltaspike-core-impl</artifactId>
                        <groupId>org.apache.deltaspike.core</groupId>
                    </exclusion>
                </exclusions>
            </dependency>
            
            <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-ri</artifactId>
                <version>2.3.3</version>
            </dependency>
            <dependency>
            <groupId>jakarta.ws.rs</groupId>
            <artifactId>jakarta.ws.rs-api</artifactId>
            <version>3.1.0</version>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
            <dependency>
                <groupId>${project.groupId}</groupId>
                <artifactId>patcher-commons</artifactId>
                <version>${project.version}</version>
            </dependency>
            
            
            <dependency>
                <groupId>org.antlr</groupId>
                <artifactId>antlr4-runtime</artifactId>
                <version>4.8-1</version>
                <scope>runtime</scope>
            </dependency>
            <dependency>
                <groupId>commons-cli</groupId>
                <artifactId>commons-cli</artifactId>
                <version>1.5.0</version>
            </dependency>
            <dependency>
                <groupId>commons-beanutils</groupId>
                <artifactId>commons-beanutils</artifactId>
                <version>1.9.4</version>
            </dependency>
            <dependency>
                <groupId>commons-codec</groupId>
                <artifactId>commons-codec</artifactId>
                <version>1.15</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-collections4</artifactId>
                <version>4.4</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-dbcp2</artifactId>
                <version>2.9.0</version>
            </dependency>
            <dependency>
                <groupId>commons-dbutils</groupId>
                <artifactId>commons-dbutils</artifactId>
                <version>1.7</version>
            </dependency>
            <dependency>
                <groupId>commons-fileupload</groupId>
                <artifactId>commons-fileupload</artifactId>
                <version>1.4</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>2.11.0</version>
            </dependency>
            <dependency>
                <groupId>commons-logging</groupId>
                <artifactId>commons-logging</artifactId>
                <version>1.2</version>
            </dependency>
            <dependency>
                <groupId>commons-validator</groupId>
                <artifactId>commons-validator</artifactId>
                <version>1.7</version>
            </dependency>
            <dependency>
                <groupId>commons-configuration</groupId>
                <artifactId>commons-configuration</artifactId>
                <version>1.10</version>
            </dependency>
            
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-exec</artifactId>
                <version>1.3</version>
            </dependency>
            
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>javax.servlet-api</artifactId>
                <version>3.0.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>xalan</groupId>
                        <artifactId>xalan</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
    
            <dependency>
                <groupId>com.oracle.database.jdbc</groupId>
                <artifactId>ojdbc8</artifactId>
                <version>${oracle.ojdbc.version}</version>
            </dependency>
            <dependency>
            <groupId>jakarta.validation</groupId>
            <artifactId>jakarta.validation-api</artifactId>
            <version>3.0.2</version>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
            <dependency>
                <groupId>com.sun.mail</groupId>
                <artifactId>jakarta.mail</artifactId>
                <version>${javax.mail.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.jms</groupId>
                <artifactId>jms</artifactId>
                <version>${javax.jms.version}</version>
            </dependency>
            
            <dependency>
                <groupId>jakarta.inject</groupId>
                <artifactId>jakarta.inject-api</artifactId>
                <version>2.0.1</version>
            </dependency>
            
            <dependency>
                <groupId>org.quartz-scheduler</groupId>
                <artifactId>quartz</artifactId>
                <version>2.3.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <!--https://mvnrepository.com/artifact/net.sf.jtidy/jtidy-->
            <dependency>
                <groupId>net.sf.jtidy</groupId>
                <artifactId>jtidy</artifactId>
                <version>r938</version>
            </dependency>
            <dependency>
                <groupId>jakarta.servlet</groupId>
                <artifactId>jakarta.servlet-api</artifactId>
                <version>5.0.0</version>
            </dependency>
            
            
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-kahadb-store</artifactId>
                <version>5.16.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-broker</artifactId>
                <version>5.16.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.activemq</groupId>
                <artifactId>activemq-client</artifactId>
                <version>5.16.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>org.slf4j</groupId>
                        <artifactId>slf4j-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-jms_1.1_spec</artifactId>
                <version>${apache.geronimo.jms.version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-j2ee-management_1.1_spec</artifactId>
                <version>${apache.geronimo.jee.version}</version>
            </dependency>
            
            <dependency>
                <groupId>jakarta.persistence</groupId>
                <artifactId>jakarta.persistence-api</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.ext.cdi</groupId>
                <artifactId>jersey-cdi1x</artifactId>
                <version>${glassfish.jersey.version}</version>
            </dependency>
            <dependency>
                <groupId>com.sun.istack</groupId>
                <artifactId>istack-commons-runtime</artifactId>
                <version>4.0.0</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.jaxrs</groupId>
                <artifactId>jackson-jaxrs-base</artifactId>
                <version>${fasterxml.jackson.jaxrs}</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.jaxrs</groupId>
                <artifactId>jackson-jaxrs-json-provider</artifactId>
                <version>${fasterxml.jackson.jaxrs}</version>
            </dependency>
            
            <dependency>
                <groupId>org.apache.xmlbeans</groupId>
                <artifactId>xmlbeans</artifactId>
                <version>${xmlbeans.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>stax</groupId>
                        <artifactId>stax-api</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.dom4j</groupId>
                <artifactId>dom4j</artifactId>
                <version>${dom4j.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            
            <dependency>
                <groupId>com.jolbox</groupId>
                <artifactId>bonecp</artifactId>
                <version>${bonecp.version}</version>
            </dependency>
            <dependency>
                <groupId>jakarta.xml.soap</groupId>
                <artifactId>jakarta.xml.soap-api</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.apache.santuario</groupId>
                <artifactId>xmlsec</artifactId>
                <version>${xmlsec.version}</version>
            </dependency>
        <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-el_2.2_spec</artifactId>
                <version>1.2</version>
                <classifier>jakarta</classifier>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-annotation_1.3_spec</artifactId>
                <version>1.3</version>
                <classifier>jakarta</classifier>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-jcdi_2.0_spec</artifactId>
                <version>1.3</version>
                <classifier>jakarta</classifier>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-atinject_1.0_spec</artifactId>
                <version>1.3</version>
                <classifier>jakarta</classifier>
            </dependency>
            <dependency>
                <groupId>org.apache.geronimo.specs</groupId>
                <artifactId>geronimo-interceptor_1.2_spec</artifactId>
                <version>1.3</version>
                <classifier>jakarta</classifier>
            </dependency>
            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-spi</artifactId>
                <version>2.0.27</version>
                <classifier>jakarta</classifier>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.openwebbeans</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-impl</artifactId>
                <version>2.0.27</version>
                <classifier>jakarta</classifier>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.openwebbeans</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-web</artifactId>
                <version>${openwebbeans.version}</version>
                <classifier>jakarta</classifier>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
            </dependency>
            <dependency>
                <groupId>org.apache.openwebbeans</groupId>
                <artifactId>openwebbeans-se</artifactId>
                <version>2.0.27</version>
                <classifier>jakarta</classifier>
                <exclusions>
                    <exclusion>
                        <groupId>org.apache.openwebbeans</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                    <exclusion>
                        <groupId>org.apache.geronimo.specs</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-rt</artifactId>
                <version>${jaxws-rt.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.inject</groupId>
                <artifactId>jersey-hk2</artifactId>
                <version>${glassfish.jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>jakarta.activation</groupId>
                <artifactId>jakarta.activation-api</artifactId>
                <version>2.1.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>jakarta.xml.bind</groupId>
                <artifactId>jakarta.xml.bind-api</artifactId>
                <version>3.0.0</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-runtime</artifactId>
                <version>3.0.0</version>
            </dependency>
         <dependency>
                    <groupId>com.sun.xml.bind</groupId>
                    <artifactId>jaxb-impl</artifactId>
                    <version>3.0.0</version>
                </dependency>
        <dependency>
                <groupId>org.glassfish.jaxb</groupId>
                <artifactId>jaxb-core</artifactId>
                <version>3.0.1</version>
            </dependency>
            <dependency>
                <groupId>jakarta.xml.ws</groupId>
                <artifactId>jakarta.xml.ws-api</artifactId>
                <version>3.0.1</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.messaging.saaj</groupId>
                <artifactId>saaj-impl</artifactId>
                <version>3.0.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>javax.jws</groupId>
                <artifactId>jsr181-api</artifactId>
                <version>1.0-MR1</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.stream.buffer</groupId>
                <artifactId>streambuffer</artifactId>
                <version>1.5.9</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.org.apache.xml.internal</groupId>
                <artifactId>resolver</artifactId>
                <version>20050927</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>policy</artifactId>
                <version>4.0.0</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.gmbal</groupId>
                <artifactId>gmbal-api-only</artifactId>
                <version>4.0.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>com.sun.xml.ws</groupId>
                <artifactId>rt-ha</artifactId>
                <version>2.3.0.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.media</groupId>
                <artifactId>jersey-media-multipart</artifactId>
                <version>${glassfish.jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.jersey.media</groupId>
                <artifactId>jersey-media-json-jackson</artifactId>
                <version>${glassfish.jersey.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>jakarta.el</groupId>
                <artifactId>jakarta.el-api</artifactId>
                <version>5.0.1</version>
            </dependency>
            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-lang3</artifactId>
                <version>3.12.0</version>
            </dependency>
            <dependency>
                <groupId>org.glassfish</groupId>
                <artifactId>jakarta.el</artifactId>
                <version>4.0.2</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.glassfish.hk2</groupId>
                <artifactId>hk2-locator</artifactId>
                <version>${hk2-api.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>org.glassfish.pfl</groupId>
                <artifactId>pfl-basic</artifactId>
                <version>4.1.2</version>
                <exclusions>
                    <exclusion>
                        <groupId>*</groupId>
                        <artifactId>*</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>net.javacrumbs.json-unit</groupId>
                <artifactId>json-unit</artifactId>
                <version>2.19.0</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-annotations</artifactId>
                <version>2.14.1</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-core</artifactId>
                <version>2.14.1</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-jaxb-annotations</artifactId>
                <version>2.14.1</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.module</groupId>
                <artifactId>jackson-module-jakarta-xmlbind-annotations</artifactId>
                <version>2.14.1</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.jakarta.rs</groupId>
                <artifactId>jackson-jakarta-rs-json-provider</artifactId>
                <version>2.14.1</version>
            </dependency>
            <dependency>
                <groupId>com.fasterxml.jackson.core</groupId>
                <artifactId>jackson-databind</artifactId>
                <version>2.14.1</version>
            </dependency>
            
            
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
                <version>${guava.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.guava</groupId>
                <artifactId>failureaccess</artifactId>
                <version>1.0.1</version>
            </dependency>
            

        </dependencies>
    </dependencyManagement>
</project>

https://deltaspike.apache.org/documentation/test-control.html

java.util.ServiceConfigurationError: org.apache.deltaspike.core.spi.config.ConfigSourceProvider: Provider org.apache.deltaspike.core.impl.config.DefaultConfigSourceProvider could not be instantiated

    at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:586)
    at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:813)
    at java.base/java.util.ServiceLoader$ProviderImpl.get(ServiceLoader.java:729)
    at java.base/java.util.ServiceLoader$3.next(ServiceLoader.java:1403)
    at org.apache.deltaspike.core.util.ServiceUtils.loadServiceImplementations(ServiceUtils.java:81)
    at org.apache.deltaspike.core.impl.config.ConfigImpl.init(ConfigImpl.java:80)
    at org.apache.deltaspike.core.impl.config.ConfigProviderImpl.getConfig(ConfigProviderImpl.java:53)
    at org.apache.deltaspike.core.impl.config.ConfigProviderImpl.getConfig(ConfigProviderImpl.java:43)
    at org.apache.deltaspike.core.api.config.ConfigResolver.resolve(ConfigResolver.java:655)
    at org.apache.deltaspike.testcontrol.api.junit.TestBaseConfig$ContainerIntegration.<clinit>(TestBaseConfig.java:29)
    at org.apache.deltaspike.testcontrol.api.junit.CdiTestRunner.<clinit>(CdiTestRunner.java:89)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:104)
    at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:86)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
    at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:37)
    at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:70)
    at org.junit.internal.requests.ClassRequest.createRunner(ClassRequest.java:28)
    at org.junit.internal.requests.MemoizingRequest.getRunner(MemoizingRequest.java:19)
    at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:50)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
    at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.NoClassDefFoundError: jakarta/naming/NamingException
    at org.apache.deltaspike.core.impl.config.LocalJndiConfigSource.getPropertyValue(LocalJndiConfigSource.java:53)
    at org.apache.deltaspike.core.impl.config.BaseConfigSource.initOrdinal(BaseConfigSource.java:54)
    at org.apache.deltaspike.core.impl.config.LocalJndiConfigSource.<init>(LocalJndiConfigSource.java:39)
    at org.apache.deltaspike.core.impl.config.DefaultConfigSourceProvider.<init>(DefaultConfigSourceProvider.java:59)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
    at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
    at java.base/java.util.ServiceLoader$ProviderImpl.newInstance(ServiceLoader.java:789)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: jakarta.naming.NamingException
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
    ... 37 more

进程已完成,退出代码为-1

cdi deltaspike jakarta-migration openwebbeans
2个回答
1
投票

看起来你正在混合 JakartaEE 和 EE8。不幸的是,两个版本之间存在包命名空间转换,并且它们不兼容。

OpenWebBeans 没有实现 JakartaEE 规范(截至撰写本文时)。因此,例如,这种依赖关系将不起作用(以及您的 pom 中的其他依赖关系):

<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>

所以你有两个选择:

  • 回到 EE8 API 级别(这对于 99% 的事情来说可能已经足够了,这是一个很好的框架)
  • 前进到 JakartaEE API 级别并从 OpenWebBeans 迁移。您必须使用另一种 CDI 实现,例如 Weld 或 Quarkus

0
投票

Deltaspike 发布了对 jakarta 命名空间的错误假设,导致所有对 javax.* 的引用变成 jakarta.*。使用的方法进一步导致使用 jakarta 分类器来拉入所有 javax 模块。他们随后很快修复了该问题,但拒绝发布补丁,并表示他们希望完成 2.0.0 版本的所有工作,包括删除弃用内容。 OWB 和其他不完全支持雅加达的国家(仍然不是全部)进一步推迟了这一进程。截至今天,这还没有发布,但最近已经有工作了。因此,对于 Deltaspike 的使用,您别无选择,只能保留在 javax 命名空间上,直到版本 2 发布。

您可以在他们的 github 上围绕这组提交找到相关信息https://github.com/apache/deltaspike/commits/master?before=fd13102bca5aade74f08fe41af2cb6d3663d6fe0+105&branch=master&qualified_name=refs%2Fheads%2Fmaster显示它已修复1.9.6 发布后。此外,您可以在他们的 jira 中围绕此搜索找到此信息https://issues.apache.org/jira/browse/DELTASPIKE-1434?jql=project%20%3D%20DELTASPIKE%20AND%20text%20~%20% 22雅加达%22.

但是,您可以通过删除测试模块来进行改进。我不能代表 OWB,但对于 WELD,它具有直接的 junit 测试支持,因此这些模块对于这种情况已经过时很多年了。因此,虽然您的运行时使用必须保留在 javax 命名空间中,但您也许可以在 deltaspike 上了解您的需求。

© www.soinside.com 2019 - 2024. All rights reserved.