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

ASF GitHub Bot commented on HADOOP-19219:
-----------------------------------------

adoroszlai commented on code in PR #6939:
URL: https://github.com/apache/hadoop/pull/6939#discussion_r1678966782


##########
hadoop-common-project/hadoop-auth/pom.xml:
##########
@@ -272,5 +272,68 @@
         </plugins>
       </build>
     </profile>
+    <profile>
+      <id>java-8</id>
+      <activation>
+        <jdk>1.8</jdk>
+      </activation>
+      <properties>
+        <maven.compiler.source>${javac.version}</maven.compiler.source>
+        <maven.compiler.target>${javac.version}</maven.compiler.target>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-enforcer-plugin</artifactId>
+            <version>3.0.0</version>
+            <executions>
+              <execution>
+                <id>enforce-java-version</id>
+                <goals>
+                  <goal>enforce</goal>
+                </goals>
+                <configuration>
+                  <rules>
+                    <requireJavaVersion>
+                      <version>1.8</version>
+                    </requireJavaVersion>
+                  </rules>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <profile>
+      <id>x509-suppress</id>
+      <activation>
+        <jdk>[9,)</jdk>
+      </activation>
+      <properties>
+        <maven.compiler.source>${javac.version}</maven.compiler.source>
+        <maven.compiler.target>${javac.version}</maven.compiler.target>

Review Comment:
   > I have experienced a lot of the following error cases when running jar on 
JDK 8 that built with newer JDK with release 8
   
   Using `-target` or `--release`?
   
   Because that's exactly the kind of problem `--release` solves compared to 
`-target`.
   
   It's easy to reproduce the problem and verify the fix:
   
   ```bash
   $ cat > NoSuchMethod.java <<EOF
   import java.nio.ByteBuffer;
   
   public class NoSuchMethod {
   
     public static void main(String[] args) {
       
System.out.println(ByteBuffer.allocate(100).position(20).limit(62).remaining());
     }
   
   }
   EOF
   
   $ usr/lib/jvm/java-11-openjdk-amd64/bin/javac -Xlint:none -source 8 -target 
8 NoSuchMethod.java \
     && /usr/lib/jvm/java-8-openjdk-amd64/bin/java NoSuchMethod
   Exception in thread "main" java.lang.NoSuchMethodError: 
java.nio.ByteBuffer.position(I)Ljava/nio/ByteBuffer;
        at NoSuchMethod.main(NoSuchMethod.java:6)
   
   $ /usr/lib/jvm/java-11-openjdk-amd64/bin/javac --release 8 NoSuchMethod.java 
\
     && /usr/lib/jvm/java-8-openjdk-amd64/bin/java NoSuchMethod
   42
   ```





> Resolve Certificate error in Hadoop-auth tests.
> -----------------------------------------------
>
>                 Key: HADOOP-19219
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19219
>             Project: Hadoop Common
>          Issue Type: Sub-task
>            Reporter: Muskan Mishra
>            Priority: Major
>              Labels: pull-request-available
>
> While compiling Hadoop-Trunk with JDK17, faced following errors in 
> TestMultiSchemeAuthenticationHandler and 
> TestLdapAuthenticationHandler classes.
> {code:java}
> [INFO] Running 
> org.apache.hadoop.security.authentication.server.TestMultiSchemeAuthenticationHandler
> [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.256 
> s <<< FAILURE! - in 
> org.apache.hadoop.security.authentication.server.TestMultiSchemeAuthenticationHandler
> [ERROR] 
> org.apache.hadoop.security.authentication.server.TestMultiSchemeAuthenticationHandler
>   Time elapsed: 1.255 s  <<< ERROR!
> java.lang.IllegalAccessError: class 
> org.apache.directory.server.core.security.CertificateUtil (in unnamed module 
> @0x32e614e9) cannot access class sun.security.x509.X500Name (in module 
> java.base) because module java.base does not export sun.security.x509 to 
> unnamed module @0x32e614e9
>         at 
> org.apache.directory.server.core.security.CertificateUtil.createTempKeyStore(CertificateUtil.java:334)
>         at 
> org.apache.directory.server.factory.ServerAnnotationProcessor.instantiateLdapServer(ServerAnnotationProcessor.java:158)
>         at 
> org.apache.directory.server.factory.ServerAnnotationProcessor.createLdapServer(ServerAnnotationProcessor.java:318)
>         at 
> org.apache.directory.server.factory.ServerAnnotationProcessor.createLdapServer(ServerAnnotationProcessor.java:351)
>  {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to