Skip to content
This repository was archived by the owner on Aug 13, 2026. It is now read-only.

Feature/add java 9 support - #712

Merged
nickkeers merged 12 commits into
developfrom
unknown repository
Feb 27, 2018
Merged

Feature/add java 9 support#712
nickkeers merged 12 commits into
developfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Feb 26, 2018

Copy link
Copy Markdown

Related Issue

#711

How Has This Been Tested?

mvn test & mvn install

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • Javadoc comments for any new public classes, interfaces, etc.

bryanhuntesl added 9 commits February 26, 2018 16:24
Firstly, in time honored tradition - the maven enforcer plugin crashes with a null pointer exception, compatibility hasn't been maintained by the Apache team in their latest product iteration. As far as I can see, the sole purpose of this plugin is to enforce the use of Maven 3.0 during builds - Maven 3.0 is obsolete btw.

⚛︎□▷ mvn compile
[INFO] Scanning for projects...
[WARNING] The project com.basho.riak:riak-client:jar:2.1.2-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Riak Client for Java 2.1.2-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce-property) @ riak-client ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.751 s
[INFO] Finished at: 2018-02-26T14:16:28Z
[INFO] Final Memory: 9M/32M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce (enforce-property) on project riak-client: Execution enforce-property of goal org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-enforcer-plugin:1.4.1:enforce: java.lang.ExceptionInInitializerError: null
[ERROR] -----------------------------------------------------
[ERROR] realm =    plugin>org.apache.maven.plugins:maven-enforcer-plugin:1.4.1
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/plugins/maven-enforcer-plugin/1.4.1/maven-enforcer-plugin-1.4.1.jar
[ERROR] urls[1] = file:/Users/bryanhunt/.m2/repository/backport-util-concurrent/backport-util-concurrent/3.1/backport-util-concurrent-3.1.jar
[ERROR] urls[2] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.11/plexus-interpolation-1.11.jar
[ERROR] urls[3] = file:/Users/bryanhunt/.m2/repository/org/slf4j/slf4j-jdk14/1.5.6/slf4j-jdk14-1.5.6.jar
[ERROR] urls[4] = file:/Users/bryanhunt/.m2/repository/org/slf4j/jcl-over-slf4j/1.5.6/jcl-over-slf4j-1.5.6.jar
[ERROR] urls[5] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/reporting/maven-reporting-api/2.2.1/maven-reporting-api-2.2.1.jar
[ERROR] urls[6] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/doxia/doxia-sink-api/1.1/doxia-sink-api-1.1.jar
[ERROR] urls[7] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/doxia/doxia-logging-api/1.1/doxia-logging-api-1.1.jar
[ERROR] urls[8] = file:/Users/bryanhunt/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
[ERROR] urls[9] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-interactivity-api/1.0-alpha-4/plexus-interactivity-api-1.0-alpha-4.jar
[ERROR] urls[10] = file:/Users/bryanhunt/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[11] = file:/Users/bryanhunt/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[12] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-utils/3.0.22/plexus-utils-3.0.22.jar
[ERROR] urls[13] = file:/Users/bryanhunt/.m2/repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar
[ERROR] urls[14] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/enforcer/enforcer-api/1.4.1/enforcer-api-1.4.1.jar
[ERROR] urls[15] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/enforcer/enforcer-rules/1.4.1/enforcer-rules-1.4.1.jar
[ERROR] urls[16] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/shared/maven-common-artifact-filters/1.4/maven-common-artifact-filters-1.4.jar
[ERROR] urls[17] = file:/Users/bryanhunt/.m2/repository/org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
[ERROR] urls[18] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[19] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[20] = file:/Users/bryanhunt/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[21] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-i18n/1.0-beta-6/plexus-i18n-1.0-beta-6.jar
[ERROR] urls[22] = file:/Users/bryanhunt/.m2/repository/org/apache/maven/plugin-testing/maven-plugin-testing-harness/1.3/maven-plugin-testing-harness-1.3.jar
[ERROR] urls[23] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-archiver/2.2/plexus-archiver-2.2.jar
[ERROR] urls[24] = file:/Users/bryanhunt/.m2/repository/org/codehaus/plexus/plexus-io/2.0.4/plexus-io-2.0.4.jar
[ERROR] urls[25] = file:/Users/bryanhunt/.m2/repository/junit/junit/4.11/junit-4.11.jar
[ERROR] urls[26] = file:/Users/bryanhunt/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]
[ERROR]
[ERROR] -----------------------------------------------------
[ERROR] : begin 0, end 3, length 1
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginContainerException
Warnings as errors - warning wrt conversion/use of Long in riak/client/core/query/timeseries/DescribeQueryResultParser.java breaks the build - it's deprecated as of Java 9 (installed by default on OSX). IMHO - at this point in product life-cycle better to generate a warning and have folk build the project than fail on something that will be a (potential) issue come Java 10 (and it's debatable whether there's any point in keeping the Riak TS code anyway).
DatatypeConverter is java.xml - can't rely on it being present - I don't know why apache commons codec wasn't used in the first place - every hack has it's price - in this case, it didn't build.
there's a reason why it's called 'internal' you can't depend on it existing in future versions - like now for example :-D
hard to see how this ever worked - it'll work now though.
mockito won't tolerate mocking, then not using the mock anymore - it throws  org.mockito.exceptions.misusing.UnnecessaryStubbingException - I've stubbed them out rather than delete in case it's necessary to reason about intent at some point in the future.
Started off with fixing bad call to verifyStatic (API has changed) then having spent about an hour figuring out what was wrong - UnfinishedVerificationException - it was never being hit anyway.
@ghost

