Bug 40085 - После сборки с Java11 не работает в окружении с Java8
Summary: После сборки с Java11 не работает в окружении с Java8
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: httpcomponents-client (show other bugs)
Version: unstable
Hardware: x86_64 Linux
: P5 normal
Assignee: viy
QA Contact: qa-sisyphus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-24 17:54 MSK by Stanislav Levin
Modified: 2021-05-26 21:50 MSK (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stanislav Levin 2021-05-24 17:54:39 MSK
Падает установка KRA (Dogtag PKI):

[root@2e3b1945731e /]# pki --debug -d /etc/pki/pki-tomcat/alias -f
'/etc/pki/pki-tomcat/password.conf' -U https://master1.ipa.test:8443
--ignore-cert-status UNTRUSTED_ISSUER ca-cert-signing-export --pkcs7
INFO: PKI options: --debug -d /etc/pki/pki-tomcat/alias -f
/etc/pki/pki-tomcat/password.conf
INFO: PKI command: https://master1.ipa.test:8443 -U
https://master1.ipa.test:8443 --ignore-cert-status UNTRUSTED_ISSUER
ca-cert-signing-export --pkcs7
INFO: Java command: /usr/lib/jvm/jre/bin/java -cp /usr/share/pki/lib/*
-Djava.util.logging.config.file=/usr/share/pki/etc/logging.properties
com.netscape.cmstools.cli.MainCLI -d /etc/pki/pki-tomcat/alias -f
/etc/pki/pki-tomcat/password.conf --debug -U
https://master1.ipa.test:8443 --ignore-cert-status UNTRUSTED_ISSUER
ca-cert-signing-export --pkcs7
INFO: Server URL: https://master1.ipa.test:8443
INFO: Loading NSS password configuration from
/etc/pki/pki-tomcat/password.conf
FINE: PlainPasswordFile: Initializing PlainPasswordFile
INFO: NSS database: /etc/pki/pki-tomcat/alias
INFO: Message format: null
INFO: Command: ca-cert-signing-export --pkcs7
INFO: Module: ca
INFO: Initializing NSS
INFO: Logging into internal token
INFO: Using internal token
INFO: Module: cert
INFO: Module: signing-export
INFO: Connecting to https://master1.ipa.test:8443
java.lang.NoSuchMethodError: java.nio.ByteBuffer.flip()Ljava/nio/ByteBuffer;
        at
org.apache.http.client.utils.URLEncodedUtils.urlDecode(URLEncodedUtils.java:682)
        at
org.apache.http.client.utils.URLEncodedUtils.parsePathSegments(URLEncodedUtils.java:364)
        at
org.apache.http.client.utils.URIBuilder.parsePath(URIBuilder.java:118)
        at
org.apache.http.client.utils.URIBuilder.digestURI(URIBuilder.java:197)
        at
org.apache.http.client.utils.URIBuilder.<init>(URIBuilder.java:91)
        at
org.apache.http.client.utils.URIUtils.rewriteURI(URIUtils.java:206)
        at
org.apache.http.impl.client.DefaultRequestDirector.rewriteRequestURI(DefaultRequestDirector.java:347)
        at
org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:471)
        at
org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:836)
        at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)
        at
org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
        at
org.jboss.resteasy.client.jaxrs.engines.ApacheHttpClient4Engine.invoke(ApacheHttpClient4Engine.java:313)
        at
org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.invoke(ClientInvocation.java:442)
        at
org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:106)
        at
org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76)
        at com.sun.proxy.$Proxy23.getInfo(Unknown Source)
        at org.dogtagpki.common.InfoClient.getInfo(InfoClient.java:43)
        at com.netscape.certsrv.client.PKIClient.getInfo(PKIClient.java:221)
        at com.netscape.cmstools.cli.MainCLI.getClient(MainCLI.java:597)
        at org.dogtagpki.cli.CLI.getClient(CLI.java:201)
        at org.dogtagpki.cli.CLI.getClient(CLI.java:201)
        at org.dogtagpki.cli.CLI.getClient(CLI.java:201)
        at
com.netscape.cmstools.ca.CACertSigningExportCLI.execute(CACertSigningExportCLI.java:70)
        at org.dogtagpki.cli.CommandCLI.execute(CommandCLI.java:57)
        at org.dogtagpki.cli.CLI.execute(CLI.java:352)
        at org.dogtagpki.cli.CLI.execute(CLI.java:352)
        at
com.netscape.cmstools.cli.SubsystemCLI.execute(SubsystemCLI.java:76)
        at org.dogtagpki.cli.CLI.execute(CLI.java:352)
        at com.netscape.cmstools.cli.MainCLI.execute(MainCLI.java:658)
        at com.netscape.cmstools.cli.MainCLI.main(MainCLI.java:694)
ERROR: Command: /usr/lib/jvm/jre/bin/java -cp /usr/share/pki/lib/*
-Djava.util.logging.config.file=/usr/share/pki/etc/logging.properties
com.netscape.cmstools.cli.MainCLI -d /etc/pki/pki-tomcat/alias -f
/etc/pki/pki-tomcat/password.conf --debug -U
https://master1.ipa.test:8443 --ignore-cert-status UNTRUSTED_ISSUER
ca-cert-signing-export --pkcs7


httpcomponents-client был обновлен 2 мая.

Из лога сборки с дебагом %mvn_build --debug --
-Dmaven.compile.source=1.8 -Dmaven.compile.target=1.8:

[DEBUG]   (f) compilerId = javac
[DEBUG]   (f) debug = true
[DEBUG]   (f) encoding = UTF-8
[DEBUG]   (f) failOnError = true
[DEBUG]   (f) failOnWarning = false
[DEBUG]   (f) forceJavacCompilerUse = false
[DEBUG]   (f) fork = false
[DEBUG]   (f) generatedSourcesDirectory =
/usr/src/RPM/BUILD/httpcomponents-client-4.5.10/httpclient/target/generated-sources/annotations
[DEBUG]   (f) mojoExecution =
org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile {execution:
default-compile}
[DEBUG]   (f) optimize = true
[DEBUG]   (f) outputDirectory =
/usr/src/RPM/BUILD/httpcomponents-client-4.5.10/httpclient/target/classes
[DEBUG]   (f) parameters = false
[DEBUG]   (f) project = MavenProject:
org.apache.httpcomponents:httpclient:4.5.10 @
/usr/src/RPM/BUILD/httpcomponents-client-4.5.10/httpclient/pom.xml
[DEBUG]   (f) projectArtifact =
org.apache.httpcomponents:httpclient:jar:4.5.10
[DEBUG]   (f) session = org.apache.maven.execution.MavenSession@4d1ff6b1
[DEBUG]   (f) showDeprecation = true
[DEBUG]   (f) showWarnings = false
[DEBUG]   (f) skipMultiThreadWarning = false
[DEBUG]   (f) source = 1.6
[DEBUG]   (f) staleMillis = 0
[DEBUG]   (s) target = 1.6
[DEBUG]   (f) useIncrementalCompilation = true
[DEBUG]   (f) verbose = false

Видно, что source и target проигнорированы.
Причина в опечатке(пропущена 'r')

maven.compile.xxx -> maven.compiler.xxx

В этом(при опечатке) случае применяются значения из конфига. Таких опечаток в сизифе

[slevdc@shell specs]$ git grep -F 'maven.compile.' | wc -l
63

Но даже собрав httpcomponents-client с исправлением опечатки я не
получил желаемого. Напомню, pki принудительно собирается c Java8 (хотя
уже можно переходить на 11).
Оказалось, что дело в http://openjdk.java.net/jeps/247
а именно

Motivation
javac provides two command line options, -source and -target, which can
be used to select the version of the Java language accepted by the
compiler and the version of the class files it produces, respectively.
By default, however, javac compiles against the most-recent version of
the platform APIs. The compiled program can therefore accidentally use
APIs only available in the current version of the platform. Such
programs cannot run on older versions of the platform, regardless of the
values passed to the -source and -target options. This is a long-term
usability pain point, since users expect that by using these options
they'll get class files that can run on the the platform version
specified by -target.

То есть я собрал с compiler.release=8
%mvn_build --debug -- -Dmaven.compiler.source=1.8
-Dmaven.compiler.target=1.8 -Dmaven.javadoc.source=1.8
-Dmaven.compiler.release=8

Теперь работает в окружении с Java8.
Comment 1 Stanislav Levin 2021-05-24 18:03:58 MSK
сборка Dogtag PKI с Java11 заблокирована https://bugzilla.altlinux.org/show_bug.cgi?id=40086
Comment 2 viy 2021-05-26 20:26:53 MSK
Закрыто сборкой alt2_*.
Comment 3 Michael Shigorin 2021-05-26 20:47:32 MSK
Спасибо!

2 rider: помогло?
Comment 4 viy 2021-05-26 21:50:58 MSK
(Ответ для Michael Shigorin на комментарий #3)
> Спасибо!
> 
> 2 rider: помогло?

Да, мне сказал Станислав.