You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Michael Musgrove <mm...@redhat.com> on 2016/07/25 14:04:17 UTC

Surefire forkMode failure when using jdk-9

When I run any surefire test (with reuseForks=false) that uses java.sql
classes on jdk-9 it fails with, for example:

[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test)
on project maven-surefire-plugin-example: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed:
java.lang.NoClassDefFoundError: java/sql/SQLException:
java.sql.SQLException -> [Help 1]

If I run it with reuseForks=true it works fine.

The problem was introduced when the openjdk team "Deprivileged the java.sql
and java.sql.rowset modules" in jdk build 9-ea+122 (
http://download.java.net/java/jdk9/changes/jdk-9+122.html).

A trivial reproducer is attached.

> tree src

├── pom.xml
└── src
    ├── main
    │   └── java
    │       └── J9Example.java
    └── test
        └── java
            └── J9Test.java

> mvn clean test -DreuseForks=false
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test)
on project maven-surefire-plugin-example: Execution default-test of goal
org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed:
java.lang.NoClassDefFoundError: java/sql/SQLException:
java.sql.SQLException -> [Help 1]

Mike


-- 
Michael Musgrove
Transactions Team
e: mmusgrov@redhat.com
t: +44 191 243 0870

Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham (US), Paul Hickey (Ireland), Matt Parson
(US), Charles Peters (US)

Michael Cunningham (US), Charles Peters (US), Matt Parson (US), Michael
O'Neill(Ireland)