java .lang.UnsupportedOperationException: clientBuilder.sslSocketFactory (SSLSocketFactory) не поддерживается в JDK 9+ При использовании Java 8 в моем eclipse - PullRequest
0 голосов
/ 17 июня 2020

В моем проекте я использую java 8, и то же самое настроено в mu pom. xml, а также в моем eclipse. Но всякий раз, когда я пытаюсь скомпилировать свой код через mvn install, он выдает ошибку ниже. Я также не использую SSLSocketFactory в своем коде где-либо. И это началось внезапно, когда недавно весь мой проект был в eclipse.

Exception in thread "DefaultMetadataResolver-0-1" [INFO] ------------------------------------------------------------------------Exception in thread "DefaultMetadataResolver-0-0" java.lang.UnsupportedOperationException: clientBuilder.sslSocketFactory(SSLSocketFactory)
not supported on JDK 9+ at okhttp3.internal.platform.Jdk9Platform.trustManager(Jdk9Platform.java:78) at okhttp3.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.java:650) at io.takari.aether.okhttp.OkHttpAetherClient.
<init>(OkHttpAetherClient.java:98) at io.takari.aether.connector.AetherRepositoryConnector.newAetherClient(AetherRepositoryConnector.java:276)[INFO] BUILD FAILURE at io.takari.aether.connector.AetherRepositoryConnector.
  <init>(AetherRepositoryConnector.java:191) [INFO] ------------------------------------------------------------------------ at io.takari.aether.connector.AetherRepositoryConnectorFactory.newInstance(AetherRepositoryConnectorFactory.java:89) at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:113)
    at org.eclipse.aether.internal.impl.DefaultMetadataResolver$ResolveTask.run(DefaultMetadataResolver.java:603) at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
    Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)[INFO] Total time: 1.086 s [INFO] Finished at: 2020-06-17T15:07:54-04:00 java.lang.UnsupportedOperationException: clientBuilder.sslSocketFactory(SSLSocketFactory)
    not supported on JDK 9+ at okhttp3.internal.platform.Jdk9Platform.trustManager(Jdk9Platform.java:78) at okhttp3.OkHttpClient$Builder.sslSocketFactory(OkHttpClient.java:650) at io.takari.aether.okhttp.OkHttpAetherClient.
    <init>(OkHttpAetherClient.java:98) [INFO] Final Memory: 16M/491M [INFO] ------------------------------------------------------------------------ at io.takari.aether.connector.AetherRepositoryConnector.newAetherClient(AetherRepositoryConnector.java:276)
      at io.takari.aether.connector.AetherRepositoryConnector.
      <init>(AetherRepositoryConnector.java:191) at io.takari.aether.connector.AetherRepositoryConnectorFactory.newInstance(AetherRepositoryConnectorFactory.java:89) at org.eclipse.aether.internal.impl.DefaultRepositoryConnectorProvider.newRepositoryConnector(DefaultRepositoryConnectorProvider.java:113)
        at org.eclipse.aether.internal.impl.DefaultMetadataResolver$ResolveTask.run(DefaultMetadataResolver.java:603) at org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown
        Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) [ERROR] clientBuilder.sslSocketFactory(SSLSocketFactory) not supported on JDK 9+

My Pom. xml

http://maven.apache.org/xsd/maven-4.0.0.xsd "> 4.0.0 com.baml.baats.baats_reports_services baats_reports_services war

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <springboot.version>2.1.4.RELEASE</springboot.version>
    <java.version>1.8</java.version>
    <maven.compiler.source>1.8</maven.compiler.source>
    <maven.compiler.target>1.8</maven.compiler.target>
    <release.version>0.0.1-SNAPSHOT</release.version>
    <build.number>0</build.number>
    <ignite.version>2.7.6</ignite.version>
</properties>


<version>${release.version}-${build.number}</version>

<dependencies>
    <dependency>
        <groupId>com.baml.baats.baats_common</groupId>
        <artifactId>baats-common</artifactId>
        <version>1.0.0-27</version>
    </dependency>
      <dependency>
        <groupId>com.baml.etoefds.connect_services_core</groupId>
        <artifactId>connect-services-core</artifactId>
        <version>1.7.3</version>
    </dependency>
    <dependency>
        <groupId>dom4j</groupId>
        <artifactId>dom4j</artifactId>
        <version>1.6.1</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>
   <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-module-junit4</artifactId>
        <version>2.0.0</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-core</artifactId>
        <version>2.0.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.powermock</groupId>
        <artifactId>powermock-api-mockito2</artifactId>
        <version>2.0.0</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.jcraft</groupId>
        <artifactId>jsch</artifactId>
        <version>0.1.52</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <version>${springboot.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-batch</artifactId>
        <version>2.1.1.RELEASE</version>
    </dependency>
    <dependency>
        <groupId>org.hsqldb</groupId>
        <artifactId>hsqldb</artifactId>
        <version>1.8.0.10</version>
    </dependency>
    <dependency>
        <groupId>com.itextpdf</groupId>
        <artifactId>itextpdf</artifactId>
        <version>5.5.10</version>
    </dependency>

<!-- Spring Framework Caching Support -->
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-cache</artifactId>
    <version>${springboot.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-core</artifactId>
    <version>${ignite.version}</version>
    <exclusions>
        <exclusion>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-spring</artifactId>
    <version>${ignite.version}</version>
    <exclusions>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-aop</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-beans</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-expression</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
        </exclusion>
        <exclusion>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.apache.ignite</groupId>
    <artifactId>ignite-indexing</artifactId>
    <version>${ignite.version}</version>
</dependency>

</dependencies>
<distributionManagement>
    <repository>
        <id>releases</id>
        <name>libs-release</name>
        <url>http://code-artifacts.bankofamerica.com:18081/artifactory/libs-release</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <name>libs-snapshot</name>
        <url>http://code-artifacts.bankofamerica.com:18081/artifactory/libs-snapshot</url>
    </snapshotRepository>
</distributionManagement>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
                <execution>
                    <configuration>
                        <descriptor>src/main/resources/zip.xml</descriptor>
                        <finalName>baats_reports_services-properties-${release.version}</finalName>
                        <appendAssemblyId>false</appendAssemblyId>
                    </configuration>
                    <phase>package</phase>
                    <goals>
                        <goal>single</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

        <plugin>
            <artifactId>maven-failsafe-plugin</artifactId>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <configuration>
                <workingDirectory>${project.build.directory}</workingDirectory>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
                <execution>
                    <id>prepare-agent</id>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
                <execution>
                    <id>post-unit-test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                    <configuration>
                        <dataFile>target/jacoco.exec</dataFile>
                        <outputDirectory>target/jacoco-ut</outputDirectory>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <artifactId>maven-source-plugin</artifactId>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>3.1.0</version>
            <configuration>
                <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <version>${springboot.version}</version>
            <executions>
                <execution>
                    <goals>
                        <goal>build-info</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

1 Ответ

0 голосов
/ 17 июня 2020

Возможно, это ошибка https://github.com/takari/aether-connector-okhttp. Это происходит только в том случае, если сам Aether не может получить диспетчер доверия.

https://github.com/takari/aether-connector-okhttp/blob/master/src/main/java/io/takari/aether/okhttp/OkHttpAetherClient.java#L113

Метод OkHttpClient.Builder.sslSocketFactory устарел (4 года назад go) в течение длительного времени и специально не поддерживается в JDK9 + из-за изменений в модульной системе, а также из-за использования деталей реализации Oracle JDK 8, которые не поддерживаются 9, 10, 11, 12, 13 , 14 и т. c.

https://github.com/square/okhttp/commit/85f74e2004eaf0d4ff339e8644df3d8e716361e5

https://github.com/square/okhttp/blob/okhttp_3.12.x/okhttp/src/main/java/okhttp3/internal/platform/Jdk9Platform.java#L84 -L91

...