Home > database >  jaxws not compatible with javafx modules?
jaxws not compatible with javafx modules?

Time:11-29

I have an java project with javafx and jaxws. Here a small snippelt from my gradle:

dependencies {
  implementation 'com.sun.xml.ws:jaxws-ri:4.0.0'
}

javafx {
    version = "19"
    modules = [ 'javafx.controls', 'javafx.fxml' ]
}

task runClient(type: JavaExec) {
    description = 'Run Client'
    classpath = sourceSets.main.runtimeClasspath

    jvmArgs = ['--module-path', classpath.asPath, '--add-modules', 'javafx.controls,javafx.fxml']
    main = 'ClientMain'
}

I set this jvmArgs because of How to include plugin dependencies in JavaExec task classpath?. I don't actually use modules otherwise in my project.

I now get the error:

Error occurred during initialization of boot layer
java.lang.module.FindException: Module format not recognized: C:\Users\MyName\.gradle\caches\modules-2\files-2.1\com.sun.xml.ws\release-documentation\4.0.0\5eb09d77be092684546352a35f315423d67e044b\release-documentation-4.0.0-docbook.zip

Without javafx or jaxws everything is working. Only together there seems to be problems. Any ideas?

CodePudding user response:

You are using the wrong dependency for jaxws for your purposes. The difference in distributions is explained here:

jaxws-ri contains zipped documentation which should not be part of a modular distribution.

These are dependencies you should be using (maven format, you will need translate the information gradle format):

<dependencies>
    <dependency>
        <groupId>jakarta.xml.ws</groupId>
        <artifactId>jakarta.xml.ws-api</artifactId>
        <version>4.0.0</version>
    </dependency>
</dependencies>

<dependencies>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>4.0.0</version>
        <scope>runtime</scope>
    </dependency>
</dependencies>

Additional background info

jaxws reference implementations are now maintained via the Eclipse foundation as jakarta XML services as part of Eclipse Metro.

The code should also use the jakarta package namespace as shown in the jakarta documentation.

This would also apply to module names if you provide a module-info.

  • Related