Skip to content

Workaround for "All Providers for type class java.net.URL returned a null value" #666

@volosied

Description

@volosied

In the WebSocket TCK, we have an app should fail to deploy due to misconfiguration. Some server implementations provide a placeholder URL while others do not provide any URL..

In the latter case (no URL), our server implementation encounters this exception:

java.lang.RuntimeException: Could not lookup value for field protected java.net.URL com.sun.ts.tests.websocket.common.client.WebSocketCommonClient.url
        at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:68)
        at org.jboss.arquillian.test.impl.TestInstanceEnricher.enrich(TestInstanceEnricher.java:51)
        at org.jboss.arquillian.container.test.impl.ClientTestInstanceEnricher.enrich(ClientTestInstanceEnricher.java:48)
         …

Caused by: java.lang.RuntimeException: All Providers for type class java.net.URL returned a null value: [org.jboss.arquillian.container.test.impl.enricher.resource.URLResourceProvider@573d07e6]
        at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.lookup(ArquillianResourceTestEnricher.java:126)
        at org.jboss.arquillian.test.impl.enricher.resource.ArquillianResourceTestEnricher.enrich(ArquillianResourceTestEnricher.java:66)

Example Test: https://github.com/jakartaee/platform-tck/blob/core-tck-11.0.0/websocket/spec-tests/src/main/java/com/sun/ts/tests/websocket/negdep/invalidpathparamtype/srv/onclose/WSCClientIT.java

URL Resource: https://github.com/jakartaee/platform-tck/blob/main/tcks/apis/websocket/common/src/main/java/com/sun/ts/tests/websocket/common/client/WebSocketCommonClient.java#L75C2-L75C20

Is there any workaround for this scenario? Or should a URL resource simply not be used in these cases?

If deployment fails, I wouldn't expect any URLs. (Though the test still wants to validate no endpoints are available) If the test used @ShouldThrowException, would that change the behavior any?

Appreciate any feedback. Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions