java/net/SetFactoryPermission/ fails with error "factory already defined"

EL MAAKOUL IMANE maakoulimane at
Thu Sep 8 11:19:16 UTC 2016


When running Jtreg test suite with jdk9, the test:
fails with the exception:

java.lang.Error: factory already defined

This error only happens when: java/net/ is run before
java/net/SetFactoryPermission/ within the same
agent. This is explained by the fact that in java/net/
calls the setter URL.setURLStreamHandlerFactory is called with a non-null
parameter, which can be called only once in a JVM instance according to the

Consequently the VM that runs java/net/ is invalid for
running java/net/SetFactoryPermission/

To solve that problem, an annotation could be added to the test
java/net/ to tell Jtreg runner to spawn a new VM for that

Note: This is reproducible using the -agentvm and setting the concurrency
to 1 and also renaming
the package of one of the tests to force it to be executed first.
Reproducible always with jdk9.

Best regards,
Imane EL Maakoul
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the jtreg-use mailing list