[ 
https://issues.apache.org/jira/browse/SUREFIRE-1424?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16220296#comment-16220296
 ] 

Krzysztof Krason commented on SUREFIRE-1424:
--------------------------------------------

I'm using surefire/failsafe 2.19.1 (because 2.20 has problem with jaxb, 2.20.1 
adds modules) and in one project using the dependencies above fixes Java 9 
compilation.
But in other project I get following error just before any failsafe is started:
{code}
[ERROR] Failed to execute goal 
org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test 
(default) on project portal-api-definitions-web: Execution default of goal 
org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test failed: 
java.lang.NoClassDefFoundError: javax/sql/DataSource: javax.sql.DataSource -> 
[Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal 
org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test 
(default) on project portal-api-definitions-web: Execution default of goal 
org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test failed: 
java.lang.NoClassDefFoundError: javax/sql/DataSource
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at 
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at 
org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at 
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at 
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default 
of goal org.apache.maven.plugins:maven-failsafe-plugin:2.19.1:integration-test 
failed: java.lang.NoClassDefFoundError: javax/sql/DataSource
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145)
        at 
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        ... 20 more
Caused by: org.apache.maven.surefire.util.SurefireReflectionException: 
java.lang.NoClassDefFoundError: javax/sql/DataSource
        at 
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:193)
        at 
org.apache.maven.surefire.util.ReflectionUtils.invokeGetter(ReflectionUtils.java:72)
        at 
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.getSuites(ProviderFactory.java:140)
        at 
org.apache.maven.plugin.surefire.booterclient.ForkStarter.getSuitesIterator(ForkStarter.java:615)
        at 
org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:268)
        at 
org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:242)
        at 
org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:201)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:1026)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:862)
        at 
org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:755)
        at 
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        ... 21 more
Caused by: java.lang.NoClassDefFoundError: javax/sql/DataSource
        at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
        at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3139)
        at java.base/java.lang.Class.getMethodsRecursive(Class.java:3280)
        at java.base/java.lang.Class.getMethod0(Class.java:3266)
        at java.base/java.lang.Class.getMethod(Class.java:2063)
        at 
org.apache.maven.surefire.util.ReflectionUtils.tryGetMethod(ReflectionUtils.java:61)
        at 
org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isSuiteOnly(JUnit3TestChecker.java:64)
        at 
org.apache.maven.surefire.common.junit3.JUnit3TestChecker.isValidJUnit3Test(JUnit3TestChecker.java:59)
        at 
org.apache.maven.surefire.common.junit3.JUnit3TestChecker.accept(JUnit3TestChecker.java:54)
        at 
org.apache.maven.surefire.common.junit4.JUnit4TestChecker.accept(JUnit4TestChecker.java:52)
        at 
org.apache.maven.surefire.util.DefaultScanResult.applyFilter(DefaultScanResult.java:98)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.scanClassPath(JUnit4Provider.java:311)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.getSuites(JUnit4Provider.java:305)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at 
java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at 
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:185)
        ... 31 more
Caused by: java.lang.ClassNotFoundException: javax.sql.DataSource
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:466)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:563)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
        at 
org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:97)
        ... 49 more
{code}

This project indeed has javax.sql.DataSource used in the code.

> javax.transaction.TransactionManager not visible with Java9
> -----------------------------------------------------------
>
>                 Key: SUREFIRE-1424
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1424
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.20.1
>         Environment: Apache Maven 3.5.0 
> (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
> Maven home: /Users/snicoll/tools/maven
> Java version: 9, vendor: Oracle Corporation
> Java home: /Library/Java/JavaVirtualMachines/jdk-9.jdk/Contents/Home
> Default locale: en_BE, platform encoding: UTF-8
> OS name: "mac os x", version: "10.12.6", arch: "x86_64", family: "mac"
>            Reporter: Stephane Nicoll
>            Assignee: Tibor Digana
>
> I am trying to port Spring Boot to Java9 and I am hitting an issue that looks 
> like Maven specific. I've managed to trim down the problem to [a simple class 
> that doesn't involve Spring 
> Boot|https://github.com/snicoll-scratches/test-jta-java9]
> If I run this project on the command line, I get the following:
> {noformat}
> Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.043 s <<< 
> FAILURE! - in com.example.testjtajava9.TestJtaJava9ApplicationTests
> contextLoads(com.example.testjtajava9.TestJtaJava9ApplicationTests)  Time 
> elapsed: 0.006 s  <<< ERROR!
> java.lang.NoClassDefFoundError: javax/transaction/TransactionManager
>       at 
> com.example.testjtajava9.TestJtaJava9ApplicationTests.contextLoads(TestJtaJava9ApplicationTests.java:9)
> Caused by: java.lang.ClassNotFoundException: 
> javax.transaction.TransactionManager
>       at 
> com.example.testjtajava9.TestJtaJava9ApplicationTests.contextLoads(TestJtaJava9ApplicationTests.java:9)
> {noformat}
> If I run that test with IntelliJ IDEA, it passes. This sample project has 
> also a simple Gradle build that shows it works with Gradle as well.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to