ghost commented Feb 26, 2018

Copy link
Copy Markdown
Author

So for info, the Travis failure is on 2.0.8 :

testCreateIndexTimeout(com.basho.riak.client.core.operations.itest.ITestYzAdminOperations)  Time elapsed: 5.645 sec  <<< FAILURE!
java.lang.AssertionError
	at com.basho.riak.client.core.operations.itest.ITestYzAdminOperations.testCreateIndexTimeout(ITestYzAdminOperations.java:171)

2.2.0 succeeds - wondering if it's worth investigating the failure on 2.0.8 or just to target the Java 9 support for 2.2 + ?

public void testCreateIndexTimeout() throws InterruptedException, ExecutionException
{
YokozunaIndex index = new YokozunaIndex(timeoutIndex);
YzPutIndexOperation putOp = new YzPutIndexOperation.Builder(index).withTimeout(1).build();
final RiakFuture<Void, YokozunaIndex> future = cluster.execute(putOp);
future.await();
final Throwable ex = future.cause();
assertNotNull(ex);
assertEquals(RiakResponseException.class, ex.getClass());
assertTrue(ex.getMessage().contains(timeoutIndex));
assertTrue(ex.getMessage().contains("1 ms timeout"));
}

@jplock

jplock commented Feb 26, 2018

Copy link
Copy Markdown
Contributor

Will this PR impact JDK8 support? I think targeting 2.2.0 makes sense to me as the team is actively working on a 2.2.5 release (then move on to 3.0.0).

@ghost

ghost commented Feb 27, 2018

Copy link
Copy Markdown
Author

@jplock JDK8 will still be supported - maven is configured to generate java 8 bytecode .

Variable set here :

https://github.com/postbasho/riak-java-client/blob/cfc03334515e829d9861a4fd947a11f8d6c7f669/pom.xml#L72

And configuration here :

https://github.com/postbasho/riak-java-client/blob/cfc03334515e829d9861a4fd947a11f8d6c7f669/pom.xml#L362-L363

I've also added a couple of JDK to the travis test matrix (previously it was just Oracle 8) - I specifically added OpenJDK 8 as it's threading model is compliant but interleaving is different and can expose some subtle implementation bugs.

jdk:
  - oraclejdk8
  - oraclejdk9
  - openjdk8

@ghost

ghost commented Feb 27, 2018

Copy link
Copy Markdown
Author

OK - build is failing on Java 9 - not because of my changes - but because Yokozuna (Riak running Java as a sub-process) starts it's Solr instance with the following args :

/usr/bin/java -Djava.awt.headless=true
-Djetty.home=/usr/lib/riak/lib/yokozuna-2.1.7-0-g6cf80ad/priv/solr
-Djetty.temp=/var/lib/riak/yz_temp
-Djetty.port=8093
-Dsolr.solr.home=/var/lib/riak/yz
-DhostContext=/internal_solr
-cp
/usr/lib/riak/lib/yokozuna-2.1.7-0-g6cf80ad/priv/solr/start.jar
-Dlog4j.configuration=file:///etc/riak/solr-log4j.properties
-Dyz.lib.dir=/usr/lib/riak/lib/yokozuna-2.1.7-0-g6cf80ad/priv/java_lib
-d64
-Xms1g
-Xmx1g
-XX:+UseStringCache
-XX:+UseCompressedOops
-Dcom.sun.management.jmxremote.port=8985
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
org.eclipse.jetty.start.Main

Here's the console output :

2018-02-27 11:43:03.503 [info] <0.590.0>@riak_core:wait_for_service:504 Waiting for service riak_kv to start (0 seconds)
2018-02-27 11:43:13.207 [info] <0.590.0>@riak_core:wait_for_service:498 Wait complete for service riak_kv (9 seconds)
2018-02-27 11:43:13.210 [info] <0.377.0>@riak_core:wait_for_service:498 Wait complete for service riak_kv (9 seconds)
2018-02-27 11:43:13.227 [info] <0.1896.0>@yz_solr_proc:ensure_data_dir:277 No solr config found, creating a new one
2018-02-27 11:43:13.229 [info] <0.1896.0>@yz_solr_proc:init:119 Starting solr: 
snip = ^^ see summary above ^^^^ 
2018-02-27 11:43:13.234 [info] <0.1896.0>@yz_solr_proc:handle_info:184 solr stdout/err: Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m
Unrecognized VM option 'UseStringCache'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

So the problem is not that the riak-java-client won't run on Java 9 - but that the default arguments used by Riak to start Yokozuna (Search) are incompatible with java version 9.

Created an issue to address this in yokozuna repo - suggest this p/r is good to merge.

@nickkeers nickkeers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

so why this file? die with fire
@nickkeers
nickkeers merged commit bed6cd6 into basho:develop Feb 27, 2018
@ghost

ghost commented Feb 27, 2018

Copy link
Copy Markdown
Author

Thanks gents.

@ghost
ghost deleted the feature/add-java-9-support branch February 27, 2018 17:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants