Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.IllegalStateException: No Server ALPNProcessors - WireMock

Tags:

java

wiremock

I am trying to run unit tests (that use Wiremock) on my maven project and the following error is observed.

java.lang.IllegalStateException: No Server ALPNProcessors

I tried adding the alpn-boot-8.1.12.v20180117.jar to the Xbootclasspath as follows

-Xbootclasspath/p:/path/to/alpn-boot-8.1.12.v20180117.jar

and have put it in the jvm.config file in the .mvn directory of my project and verified that it is being set by doing a ps -ef | grep Xbootclasspath but still I am getting the same error.

It is working on Windows machine with Java 8 u191 and without adding any Xbootclasspath but not on Linux with Java 8 u181

I also tried adding the following dependency to my pom.xml

<dependency>
    <groupId>org.eclipse.jetty</groupId>
    <artifactId>jetty-alpn-server</artifactId>
    <version>9.4.20.v20190813</version>
    <scope>test</scope>
</dependency>

but still did not work.

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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.version}</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.0.0-M3</version>
                <configuration>
                    <workingDirectory>${real.base.dir}</workingDirectory>
                    <systemProperties>
                        <log4j.configurationFile>${basedir}/src/test/resources/log4j.xml</log4j.configurationFile>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- attached to Maven test phase -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.googlecode.addjars-maven-plugin</groupId>
                <artifactId>addjars-maven-plugin</artifactId>
                <version>1.0.5</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>add-jars</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${basedir}/lib</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.version>3.8.1</maven.compiler.version>
        <maven.surefire.version>3.0.0-M3</maven.surefire.version>

        <javax.validation.version>2.0.1.Final</javax.validation.version>
        <syncope.version>2.1.5</syncope.version>
        <resteasy.client.version>4.4.2.Final</resteasy.client.version>
        <jax.rs.version>2.1.1</jax.rs.version>
        <junit.jupiter.version>5.5.2</junit.jupiter.version>

        <jacoco.version>0.8.5</jacoco.version>
        <real.base.dir>${basedir}</real.base.dir>
    </properties>

    <dependencies>

        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>${javax.validation.version}</version>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>${jax.rs.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>${resteasy.client.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${resteasy.client.version}</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>4.4.2.Final</version>
        </dependency>

        <dependency>
            <groupId>org.syncope.identityconnectors</groupId>
            <artifactId>framework</artifactId>
            <version>0.4.3</version>
        </dependency>


        <!-- Start Test dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.jupiter.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.github.tomakehurst</groupId>
            <artifactId>wiremock-jre8</artifactId>
            <version>2.25.1</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <version>3.2.4</version>
            <scope>test</scope>
        </dependency>

        <!-- End Test dependencies -->
    </dependencies>

</project>
like image 576
JavaTechnical Avatar asked Nov 16 '22 17:11

JavaTechnical


1 Answers

Just incase any M1 Mac users stumble onto this page like I did.


My Issue -

My spring boot project with wiremock tests, would run on my old intel mac but failed to run when I moved to my new M1 Mac.

_ _

I had 2 error messages

  • java.lang.IllegalStateException: No Server ALPNProcessors!
  • Suppressed: java.lang.UnsatisfiedLinkError: no conscrypt_openjdk_jni-osx-aarch_64

Fix -

I needed a property to test.application

wiremock.server.httpsPort=-1

like image 155
Jamie Lui Avatar answered Feb 16 '23 00:02

Jamie Lui