Jar upload test strange behaviour on OSX platform ( Junit / glass fish / grizzly)

45 Views Asked by At

I am currently testing a maven composite project, and some REST-API upload test are failing on a Mac platform (Big Sur latest) while the same tests are succeeding on windows and Linux platforms.
FYI, the maven version is (concurrently used with openJDK-8):

User@-bash - bin - 11:03:14 $ mvn --version
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /Users/User/Library/Maven/apache-maven-3.6.3
Java version: 1.8.0_292, vendor: AdoptOpenJDK, runtime: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"

The test error occurs while trying to POST a jar archive to the system:

WARNING: GRIZZLY0013: Exception during FilterChain execution
java.lang.IllegalStateException: Unknown protocol [ݺÈVß*ZäМW·Tœ--§‚Pçk5W‚Q5ãÄëq­ßR
    at org.glassfish.grizzly.http.Protocol.valueOf(Protocol.java:87)
    at org.glassfish.grizzly.http.HttpHeader.getProtocol(HttpHeader.java:799)
    at org.glassfish.grizzly.http.HttpServerFilter.prepareResponse(HttpServerFilter.java:842)
    at org.glassfish.grizzly.http.HttpServerFilter.encodeHttpPacket(HttpServerFilter.java:809)
    at org.glassfish.grizzly.http.HttpServerFilter.commitAndCloseAsError(HttpServerFilter.java:1169)
    at org.glassfish.grizzly.http.HttpServerFilter.sendBadRequestResponse(HttpServerFilter.java:1161)
    at org.glassfish.grizzly.http.HttpServerFilter.onHttpHeaderError(HttpServerFilter.java:771)
    at org.glassfish.grizzly.http.HttpCodecFilter.handleRead(HttpCodecFilter.java:603)
    at org.glassfish.grizzly.http.HttpServerFilter.handleRead(HttpServerFilter.java:310)
    at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:95)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:260)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:177)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:109)
    at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:88)
    at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:53)
    at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:515)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:89)
    at org.glassfish.grizzly.strategies.SameThreadIOStrategy.executeIoEvent(SameThreadIOStrategy.java:79)
    at org.glassfish.grizzly.strategies.AbstractIOStrategy.executeIoEvent(AbstractIOStrategy.java:66)
    at org.glassfish.grizzly.nio.SelectorRunner.iterateKeyEvents(SelectorRunner.java:391)
    at org.glassfish.grizzly.nio.SelectorRunner.iterateKeys(SelectorRunner.java:360)
    at org.glassfish.grizzly.nio.SelectorRunner.doSelect(SelectorRunner.java:324)
    at org.glassfish.grizzly.nio.SelectorRunner.run(SelectorRunner.java:255)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:569)
    at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:549)

As you can see, no project code is involved in this exception and I believe this is either due to a glassfish/grizzly misconfiguration.

What I did so far:

  • ensured only one maven installation exists on my machine by removing any brew installed maven version (even if this issue appears not to be maven related)
  • ensured JAVA_HOME to point to my openJDK-8 installation
  • ensured the test jar file to upload is a valid one

The code that emits this exception is below:

public class JarUploadTest extends org.glassfish.jersey.test.JerseyTest {

    @Test
    public void postArchive() throws Exception {
        final String archiveTargetURL = getUploadUrl();
        Response response = target(archiveTargetURL).request()
            .header(HttpHeaders.AUTHORIZATION, getBase64UserHeader())
            .post(Entity.entity(new FileInputStream(new File("target/test-classes", "UploadTest.jar")),
                MediaType.APPLICATION_OCTET_STREAM));
        assertEquals(200, response.getStatus());
    }

} 

Could anyone give some insight on how to solve this kind of weird issue ? Many thanks in advance !

0

There are 0 best solutions below