java .lang.IllegalArgumentException at org.glassfi sh .hk2.external.org.objectweb.asm.ClassReader: NPE - PullRequest
1 голос
/ 29 января 2020
I am getting below exception when running arquillian test case with + jdk 11 + payara embedded 2.0 :

Jan. 29, 2020 9:38:12 A.M. org.glassfish.hk2.classmodel.reflect.Parser$5 on
SEVERE: 

    Exception while visiting WEB-INF/classes/api/JwtTest.class of size 3890
    java.lang.IllegalArgumentException
        at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:160)
        at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:143)
        at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:418)
        at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:335)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:141)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:103)
        at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:321)
        at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:44)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:280)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:269)
        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)

    Jan. 29, 2020 9:38:12 A.M. org.glassfish.hk2.classmodel.reflect.Parser$5 on
    SEVERE: 



    Exception while visiting WEB-INF/classes/api/RBACAuthorizationTest.class of size 3966
    java.lang.IllegalArgumentException
        at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:160)
        at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:143)
        at org.glassfish.hk2.external.org.objectweb.asm.ClassReader.<init>(ClassReader.java:418)
        at org.glassfish.hk2.classmodel.reflect.Parser$5.on(Parser.java:335)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.handleEntry(ReadableArchiveScannerAdapter.java:141)
        at com.sun.enterprise.v3.server.ReadableArchiveScannerAdapter.onSelectedEntries(ReadableArchiveScannerAdapter.java:103)
        at org.glassfish.hk2.classmodel.reflect.Parser.doJob(Parser.java:321)
        at org.glassfish.hk2.classmodel.reflect.Parser.access$300(Parser.java:44)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:280)
        at org.glassfish.hk2.classmodel.reflect.Parser$3.call(Parser.java:269)
        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)

My pom. xml включает: glassfi sh -embedded-all

      <dependency>
    <groupId>org.jboss.arquillian.junit</groupId>
    <artifactId>arquillian-junit-container</artifactId>
    <version>1.4.0.Final</version>
    <scope>test</scope>
</dependency>

<dependency>
    <groupId>fish.payara.arquillian</groupId>
    <artifactId>arquillian-payara-server-embedded</artifactId>
    <version>2.0</version>
    <scope>test</scope>
</dependency>

, когда я строю войну и развертываю в паяре 5.194 свою работоспособность. Но когда я запускаю тестовые случаи в Arquillian, я получаю ошибку, как упоминалось выше. Нужно ли мне добавлять какие-либо дополнительные зависимости в мой pom. xml?

-----------------------------------------------------------------------------

After trying for a while , below fix worked for me. If you are testing arquillin test cases in JDK 11 and payara 1.594 then your pom.xml should look like below : 

<dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.glassfish.external</groupId>
                <artifactId>management-api</artifactId>
                <version>3.2.2</version>
            </dependency>

            <dependency>
                <groupId>org.jboss.arquillian</groupId>
                <artifactId>arquillian-bom</artifactId>
                <version>1.4.1.Final</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
        </dependencies>

    </dependencyManagement>
<dependencies>

        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>2.30</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-ri</artifactId>
            <version>2.3.0</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>2.0.1.Final</version>
        </dependency>
        <dependency>
            <groupId>javax</groupId>
            <artifactId>javaee-api</artifactId>
            <version>8.0</version>
            <type>jar</type>
            <scope>provided</scope>
        </dependency>

    <dependency>
            <groupId>org.jboss.arquillian.junit</groupId>
            <artifactId>arquillian-junit-container</artifactId>
            <version>1.4.0.Final</version>
            <scope>test</scope>
        </dependency>
    <dependency>
            <groupId>fish.payara.arquillian</groupId>
            <artifactId>arquillian-payara-server-4-embedded</artifactId>
            <version>1.0.Beta3</version>
            <scope>test</scope>
        </dependency>


        <dependency>
            <groupId>fish.payara.extras</groupId>
            <artifactId>payara-embedded-all</artifactId>
            <version>5.194</version>
            <scope>test</scope>
        </dependency>
<dependencies>
<plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
    <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.19.1</version>
                <configuration>
                    <!--<forkCount>1</forkCount>-->
                    <reuseForks>false</reuseForks>
                    <argLine>-Xmx4096m</argLine>
                    <systemProperties>
                        <arquillian.launch>glassfish-embedded</arquillian.launch>
                    </systemProperties>
                </configuration>
            </plugin>
</plugins>

Мы можем запустить тестовые случаи с сервером Payara 1.594 в Intellij. Вы также можете добавить ниже параметры виртуальной машины: --add-exports java .base / jdk.internal.loader = ALL-UNNAMED.

Надеюсь, это поможет.

...